body, html {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', sans-serif;
}

.page-background {
    min-height: 100vh;
    background: linear-gradient(135deg, #b6e2f2, #f5faff);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 120px 2rem 2rem 2rem;
}

.folder-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 1200px;
    position: relative;
    overflow: hidden;
    border: 2px solid #c1e3ef;
}

.folder-tab {
    position: absolute;
    top: -35px;
    background-color: white;
    padding: 10px 150px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    font-weight: bold;
    color: #003344;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
}

.container {
    display: flex;
    padding: 2rem;
}

.sidebar {
    width: 220px;
    background-color: #c7edf9;
    padding: 1rem;
    color: #003344;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 10px;
    margin-right: 1rem;
}

.sidebar ul {
    list-style: none;
    padding: 0;
}

.sidebar li {
    padding: 10px;
    border-radius: 8px;
    margin: 6px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

.sidebar li:hover {
    background-color: #b6e2f2;
}

.sidebar li.active {
    background-color: white;
    color: #007baf;
    font-weight: bold;
}

.sidebar .back {
    margin-top: auto;
}

.content {
    background: #f9fdff;
    flex: 1;
    padding: 2rem;
    border-radius: 10px;
    border: 1px solid #dbeef6;
}

.section-content {
    display: none;
}

.section-content.active {
    display: block;
}

.info-paciente {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.datos-izq,
.datos-der {
    width: 48%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: #004466;
}

label {
    font-weight: bold;
    color: #004466;
    font-size: 0.95rem;
}

input, select, textarea {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-top: 4px;
    box-sizing: border-box;
}

.next-step-button, .back-step-button {
    background-color: #007baf;
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
    transition: background-color 0.2s;
}

.next-step-button:hover, .back-step-button:hover {
    background-color: #005f8c;
}

.usuario img {
    position: absolute;
    top: 100px;
    right: 50px;
    height: 120px;
}

.section-title {
    text-align: center;
    color: #003344;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    text-align: center;
    font-style: italic;
    color: #666;
    margin-bottom: 1.5rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

th, td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    white-space: nowrap;
}

th {
    background-color: #f2f2f2;
    font-weight: bold;
}

input[type="checkbox"] {
    width: auto;
    margin: 0 auto;
    display: block;
}

.observations {
    margin-top: 2rem;
}

.observations textarea {
    height: 100px;
    resize: vertical;
}

.button-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* ========================================= */
/* ESTILOS PARA LAS SUBSECCIONES DE ANTECEDENTES */
/* ========================================= */

/* Mostramos todas las subsecciones para que se vea el formulario completo */
.antecedentes-subsection {
    display: block;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #ccc;
}
.antecedentes-subsection:last-child {
    border-bottom: none;
}

/* Descripción de la subsección */
.subsection-description {
    color: #666;
    font-style: italic;
    margin-bottom: 20px;
    font-size: 0.9em;
    padding: 8px 12px;
    background-color: #f0f8ff;
    border-radius: 5px;
    border-left: 4px solid #007baf;
}

/* ========================================= */
/* SUB-SECCIÓN 1: ANTECEDENTES FAMILIARES */
/* ========================================= */
.familiares-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.familiares-table th {
    background: #2c3e50;
    color: white;
    padding: 8px;
    text-align: center;
    font-weight: 500;
    font-size: 0.85em;
}

.familiares-table td {
    border: 1px solid #ddd;
    padding: 6px;
    vertical-align: middle;
}

.familiares-table tr:nth-child(even) {
    background: #f9f9f9;
}

.familiares-table tr:hover {
    background: #e8f4f8;
}

.familiar-obs {
    width: 70px;
    padding: 4px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.85em;
    transition: border-color 0.2s;
}

.familiar-obs:focus {
    border-color: #007baf;
    outline: none;
    box-shadow: 0 0 5px rgba(0,123,175,0.3);
}

/* ========================================= */
/* SUB-SECCIÓN 2: ANTECEDENTES PERSONALES PATOLÓGICOS */
/* ========================================= */
.patologicos-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.patologicos-table th {
    background: #3498db;
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: 500;
}

.patologicos-table td {
    border: 1px solid #ddd;
    padding: 8px;
}

.patologicos-table tr:nth-child(even) {
    background: #f9f9f9;
}

.patologicos-table tr:hover {
    background: #e8f4f8;
}

.checkbox-center {
    text-align: center;
}

.observacion-input {
    width: 90%;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 3px;
    transition: border-color 0.2s;
}

.observacion-input:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 5px rgba(52,152,219,0.3);
}

/* ========================================= */
/* SUB-SECCIÓN 3: CUESTIONARIO GENERAL */
/* ========================================= */
.cuestionario-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.pregunta {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.pregunta:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.pregunta label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
}

.opciones {
    margin-bottom: 10px;
}

.opciones label {
    display: inline-block;
    margin-right: 15px;
    font-weight: normal;
    font-size: 0.9em;
    cursor: pointer;
}

.opciones input[type="radio"] {
    width: auto;
    margin-right: 3px;
    display: inline-block;
}

.especifique-input {
    width: 100%;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-top: 5px;
    transition: border-color 0.2s;
}

.especifique-input:focus {
    border-color: #007baf;
    outline: none;
    box-shadow: 0 0 5px rgba(0,123,175,0.3);
}

/* ========================================= */
/* SUB-SECCIÓN 4: ANTECEDENTES NO PATOLÓGICOS */
/* ========================================= */
.no-patologicos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.campo {
    background: white;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.campo label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: #2c3e50;
}

.select-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    transition: border-color 0.2s;
}

.select-input:focus {
    border-color: #007baf;
    outline: none;
    box-shadow: 0 0 5px rgba(0,123,175,0.3);
}

.campo-checkbox {
    background: white;
    padding: 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.campo-checkbox input[type="checkbox"] {
    width: auto;
    margin: 0 10px 0 0;
    display: inline-block;
}

.campo-checkbox label {
    margin-left: 5px;
    cursor: pointer;
    font-weight: normal;
    color: #2c3e50;
}

.campo-textarea {
    grid-column: span 2;
    background: white;
    padding: 12px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.campo-textarea textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    min-height: 80px;
    transition: border-color 0.2s;
}

.campo-textarea textarea:focus {
    border-color: #007baf;
    outline: none;
    box-shadow: 0 0 5px rgba(0,123,175,0.3);
}

/* ========================================= */
/* ESTILOS PARA CONSENTIMIENTO */
/* ========================================= */
.consentimiento-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.consentimiento-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 2rem;
}

.consentimiento-text {
    flex: 1;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #444;
}

.consentimiento-upload {
    width: 300px;
    height: 350px;
    border: 2px dashed #ccc;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f0f8ff;
    gap: 1rem;
    position: relative;
    transition: border-color 0.2s;
}

.consentimiento-upload:hover {
    border-color: #007baf;
}

.upload-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.upload-buttons button {
    background-color: #007baf;
    color: white;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.upload-buttons button:hover {
    background-color: #005f8c;
    transform: scale(1.05);
}

.image-preview {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
}

.doctor-info {
    margin-top: 2rem;
    padding: 1rem;
    background: #f0f8ff;
    border-radius: 8px;
    width: 100%;
}

/* ========================================= */
/* ESTILOS PARA ODONTOGRAMA */
/* ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

#odontograma {
    font-family: 'Poppins', sans-serif;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    margin: 2rem auto;
}

.odontograma-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.radio-group {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.radio-group label {
    padding: 0.5rem 1.5rem;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

input[type="radio"]:checked + label {
    background-color: #197497;
    color: #ffffff;
    border-color: #197497;
}

.odontograma-container {
    text-align: center;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    background-color: #f9fafb;
}

.odontograma-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

.odontograma-image-container {
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#odontogramaCanvas {
    background-color: white;
    border: 1px solid #b0b0b0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.odontograma-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

#odontograma.section-content.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Paleta de Colores */
.color-palette {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 0.5rem;
    background-color: #f0f0f0;
    border-radius: 8px;
    max-width: 350px;
}

.color-box {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.color-box:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.color-box.selected {
    border-color: #005f8c;
    box-shadow: 0 0 0 2px rgba(0,95,140,0.3);
}

.color-box.erase {
    background-color: white;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23dc2626"><path d="M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z" /></svg>');
    background-size: 60%;
    background-position: center;
    background-repeat: no-repeat;
    border: 1px solid #ccc;
}

/* Simbología Display */
#simbologia-display {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #e8f4f8;
    border-radius: 5px;
    font-weight: 500;
    color: #005f8c;
    text-align: center;
}

/* ========================================= */
/* ESTILOS PARA MODALES */
/* ========================================= */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-content h3 {
    margin-top: 0;
    color: #003344;
    border-bottom: 2px solid #c7edf9;
    padding-bottom: 10px;
}

.modal-content p {
    color: #333;
    margin: 10px 0;
}

.modal-content textarea {
    width: 100%;
    min-height: 120px;
    margin-top: 1rem;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    resize: vertical;
    font-family: inherit;
}

.modal-content textarea:focus {
    border-color: #007baf;
    outline: none;
    box-shadow: 0 0 5px rgba(0,123,175,0.3);
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-buttons button {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s, transform 0.1s;
}

.modal-buttons button:active {
    transform: scale(0.98);
}

#modal-save-button, #modal-save-comment, #modal-save-editor {
    background-color: #007baf;
    color: white;
}

#modal-save-button:hover, #modal-save-comment:hover, #modal-save-editor:hover {
    background-color: #005f8c;
}

#modal-close-button, #modal-close-comment, #modal-close-editor {
    background-color: #e5e7eb;
    color: #4b5563;
}

#modal-close-button:hover, #modal-close-comment:hover, #modal-close-editor:hover {
    background-color: #d1d5db;
}

/* ========================================= */
/* CLASES UTILITARIAS */
/* ========================================= */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
        padding: 1rem;
    }
    
    .sidebar {
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
    }
    
    .cuestionario-grid,
    .no-patologicos-grid {
        grid-template-columns: 1fr;
    }
    
    .campo-textarea {
        grid-column: span 1;
    }
    
    .familiares-table {
        font-size: 0.7em;
    }
    
    .familiar-obs {
        width: 50px;
    }
    
    .folder-tab {
        position: relative;
        top: 0;
        padding: 10px;
        text-align: center;
    }
    
    .consentimiento-content {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 600px) {
    .page-background {
        padding: 0.5rem;
    }
    
    .content {
        padding: 1rem;
    }
    
    .button-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .button-row button {
        width: 100%;
    }
}