/* ==============================================
   LETICIA RAMOS - STYLES.CSS
   Diseño minimalista, cálido y profesional
   ============================================== */

/* --- RESET & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.7;
    color: #333;
    background-color: #fdfbf8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- CONTAINER --- */
.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 80px 28px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- LOGO SECTION --- */
.logo-section {
    text-align: center;
    margin-bottom: 56px;
}

.logo-image {
    width: 320px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* --- HERO TEXT --- */
.hero-text {
    text-align: center;
    margin-bottom: 56px;
}

.hero-text h1 {
    font-size: 32px;
    font-weight: 400;
    color: #1a1a1a;
    margin-bottom: 20px;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 16px;
    color: #666;
    line-height: 1.8;
    font-weight: 300;
    margin-bottom: 16px;
}

.subtitle-highlight {
    font-size: 15px;
    color: #c9a56d;
    line-height: 1.8;
    font-weight: 400;
}

/* --- FORM --- */
.access-form {
    width: 100%;
    margin-bottom: 48px;
}

.form-field {
    margin-bottom: 28px;
}

.form-field label {
    display: block;
    font-size: 14px;
    font-weight: 400;
    color: #555;
    margin-bottom: 10px;
    letter-spacing: 0.2px;
}

.form-field input {
    width: 100%;
    padding: 16px 18px;
    font-size: 16px;
    color: #1a1a1a;
    background-color: #fff;
    border: 1.5px solid #e8e5e0;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-field input:focus {
    outline: none;
    border-color: #c9a56d;
    background-color: #fffef8;
    box-shadow: 0 0 0 3px rgba(201, 165, 109, 0.08);
}

/* Estilo para inputs deshabilitados (como el email en update.html) */
.form-field input:disabled {
    background-color: #f9f7f3;
    color: #888;
    cursor: not-allowed;
    border-color: #e8e5e0;
}

.form-field input::placeholder {
    color: #bbb;
    font-weight: 300;
}

/* --- CONSENT FIELD --- */
.consent-field {
    margin: 36px 0;
}

.consent-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    line-height: 1.7;
}

.consent-label input[type="checkbox"] {
    margin-top: 4px;
    margin-right: 14px;
    min-width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #c9a56d;
}

.consent-text a {
    color: #c9a56d;
    text-decoration: none;
    border-bottom: 1px solid rgba(201, 165, 109, 0.4);
    transition: all 0.2s ease;
}

.consent-text a:hover {
    border-bottom-color: #c9a56d;
    color: #b38f54;
}

/* --- SUBMIT BUTTON --- */
.submit-btn {
    width: 100%;
    padding: 18px 28px;
    font-size: 16px;
    font-weight: 400;
    color: #fff;
    background-color: #c9a56d;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.submit-btn:disabled {
    background-color: #e8e5e0;
    color: #aaa;
    cursor: not-allowed;
}

.submit-btn:not(:disabled):hover {
    background-color: #b38f54;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 165, 109, 0.3);
}

.submit-btn:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(201, 165, 109, 0.2);
}

.submit-btn.loading .btn-text {
    opacity: 0;
}

.submit-btn.loading .btn-loader {
    opacity: 1;
}

.btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- (NUEVO) ESTILOS PARA GRUPO DE BOTONES (Aceptar/Cancelar) --- */
.form-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
}

/* (NUEVO) Botón secundario/cancelar */
.cancel-btn {
    background-color: #fff;
    color: #555;
    border: 1.5px solid #e8e5e0;
}
.cancel-btn:not(:disabled):hover {
    background-color: #f9f7f3;
    color: #333;
    border-color: #ccc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.cancel-btn:not(:disabled):active {
    transform: translateY(0);
    box-shadow: none;
    background-color: #f0eeeb;
}


/* --- MESSAGE BOX --- */
.message-box {
    width: 100%;
    padding: 18px 22px;
    border-radius: 6px;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 36px;
    display: none;
}

.message-box.visible {
    display: block;
}

.message-box.success {
    background-color: #f0f8f0;
    color: #2d5f2d;
    border-left: 4px solid #5ba05b;
}

.message-box.error {
    background-color: #fdf3f3;
    color: #b84343;
    border-left: 4px solid #e57373;
}

.message-box.info {
    background-color: #f3f7fc;
    color: #3d6a99;
    border-left: 4px solid #6ba3d4;
}

/* --- INFO NOTE --- */
.info-note {
    width: 100%;
    padding: 24px;
    background-color: #f9f7f3;
    border-left: 3px solid #c9a56d;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.8;
    color: #666;
    margin-bottom: 48px;
}

.info-note a {
    color: #c9a56d;
    text-decoration: none;
    border-bottom: 1px solid rgba(201, 165, 109, 0.4);
    transition: all 0.2s ease;
}

.info-note a:hover {
    border-bottom-color: #c9a56d;
    color: #b38f54;
}

/* --- FOOTER --- */
.footer {
    text-align: center;
    font-size: 14px;
    color: #999;
    padding-top: 32px;
    border-top: 1px solid #e8e5e0;
    width: 100%;
    font-weight: 300;
}

/* --- NUEVOS ESTILOS PARA GESTIÓN --- */

/* Estilos para la navegación del CRUD */
.crud-nav {
    display: none;
    width: 100%;
    text-align: center;
    margin-bottom: 48px;
}

.crud-nav.visible {
    display: block;
}

.crud-nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.crud-nav li {
    flex-basis: calc(50% - 6px);
}

.crud-nav a {
    display: block;
    padding: 16px;
    text-decoration: none;
    color: #c9a56d;
    background-color: #fff;
    border: 1.5px solid #e8e5e0;
    border-radius: 6px;
    font-weight: 400;
    transition: all 0.3s ease;
}

.crud-nav a:hover {
    border-color: #c9a56d;
    background-color: #fdfbf8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(201, 165, 109, 0.1);
}

/* Botón de logout */
.logout-btn {
    font-size: 14px;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    margin-top: 24px;
    text-decoration: underline;
}
.logout-btn:hover {
    color: #b84343;
}

/* Contenedor de la tabla */
.results-container {
    width: 100%;
    overflow-x: auto;
}

/* Estilos para la tabla de resultados (VISTA DESKTOP) */
.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 24px;
    font-size: 14px;
}
.results-table th,
.results-table td {
    border: 1px solid #e8e5e0;
    padding: 10px 12px;
    text-align: left;
}
.results-table th {
    background-color: #f9f7f3;
    font-weight: 500;
    color: #333;
}
.results-table td {
    color: #555;
    word-break: break-all;
    vertical-align: middle;
}

/* Vínculo para volver */
.back-link {
    display: inline-block;
    margin-bottom: 40px;
    font-size: 15px;
    color: #c9a56d;
    text-decoration: none;
}
.back-link:hover {
    text-decoration: underline;
}

/* --- ESTILOS PARA BOTONES DE ACCIÓN EN TABLA --- */
.table-btn {
    font-size: 13px;
    font-weight: 400;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    background: none;
    border: 1.5px solid transparent;
    transition: all 0.2s ease;
    margin-right: 5px;
    margin-bottom: 5px; /* Para apilamiento móvil */
}

.table-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Botón Editar */
.btn-edit {
    color: #3d6a99;
    border-color: #6ba3d4;
}
.btn-edit:not(:disabled):hover {
    background-color: #f3f7fc;
    color: #333;
}

/* Botón Eliminar */
.btn-delete {
    color: #b84343;
    border-color: #e57373;
}
.btn-delete:not(:disabled):hover {
    background-color: #fdf3f3;
    color: #333;
}

/* --- RESPONSIVE BASE --- */
@media (max-width: 600px) {
    .container {
        padding: 60px 24px;
    }

    .logo-image {
        width: 140px;
    }

    .hero-text h1 {
        font-size: 28px;
    }

    .subtitle {
        font-size: 15px;
    }

    .form-field input {
        padding: 14px 16px;
        font-size: 16px;
    }

    .submit-btn {
        padding: 16px 24px;
        font-size: 15px;
    }

    .info-note {
        padding: 20px;
        font-size: 13px;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 50px 20px;
    }

    .logo-image {
        width: 120px;
    }

    .hero-text h1 {
        font-size: 26px;
    }

    .subtitle {
        font-size: 14px;
    }
    
    .crud-nav li {
        flex-basis: 100%;
    }

    /* (NUEVO) Apilar botones Aceptar/Cancelar en móvil */
    .form-actions {
        flex-direction: column;
    }
}

/* ==============================================
   CSS RESPONSIVE PARA TABLAS
   ============================================== */

@media (max-width: 768px) {

    .results-table {
        border: none;
        box-shadow: none;
    }
    
    /* 1. Ocultar el encabezado de la tabla */
    .results-table thead {
        display: none;
    }
    
    /* 2. Convertir filas en bloques (tarjetas) */
    .results-table tr {
        display: block;
        margin-bottom: 24px;
        border: 1.5px solid #e8e5e0;
        border-radius: 6px;
        overflow: hidden;
        box-shadow: 0 4px 12px rgba(0,0,0,0.03);
    }
    
    /* 3. Convertir celdas en bloques */
    .results-table td {
        display: block;
        padding: 12px 16px;
        text-align: right; /* Alinear valor a la derecha */
        position: relative;
        border: none;
        border-bottom: 1px solid #f0eeeb;
        word-break: break-all;
    }
    
    .results-table tr td:last-child {
        border-bottom: none;
    }

    /* 4. Usar el 'data-label' para mostrar el encabezado */
    .results-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 16px;
        font-weight: 500;
        color: #333;
        text-align: left;
    }

    /* 5. Ajustes para la celda de acciones */
    .results-table td[data-label="Acciones"] {
        text-align: right;
        background-color: #fdfbf8;
    }
    
    .results-table td[data-label="Acciones"]::before {
        display: none;
    }
}

/* Ajustes finos para pantallas muy pequeñas */
@media (max-width: 400px) {
    .results-table td {
        padding: 10px 14px;
    }
    .results-table td::before {
        left: 14px;
    }
    
    /* Apilar botones de acción en tabla */
    .table-btn {
        display: block;
        width: 100%;
        text-align: center;
        margin-right: 0;
    }

    .results-table td[data-label="Acciones"] {
        text-align: center;
        padding: 16px;
    }
}
