/* ============================
   RESET BÁSICO
============================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background-color: #f5f7fb;
    color: #222;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.4;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============================
   ENCABEZADO PRINCIPAL
============================ */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(90deg, #003366, #0059b3);
    color: #fff;
    gap: 12px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
}

/* Compatibilidad Logo vs logo */
.Logo,
.logo {
    height: 56px;
    width: 56px;
    object-fit: contain;
}

.header-text h1 {
    font-size: 18px;
    font-weight: 700;
}

.header-text h2 {
    font-size: 13px;
    font-weight: 400;
}

.header-text h3 {
    font-size: 14px;
    margin-top: 4px;
    font-weight: 600;
}

/* Bloque central */
.header-center {
    flex: 1 1 auto;
    text-align: center;
    font-size: 13px;
    line-height: 1.3;
}

.header-center-title {
    font-weight: 700;
    text-decoration: underline;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.header-center p {
    margin: 2px 0;
}

/* Lado derecho */
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    justify-content: flex-end;
}

/* Fecha y hora */
.current-datetime {
    font-size: 12px;
    color: #fff;
    white-space: nowrap;
}

/* ============================
   BOTONES GENÉRICOS
============================ */
.btn {
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    min-width: 44px;
    line-height: 1.2;
}

.btn-outline {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
}

.btn-admin {
    background: #ffcc00;
    color: #003366;
    font-weight: 600;
    white-space: nowrap;
    min-height: 40px;
}

.btn-admin:hover {
    filter: brightness(0.95);
}

.btn-contact {
    background: #003366;
    color: #fff;
    font-weight: 500;
}

/* ============================
   CAMBIO DE IDIOMA
============================ */
.lang-switch {
    position: relative;
}

.lang-switch .btn-outline {
    padding-right: 26px;
    position: relative;
}

.lang-switch .btn-outline::after {
    content: '▼';
    font-size: 10px;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

.lang-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 44px;
    background: #ffffff;
    color: #003366;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    overflow: hidden;
    min-width: 140px;
    z-index: 10;
}

.lang-menu a {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: inherit;
    font-size: 14px;
}

.lang-menu a:hover {
    background: #f0f4ff;
}

.lang-switch.open .lang-menu {
    display: block;
}

/* ============================
   CONTENIDO PRINCIPAL
============================ */
.main-content {
    max-width: 1100px;
    margin: 32px auto;
    padding: 0 16px;
    text-align: left;
}

/* ============================
   HOME
============================ */
.home-hero-card {
    background: #e7f3ff;
    border-radius: 18px;
    padding: 18px 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    margin-bottom: 24px;
    max-width: 100%;
}

.home-hero-centered {
    text-align: center;
    max-width: 100%;
}

.home-hero-status-label {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #e6f6ea;
    color: #146534;
    max-width: 100%;
}

.home-hero-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    background: #22c55e;
    flex-shrink: 0;
}

.home-hero-status-text {
    white-space: nowrap;
}

.home-hero-detail {
    font-size: 20px;
    margin-bottom: 6px;
    max-width: 100%;
}

.home-hero-detail-label {
    font-weight: 700;
}

.home-hero-detail-value {
    margin-left: 4px;
}

/* colores */
.home-hero-status-label.status-green { background: #e6f6ea; color: #166534; }
.home-hero-status-label.status-green .home-hero-status-dot { background: #22c55e; }

.home-hero-status-label.status-orange { background: #fff4e5; color: #92400e; }
.home-hero-status-label.status-orange .home-hero-status-dot { background: #f97316; }

.home-hero-status-label.status-red { background: #fee2e2; color: #b91c1c; }
.home-hero-status-label.status-red .home-hero-status-dot { background: #ef4444; }

.home-hero-status-label.status-neutral { background: #e0ecff; color: #1d4ed8; }
.home-hero-status-label.status-neutral .home-hero-status-dot { background: #3b82f6; }

.home-section-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.home-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 24px 24px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.home-card-half {
    flex: 1 1 360px;
    min-height: 200px;
}

.home-section-grid .home-card {
    padding: 24px 24px 12px;
}

.home-card-full {
    margin-bottom: 24px;
}

.home-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.home-card-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    background: #f0f4ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.home-card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.home-card-description {
    font-size: 14px;
    color: #444;
}

.home-card-actions {
    margin-top: 10px;
}

.home-bullet-list {
    margin-top: 10px;
    padding-left: 18px;
    font-size: 14px;
    color: #444;
}

.home-bullet-list li {
    margin-bottom: 4px;
}

/* ============================
   BOTONES GRANDES
============================ */
.big-button {
    width: 100%;
    padding: 18px 16px;
    border-radius: 16px;
    font-size: 17px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background-color 0.1s ease;
    border: none;

    /* ✅ FIX: que funcione igual en <a> y <button> (Chrome/Edge) */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.big-button.primary { background: #0059b3; color: #fff; }
.big-button.secondary { background: #ffffff; color: #003366; border: 1px solid #0059b3; }

.big-button:hover { filter: brightness(1.03); }
.big-button:active { transform: scale(0.98); box-shadow: 0 2px 6px rgba(0,0,0,0.18); }

.home-card-half .home-card-actions { margin-top: 26px; }
.home-card-half .home-card-actions .big-button { width: auto; padding: 10px 20px; font-size: 14px; }

.home-section-grid .home-card-half:nth-child(2) .home-card-actions .big-button {
    background: #0059b3;
    color: #fff;
    border: none;
}

.home-card-full .home-card-actions { margin-top: 12px; text-align: left; }
.home-card-full .home-card-actions .big-button { width: auto; padding: 10px 18px; font-size: 14px; box-shadow: 0 3px 8px rgba(0,0,0,0.12); }

/* ✅ FIX SOLO PARA MENÚ ADMIN (dashboard) */
.admin-menu .big-button {
    margin-bottom: 12px;
}

/* ============================
   FORMULARIOS (Register / Login / etc.)
============================ */
.form-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.form-subtitle {
    margin-top: 6px;
    font-size: 13px;
    color: #4b5563;
}

.form-container {
    max-width: 420px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 18px;
    padding: 18px 18px 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* ✅ SOLO para contenedores que necesitan más ancho (tablas admin) */
.form-container-wide {
    max-width: 920px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cfd7e3;
    border-radius: 10px;
    font-size: 14px;
    background: #ffffff;
    outline: none;
}

.form-input:focus {
    border-color: #0059b3;
    box-shadow: 0 0 0 3px rgba(0, 89, 179, 0.18);
}

.form-input[readonly] {
    background: #f3f5f8;
}

.form-radio-group {
    display: grid;
    gap: 8px;
    font-size: 13px;
}

.form-radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.form-help {
    font-size: 12px;
    color: #6b7280;
    margin-top: 6px;
    line-height: 1.35;
}

.form-messages {
    max-width: 420px;
    margin: 0 auto 14px;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 13px;
}

.form-errors {
    background: #fff5f5;
    border: 1px solid rgba(176, 0, 32, 0.25);
    color: #7a0016;
}

.form-success {
    background: #f0fff4;
    border: 1px solid rgba(0, 128, 0, 0.25);
    color: #064e3b;
}

.form-errors ul {
    margin: 0;
    padding-left: 18px;
}

/* ============================
   TABLAS (Staff / Admin lists)
============================ */
.table-container {
    width: 100%;
    max-width: 100%;
    display: block;

    overflow: auto;              /* scroll horizontal + vertical */
    -webkit-overflow-scrolling: touch; /* ✅ iOS smooth scroll */
    touch-action: pan-x pan-y;   /* ✅ ayuda a gestos en móvil */

    max-height: 360px;           /* scroll vertical */
    border: 1px solid #d7deea;
    border-radius: 12px;
    background: #ffffff;

    /* Evita “bugs” de iOS con sticky/overflow en algunos casos */
    position: relative;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 760px;            /* fuerza scroll horizontal en móvil/ventanas angostas */
}

.data-table th,
.data-table td {
    border: 1px solid #d7deea;
    padding: 10px 10px;
    vertical-align: top;
    background: #ffffff;
}

.data-table th {
    background: #f3f5f8;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.table-action-btn {
    background: #0059b3;
    border: 1px solid #004a96;
    color: #fff;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    line-height: 1.1;
    text-decoration: none;       /* importante para <a> */
}

.table-action-btn:hover {
    filter: brightness(1.02);
}

/* ============================
   FOOTER
============================ */
.main-footer {
    text-align: center;
    padding: 24px 16px 32px;
    background: #0059b3;
    color: #ffffff;
    margin-top: 24px;
}

.footer-text-line {
    font-size: 13px;
    margin-bottom: 4px;
}

/* ============================
   MODAL
============================ */
.modal {
    display: none;
    position: fixed;
    z-index: 50;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.modal-content {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 12px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    position: relative;
    text-align: left;
}

.modal-content h2 { margin-bottom: 12px; font-size: 18px; }
.modal-content p { font-size: 14px; margin-bottom: 6px; }

.modal-close {
    position: absolute;
    right: 10px;
    top: 8px;
    font-size: 24px;
    cursor: pointer;
    border: none;
    background: transparent;
}

/* ============================
   RESPONSIVE
============================ */
@media (max-width: 700px) {

    .main-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
        flex-wrap: wrap;
    }

    .main-content {
        margin-top: 20px;
    }

    .home-hero-card {
        flex-direction: column;
        padding: 16px 14px;
    }

    .home-section-grid .home-card-half {
        flex: 1 1 100%;
        min-height: 0;
    }

    .big-button {
        font-size: 16px;
    }

    .form-container {
        border-radius: 16px;
        padding: 16px 14px;
    }
}

/* FIX específico para móviles angostos (Android/iOS):
   - Permite wrap real en el estado
   - Parte label/valor en líneas separadas
   - Evita recortes
   ✅ IMPORTANTE: NO bloquear overflow-x del body (rompe scroll horizontal de tablas) */
@media (max-width: 420px) {

    html, body {
        max-width: 100%;
        /* NO poner overflow-x:hidden aquí, rompe el scroll horizontal en tablas */
    }

    .home-hero-status-label {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
    }

    /* aquí quitamos el nowrap SOLO en móvil angosto */
    .home-hero-status-text {
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .home-hero-detail {
        text-align: center;
    }

    /* label arriba / valor abajo */
    .home-hero-detail-label,
    .home-hero-detail-value {
        display: block;
    }

    .home-hero-detail-value {
        margin-left: 0;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}
