@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;500;600;700&family=Montserrat:wght@300;400;500;600;700&display=swap');

/* ================================================
   CASA LUMBRE - VARIABLES
   ================================================ */
:root {
    --charcoal: #3D5A73;   /* azul pizarra opaco - navbars, títulos, énfasis */
    --taupe: #C8A962;      /* dorado - botones CTA y acentos premium */
    --terracota: #B84A41;  /* rojo ladrillo - hover, alertas, badges */
    --cream: #F5F0E8;      /* crema cálido - fondo principal */
    --linen: #E2DAD0;      /* lino cálido - bordes, cards, fondos secundarios */
    --grey: #5C5650;       /* gris cálido - texto general y labels */
}

/* ================================================
   RESET & BASE
   ================================================ */
* { 
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

h1, h2, h3 { 
    font-family: 'Cormorant Garamond', serif; 
}

/* ✅ CAMBIO 1: Agregado scroll para móvil */
body { 
    background: var(--cream);
    min-height: 100vh;
    overflow-x: hidden;                     /* ← NUEVO: Evita scroll horizontal */
    overflow-y: auto;                       /* ← NUEVO: Permite scroll vertical */
    -webkit-overflow-scrolling: touch;      /* ← NUEVO: Smooth scroll en iOS */
}

/* ================================================
   LANDING PAGE (index / ethics-reporting)
   ================================================ */
/* ✅ CAMBIO 2: Removido display: flex que bloqueaba scroll */
body.landing { 
    /* display: flex; ← REMOVIDO */
    /* align-items: center; ← REMOVIDO */
    /* justify-content: center; ← REMOVIDO */
    padding: 20px;
}

/* Disclaimer Modal */
/* ✅ CAMBIO 3: Agregado scroll en modal */
.disclaimer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 41, 38, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;                       /* ← NUEVO: Scroll en modal */
    -webkit-overflow-scrolling: touch;      /* ← NUEVO: Smooth scroll */
}

.disclaimer-overlay.hidden {
    display: none;
}

.disclaimer-modal {
    background: #ffffff;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    -webkit-overflow-scrolling: touch;
}

.disclaimer-modal h2 {
    color: var(--charcoal);
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-align: center;
    letter-spacing: 0.05em;
}

.disclaimer-content {
    color: var(--grey);
    line-height: 1.8;
    font-size: 0.95rem;
    margin-bottom: 30px;
    text-align: justify;
}

.disclaimer-content p {
    margin-bottom: 15px;
}

.accept-button {
    width: 100%;
    padding: 16px;
    background: var(--taupe);
    color: var(--charcoal);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
}

.accept-button:hover {
    background: var(--terracota);
    color: var(--cream);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(184, 74, 65, 0.35);
}

.accept-button:active {
    transform: translateY(0);
}

/* Main Content */
/* ✅ CAMBIO 4: Agregado margin auto para centrar */
.menu-container {
    background: white;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;                         /* ← NUEVO: Centra horizontalmente */
    padding: 60px 40px;
    box-shadow: 0 15px 40px rgba(45, 41, 38, 0.15);
    border: 1px solid var(--linen);
}

.menu-container header {
    text-align: center;
    margin-bottom: 50px;
    padding-bottom: 30px;
    border-bottom: 2px solid var(--linen);
}

.menu-container header h1 {
    color: var(--charcoal);
    font-size: 3rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.menu-container main h2 {
    color: var(--charcoal);
    font-size: 2rem;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 400;
}

.menu-container main > p {
    text-align: center;
    color: var(--grey);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

.opcion {
    background: var(--cream);
    border: 2px solid var(--linen);
    padding: 30px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
}

.opcion:hover {
    border-color: var(--taupe);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(45, 41, 38, 0.15);
}

.opcion .texto {
    color: var(--grey);
    margin-bottom: 20px;
    font-size: 1.05rem;
    line-height: 1.6;
}

.opcion button {
    width: 100%;
    padding: 14px;
    background: var(--taupe);
    color: var(--charcoal);
    border: none;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
}

.opcion button:hover {
    background: var(--terracota);
    color: var(--cream);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(184, 74, 65, 0.3);
}

.opcion button:active {
    transform: translateY(0);
}

/* ================================================
   FORM PAGES (create-report / track-report)
   ================================================ */
body.form-page { 
    background: linear-gradient(135deg, var(--cream) 0%, var(--linen) 100%);
    padding: 20px;
}

/* Header */
header.page-header {
    background: var(--charcoal);
    color: var(--cream);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(45, 41, 38, 0.15);
}

header.page-header h1 {
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-align: center;
    color: var(--cream);
}

/* Main Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 3rem;
    box-shadow: 0 15px 40px rgba(45, 41, 38, 0.2);
    border: 1px solid var(--linen);
}

/* Reference Number Badge */
.reference-badge {
    background: var(--terracota);
    color: var(--cream);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
    border-left: 4px solid var(--taupe);
}

.reference-badge h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
    letter-spacing: 0.05em;
}

.reference-number {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    font-family: 'Courier New', monospace;
}

.anon-note {
    margin-top: 0.8rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.8rem;
}

label {
    display: block;
    color: var(--grey);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

select, textarea, input[type="text"], input[type="email"], input[type="password"] {
    width: 100%;
    padding: 0.9rem;
    border: 2px solid var(--linen);
    background: var(--cream);
    color: var(--charcoal);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;     /* ← NUEVO: Asegura fuente */
}

select:focus, textarea:focus, input:focus {
    outline: none;
    border-color: var(--taupe);
    background: white;
}

textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.6;
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 2rem;
    margin-top: 0.8rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--terracota);
}

.radio-option label {
    margin: 0;
    cursor: pointer;
    text-transform: none;
    font-weight: 500;
}

/* Personal Data Section */
#personalData {
    background: var(--cream);
    padding: 1.5rem;
    border-left: 4px solid var(--taupe);
    margin-top: 1rem;
}

#personalData .form-group:last-child {
    margin-bottom: 0;
}

/* CAPTCHA Section */
.captcha-section {
    background: var(--cream);
    padding: 1.5rem;
    border: 2px solid var(--linen);
    margin-bottom: 2rem;
}

.captcha-section label {
    margin-bottom: 1rem;
}

.captcha-image {
    background: white;
    padding: 0.5rem;
    display: inline-block;
    border: 2px solid var(--linen);
    margin-bottom: 1rem;
}

/* ✅ CAMBIO 5: CAPTCHA responsive */
.captcha-image img {
    display: block;
    max-width: 100%;                        /* ← NUEVO: Responsive */
    height: auto;                           /* ← NUEVO: Mantiene proporción */
}

.refresh-captcha {
    color: var(--taupe);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-block;
    margin-top: 0.5rem;
    transition: color 0.3s ease;
}

.refresh-captcha:hover {
    color: var(--terracota);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 1.2rem;
    background: var(--taupe);
    color: var(--charcoal);
    border: none;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-family: 'Montserrat', sans-serif;
}

.btn-primary:hover {
    background: var(--terracota);
    color: var(--cream);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(184, 74, 65, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {                     /* ← NUEVO: Estado deshabilitado */
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    display: block;
    text-align: center;
    color: var(--grey);
    text-decoration: none;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    transition: color 0.3s ease;
}

.btn-secondary:hover {
    color: var(--terracota);
}

.btn-small {                                /* ← NUEVO: Para admin */
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    width: auto;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 41, 38, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--linen);
    border-top-color: var(--terracota);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error/Success Messages */
.message {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid;
    font-size: 0.95rem;
    display: none;                          /* ← NUEVO: Oculto por defecto */
}

.message.show {                             /* ← NUEVO: Clase para mostrar */
    display: block;
}

.message.error {
    background: #fdeaea;
    border-color: #d32f2f;
    color: #d32f2f;
}

.message.success {
    background: #e8f5e9;
    border-color: #388e3c;
    color: #388e3c;
}

.message.warning {                          /* ← NUEVO */
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.message.info {                             /* ← NUEVO */
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* Search Results */
.results-section {
    display: none;
    margin-top: 2rem;
}

.results-section.active {
    display: block;
}

.result-card {
    background: var(--cream);
    padding: 2rem;
    border-left: 4px solid var(--terracota);
}

.result-item {
    margin-bottom: 1.5rem;
}

.result-item strong {
    display: block;
    color: var(--charcoal);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.result-item .value {
    color: var(--grey);
    font-size: 1rem;
    line-height: 1.6;
}

.status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 3px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ✅ CAMBIO 6: Estados en español */
.status-badge.new, .status-badge.nuevo {
    background: #e3f2fd;
    color: #1976d2;
}

.status-badge.received, .status-badge.recibido {
    background: #fff3e0;
    color: #f57c00;
}

.status-badge.in-progress, .status-badge.en-proceso {
    background: #fff8e1;
    color: #fbc02d;
}

.status-badge.completed, .status-badge.completado {
    background: #e8f5e9;
    color: #388e3c;
}

/* ================================================
   ADMIN PAGE
   ================================================ */
body.admin-page {                           /* ← NUEVO: Body class para admin */
    background: var(--cream);
}

.admin-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.admin-header {
    background: var(--charcoal);
    color: var(--cream);
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(45, 41, 38, 0.15);
}

.admin-header h1 {
    font-size: 2rem;
    color: var(--cream);
}

.login-container {                          /* ← NUEVO: Para login de admin */
    max-width: 500px;
    margin: 4rem auto;
    background: white;
    padding: 3rem;
    box-shadow: 0 15px 40px rgba(45, 41, 38, 0.2);
    border: 1px solid var(--linen);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--charcoal);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-left: 4px solid var(--terracota);
    box-shadow: 0 4px 12px rgba(45, 41, 38, 0.1);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--grey);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
    font-family: 'Montserrat', sans-serif;
}

.stat-card .number {
    font-size: 3rem;
    color: var(--terracota);
    font-weight: 700;
}

/* ✅ CAMBIO 7: Tabla con scroll horizontal */
.table-container {
    background: white;
    padding: 2rem;
    overflow-x: auto;
    box-shadow: 0 4px 12px rgba(45, 41, 38, 0.1);
    -webkit-overflow-scrolling: touch;      /* ← NUEVO: Smooth scroll */
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th {
    background: var(--charcoal);
    color: var(--cream);
    padding: 1rem;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

table td {
    padding: 1rem;
    border-bottom: 1px solid var(--linen);
    color: var(--grey);
}

table tr:hover {
    background: var(--cream);
}

.reference-cell {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--terracota);
}

.message-cell textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.5rem;
    border: 2px solid var(--linen);
    font-size: 0.9rem;
    font-family: 'Montserrat', sans-serif;
}

/* ================================================
   SUCCESS/TICKET PAGE
   ================================================ */
/* ✅ CAMBIO 8: Removido flex del ticket page */
body.ticket-page {                          /* ← NUEVO: Body class para ticket */
    background: var(--cream);
    padding: 20px;
    /* display: flex; ← REMOVIDO */
    /* align-items: center; ← REMOVIDO */
    /* justify-content: center; ← REMOVIDO */
    /* min-height: 100vh; ← REMOVIDO */
}

.success-container {
    max-width: 800px;
    width: 100%;
    margin: 2rem auto;                      /* ← NUEVO: Centra y da espacio */
    padding: 3rem;
    background: white;
    box-shadow: 0 15px 40px rgba(45, 41, 38, 0.2);
    border: 1px solid var(--linen);
    text-align: center;
}

.ticket-container {                         /* ← NUEVO: Alias de success-container */
    max-width: 800px;
    width: 100%;
    margin: 2rem auto;
    padding: 3rem;
    background: white;
    box-shadow: 0 15px 40px rgba(45, 41, 38, 0.2);
    border: 1px solid var(--linen);
    text-align: center;
}

.success-icon {
    font-size: 5rem;
    margin-bottom: 2rem;
    animation: scaleIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-container h2, .ticket-container h2 {
    color: var(--charcoal);
    margin-bottom: 1.5rem;
}

.success-container .reference-highlight,
.ticket-container .reference-highlight,    /* ← NUEVO */
.reference-highlight {
    background: var(--cream);
    padding: 2rem;
    margin: 2rem 0;
    border-left: 4px solid var(--terracota);
}

.success-container .reference-highlight .reference-number,
.ticket-container .reference-highlight .reference-number,
.reference-highlight .reference-number {
    font-size: 2.5rem;
    color: var(--terracota);
}

.info-box {                                 /* ← NUEVO: Para mensajes info */
    background: #fff3e0;
    border-left: 4px solid #f57c00;
    padding: 1.5rem;
    margin: 2rem 0;
    text-align: left;
}

.info-box strong {
    color: #f57c00;
    display: block;
    margin-bottom: 10px;
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;                        /* ← NUEVO: Wrap en móvil */
}

.actions .btn {
    flex: 1;
    max-width: 250px;
    min-width: 150px;                       /* ← NUEVO: Ancho mínimo */
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 768px) {
    body {
        font-size: 14px;                    /* ← NUEVO: Texto más pequeño */
    }

    .container {
        padding: 2rem 1.5rem;
    }

    header.page-header h1 {
        font-size: 1.5rem;
    }

    .reference-number {
        font-size: 1.5rem;
    }

    .radio-group {
        flex-direction: column;
        gap: 1rem;
    }

    .menu-container {
        padding: 40px 25px;
    }

    .menu-container header h1 {
        font-size: 2rem;
    }

    .menu-container main h2 {
        font-size: 1.5rem;
    }

    .disclaimer-modal {
        padding: 30px 20px;
    }

    .disclaimer-modal h2 {
        font-size: 1.8rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .actions .btn {
        max-width: 100%;
        width: 100%;                        /* ← NUEVO: Full width en móvil */
    }

    .admin-header {                         /* ← NUEVO */
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    table {                                 /* ← NUEVO */
        font-size: 0.85rem;
    }

    table th, table td {
        padding: 0.5rem;
    }

    .ticket-container, .success-container { /* ← NUEVO */
        padding: 2rem 1.5rem;
    }

    .success-icon {
        font-size: 3rem;
    }

    .reference-highlight .reference-number {
        font-size: 1.8rem;
    }
}

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

.menu-container {
    animation: fadeIn 0.6s ease-out;
}

.container {
    animation: fadeIn 0.6s ease-out;
}

/* ================================================
   UTILITY CLASSES
   ================================================ */
.text-center {                              /* ← NUEVO */
    text-align: center;
}

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

/* ================================================
   MOBILE TOUCH IMPROVEMENTS
   ================================================ */
/* ✅ CAMBIO 9: Mejoras específicas para touch devices */
@media (hover: none) and (pointer: coarse) {
    /* Mejores touch targets para móvil */
    button, .btn-primary, .btn-secondary, .opcion button {
        min-height: 44px;                   /* ← Apple recomienda mínimo 44px */
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Deshabilitar hover effects en touch devices */
    .opcion:hover,
    button:hover,
    .btn-primary:hover {
        transform: none;                    /* ← Sin animaciones confusas */
    }
    
    /* Mantener estados active para feedback táctil */
    button:active,
    .btn-primary:active {
        opacity: 0.8;                       /* ← Feedback visual al tocar */
    }
}