/* Reset e configurações gerais */

:root {
    --primary-dark: #1a365d;
    --primary-medium: #2d3748;
    --primary-light: #4a5568;
    --accent-blue: #3182ce;
    --accent-light: #63b3ed;
    --text-light: #e2e8f0;
    --text-lighter: #f7fafc;
    --bg-dark: #0f1419;
    --bg-card: #1e293b;
    --border-color: #334155;
    --success: #48bb78;
    --warning: #ed8936;
    --error: #f56565;
}

[data-theme="light"] {
    --primary-dark: #f8fafc;
    --primary-medium: #e2e8f0;
    --primary-light: #cbd5e1;
    --accent-blue: #2c5aa0;
    --accent-light: #63b3ed;
    --text-light: #2d3748;
    --text-lighter: #1a202c;
    --bg-dark: #f1f5f9;
    --bg-card: #ffffff;
    --border-color: #d1d5db;
    --success: #2f855a;
    --warning: #c05621;
    --error: #c53030;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===== SELETOR DE TEMA ===== */
.theme-selector {
    background: var(--bg-card);
    color: var(--text-light);
    padding: 0;
    font-size: 14px;
    position: relative;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.theme-selector-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
}

.theme-logo {
    font-weight: 600;
    color: var(--text-lighter);
    font-size: 16px;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, #667eea, #764ba2);
    transition: all 0.4s ease;
    border-radius: 34px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.theme-slider:before {
    content: "";
    position: absolute;
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: all 0.4s ease;
    border-radius: 50%;
    z-index: 2;
}

.theme-switch input:checked + .theme-slider {
    background: linear-gradient(145deg, #ff9a9e, #fad0c4);
}

.theme-switch input:checked + .theme-slider:before {
    transform: translateX(30px);
    background: #f8f9fa;
}

.theme-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    transition: all 0.4s ease;
    z-index: 1;
}

.theme-icon.sun {
    left: 8px;
    opacity: 0;
}

.theme-icon.moon {
    right: 8px;
    opacity: 1;
}

.theme-switch input:checked + .theme-slider .theme-icon.sun {
    opacity: 1;
}

.theme-switch input:checked + .theme-slider .theme-icon.moon {
    opacity: 0;
}

.theme-switch:hover .theme-slider {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--accent-blue) 100%);
    color: var(--text-lighter);
    margin-bottom: 30px;
    padding: 25px 40px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.logo {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo i {
    font-size: 3rem;
    background: var(--text-lighter);
    color: var(--primary-dark);
    padding: 15px;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35);
}

.logo h1 {
    font-size: 2.4rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Layout principal */
.main-content {
    display: flex;
    gap: 30px;
    margin-bottom: 40px;
}

/* Sidebar */
.sidebar {
    flex: 0 0 320px;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    height: fit-content;
    position: sticky;
    top: 20px;
    border: 1px solid var(--border-color);
}

.sidebar-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section:last-child {
    border-bottom: none;
}

.sidebar-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-lighter);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.sidebar-section h3 i {
    color: var(--accent-blue);
}

#template-list {
    list-style: none;
}

#template-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--success);
    font-weight: 500;
}

.tip {
    background: rgba(49, 130, 206, 0.12);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--accent-blue);
    color: var(--text-light);
}

.tip ul {
    margin-left: 20px;
    margin-top: 10px;
}

.tip li {
    margin-bottom: 5px;
    color: var(--text-light);
}

.template-status {
    padding: 10px;
    border-radius: 6px;
    background: rgba(15, 20, 25, 0.4);
    border: 1px solid var(--border-color);
}

.template-status p {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Conteúdo principal */
.content {
    flex: 1;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 35px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
}

/* Formulário */
.form-section {
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
}

.form-section h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-lighter);
    margin-bottom: 25px;
    font-size: 1.6rem;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--accent-blue);
}

.form-section h2 i {
    color: var(--accent-blue);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-light);
}

.form-group label i {
    color: var(--accent-blue);
    font-size: 0.9em;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background: var(--primary-medium);
    color: var(--text-light);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-light);
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Opções de checkbox */
.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
    background: rgba(15, 20, 25, 0.45);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--primary-medium);
    border-radius: 6px;
    transition: transform 0.2s;
    border: 1px solid var(--border-color);
}

.option-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.option-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

.option-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
}

/* Botões */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 40px;
    position: relative;
}

.btn-generate,
.btn-reset,
.btn-download-all,
.btn-download-individual,
.btn-copy {
    padding: 16px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s;
}

.btn-generate {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #2c5aa0 100%);
    color: white;
    flex: 2;
}

.btn-generate:hover {
    background: linear-gradient(135deg, #2c5aa0 0%, #244b86 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(49, 130, 206, 0.35);
}

.btn-reset {
    background: var(--primary-light);
    color: white;
    flex: 1;
}

.btn-reset:hover {
    background: var(--primary-medium);
    transform: translateY(-3px);
}

.loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 20, 25, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 1.1rem;
    color: var(--accent-light);
    font-weight: 600;
    border-radius: 8px;
    z-index: 10;
}

/* Resultados */
.hidden {
    display: none !important;
}

.results-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 3px solid var(--accent-blue);
}

.success-message {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    background: linear-gradient(135deg, rgba(72, 187, 120, 0.18) 0%, rgba(56, 161, 105, 0.2) 100%);
    color: var(--text-lighter);
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 2px solid rgba(72, 187, 120, 0.4);
}

.success-message i {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.success-detail {
    margin-top: 8px;
    color: var(--text-light);
    font-size: 0.95rem;
    opacity: 0.85;
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.document-card {
    background: linear-gradient(135deg, var(--primary-medium) 0%, var(--bg-card) 100%);
    border-radius: 10px;
    padding: 25px;
    border: 2px solid var(--border-color);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.document-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--accent-blue) 0%, #2c5aa0 100%);
}

.document-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    border-color: var(--accent-blue);
}

.document-card h4 {
    color: var(--text-lighter);
    margin-bottom: 10px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.document-card h4 i {
    color: var(--accent-blue);
}

.document-card p {
    color: var(--text-light);
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.5;
    opacity: 0.8;
}

.document-buttons {
    display: flex;
    gap: 10px;
}

.btn-download,
.btn-preview {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    flex: 1;
    justify-content: center;
}

.btn-download {
    background: linear-gradient(135deg, #27ae60 0%, #219653 100%);
    color: white;
}

.btn-download:hover {
    background: linear-gradient(135deg, #219653 0%, #1e7e34 100%);
    transform: translateY(-2px);
}

.btn-preview {
    background: var(--primary-light);
    color: var(--text-lighter);
}

.btn-preview:hover {
    background: var(--primary-medium);
    transform: translateY(-2px);
}

/* Download em lote */
.download-options {
    background: rgba(49, 130, 206, 0.12);
    border-radius: 10px;
    padding: 30px;
    margin: 40px 0;
    text-align: center;
    border: 2px solid rgba(49, 130, 206, 0.3);
}

.download-options h3 {
    color: var(--text-lighter);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.download-options p {
    color: var(--text-light);
    margin-bottom: 25px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.85;
}

.btn-download-all,
.btn-download-individual {
    margin: 0 10px;
    padding: 15px 25px;
}

.btn-download-all {
    background: linear-gradient(135deg, #805ad5 0%, #6b46c1 100%);
    color: white;
}

.btn-download-all:hover {
    background: linear-gradient(135deg, #6b46c1 0%, #553c9a 100%);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(128, 90, 213, 0.35);
}

.btn-download-individual {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #2c5aa0 100%);
    color: white;
}

.btn-download-individual:hover {
    background: linear-gradient(135deg, #2c5aa0 0%, #244b86 100%);
    transform: translateY(-3px);
}

/* Resumo de dados */
.data-summary {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 25px;
    margin-top: 30px;
    border: 2px solid var(--border-color);
}

.data-summary h3 {
    color: var(--text-lighter);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.summary-content {
    background: rgba(15, 20, 25, 0.45);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    position: relative;
}

#data-summary-content {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.btn-copy {
    background: var(--primary-light);
    color: white;
    padding: 12px 25px;
    width: auto;
}

.btn-copy:hover {
    background: var(--primary-medium);
    transform: translateY(-2px);
}

/* Footer */
.footer {
    text-align: center;
    padding: 25px;
    color: var(--text-light);
    border-top: 1px solid var(--border-color);
    margin-top: 30px;
    background: var(--bg-card);;
    border-radius: 12px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.footer-info {
    margin-top: 8px;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Responsividade */
@media (max-width: 1200px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .documents-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        position: static;
        width: 100%;
    }
    
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-generate,
    .btn-reset {
        width: 100%;
    }
    
    .download-options {
        padding: 20px;
    }
    
    .btn-download-all,
    .btn-download-individual {
        margin: 10px 0;
        width: 100%;
    }
    
    .logo {
        flex-direction: column;
        text-align: center;
    }
    
    .logo i {
        margin-bottom: 15px;
    }
}
