/* ======================
   SISTEMA DE BLOG - FORMULÁRIO
   Protec Premium Granite
   ====================== */

/* RESET E VARIÁVEIS */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-gray: #ecf0f1;
    --medium-gray: #95a5a6;
    --dark-gray: #34495e;
    --white: #ffffff;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--primary-color);
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
}

/* CONTAINER */
.container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

/* HEADER */
.form-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--secondary-color);
}

.form-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.form-header p {
    color: var(--medium-gray);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.header-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
}

.btn-clear {
    background: var(--danger-color);
    color: var(--white);
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-clear:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-config {
    background: var(--secondary-color);
    color: var(--white);
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-config:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.auto-save-status {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--success-color);
    font-weight: 500;
    min-height: 20px;
    transition: var(--transition);
}

/* FORM SECTIONS */
.form-section {
    margin-bottom: 40px;
    padding: 30px;
    background: #f8f9fa;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--secondary-color);
}

.form-section h2 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* FORM GROUPS */
.form-group {
    margin-bottom: 20px;
}

.form-group.required label::after {
    content: ' *';
    color: var(--danger-color);
    font-weight: bold;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.form-group .tooltip {
    display: inline-block;
    margin-left: 5px;
    color: var(--medium-gray);
    font-weight: normal;
    font-size: 0.85rem;
    font-style: italic;
}

/* INPUTS */
input[type="text"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: var(--white);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* INPUT WITH PREFIX */
.input-with-prefix {
    display: flex;
    align-items: stretch;
}

.input-with-prefix .prefix {
    background: var(--light-gray);
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-right: none;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    font-weight: 600;
    color: var(--medium-gray);
}

.input-with-prefix input {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* FORM ROW */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* COUNTERS */
.char-counter,
.word-counter {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: var(--medium-gray);
}

/* CHECKBOXES */
input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

.form-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
}

/* DYNAMIC FIELDS */
.internal-image-item,
.link-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    margin-bottom: 10px;
    padding: 15px;
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid #ddd;
}

.btn-remove {
    background: var(--danger-color);
    color: var(--white);
    border: none;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition);
}

.btn-remove:hover {
    background: #c0392b;
    transform: scale(1.05);
}

/* EDITOR TOOLBAR */
.editor-toolbar {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    padding: 10px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    flex-wrap: wrap;
}

.editor-btn {
    padding: 8px 15px;
    background: var(--white);
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.editor-btn:hover {
    background: var(--secondary-color);
    color: var(--white);
    border-color: var(--secondary-color);
}

/* BUTTONS */
.btn-primary,
.btn-secondary {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--dark-gray);
}

.btn-secondary:hover {
    background: var(--medium-gray);
    color: var(--white);
}

/* FORM ACTIONS */
.form-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--light-gray);
}

/* MODALS */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--white);
    padding: 40px;
    border-radius: var(--border-radius);
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: var(--medium-gray);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger-color);
    transform: rotate(90deg);
}

.modal-content h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

/* SUCCESS MODAL */
.modal-content.success {
    text-align: center;
}

.modal-content.success h2 {
    color: var(--success-color);
    font-size: 2rem;
    margin-bottom: 20px;
}

.modal-content.success code {
    display: block;
    padding: 15px;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: var(--dark-gray);
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* PREVIEW STYLES */
.preview-post {
    padding: 20px;
}

.preview-post header {
    margin-bottom: 30px;
}

.preview-post .category-badge {
    display: inline-block;
    padding: 5px 15px;
    background: var(--secondary-color);
    color: var(--white);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.preview-post h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    line-height: 1.2;
}

.preview-post .meta {
    display: flex;
    gap: 20px;
    color: var(--medium-gray);
    font-size: 0.9rem;
}

.preview-post img {
    margin: 20px 0;
    border-radius: var(--border-radius);
}

.preview-post .content {
    margin: 30px 0;
}

.preview-post .intro {
    font-size: 1.1rem;
    color: var(--dark-gray);
    margin-bottom: 30px;
    padding-left: 20px;
    border-left: 4px solid var(--secondary-color);
}

.preview-post .tags {
    margin: 30px 0;
}

.preview-post .tag {
    display: inline-block;
    padding: 5px 12px;
    background: var(--light-gray);
    color: var(--dark-gray);
    border-radius: 15px;
    font-size: 0.85rem;
    margin-right: 8px;
    margin-bottom: 8px;
}

.preview-post .cta {
    background: linear-gradient(135deg, var(--secondary-color), #2980b9);
    color: var(--white);
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    margin-top: 30px;
}

.preview-post .cta h3 {
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.preview-post .cta-btn {
    display: inline-block;
    padding: 12px 30px;
    background: var(--white);
    color: var(--secondary-color);
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    margin-top: 15px;
    transition: var(--transition);
}

.preview-post .cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* SMALL TEXT */
small {
    font-size: 0.85rem;
    color: var(--medium-gray);
    display: block;
    margin-top: 5px;
}

/* LOADING STATE */
body.loading {
    cursor: wait;
    pointer-events: none;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    .form-header h1 {
        font-size: 1.8rem;
    }
    
    .form-section {
        padding: 20px;
    }
    
    .internal-image-item,
    .link-item {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--medium-gray);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-gray);
}

/* ANIMATIONS */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-section {
    animation: fadeIn 0.5s ease;
}

/* AI SECTION */
.ai-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    border-left: 4px solid #ffd700;
}

.ai-section h2 {
    color: var(--white);
}

.ai-instructions {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.ai-instructions p {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.ai-instructions ol {
    margin-left: 20px;
    line-height: 1.8;
}

.ai-section label {
    color: var(--white);
}

.ai-section .tooltip {
    color: rgba(255, 255, 255, 0.8);
}

#aiTemplate {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.8;
    background: #2c3e50;
    color: #ecf0f1;
    border: 2px solid #34495e;
    padding: 20px;
    min-height: 400px;
}

#aiTemplate::placeholder {
    color: #95a5a6;
}

.btn-ai {
    background: #ffd700;
    color: var(--primary-color);
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
}

.btn-ai:hover {
    background: #ffed4e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.copy-status {
    margin-left: 15px;
    font-weight: 600;
    font-size: 1rem;
}

/* GITHUB MODAL STYLES */
.github-steps {
    background: #f8f9fa;
    padding: 20px;
    border-radius: var(--border-radius);
    margin: 20px 0;
}

.github-steps h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.github-steps ol {
    margin-left: 20px;
    line-height: 2;
}

.github-steps a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
}

.github-steps a:hover {
    text-decoration: underline;
}

.github-steps code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

#tokenStatus {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 600;
}

#tokenStatus.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#tokenStatus.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#githubToken {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}
