/* --- APP HEADER --- */
.global-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    /* Respeta el notch/isla dinámica en móviles */
    padding-top: max(env(safe-area-inset-top, 0px), 10px);
    padding-left: max(env(safe-area-inset-left, 0px), 20px);
    padding-right: max(env(safe-area-inset-right, 0px), 20px);
}

.digital-clock {
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
    margin-top: -12px;
    margin-bottom: 5px;
}

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

.header-logo i { font-size: 1.8rem; color: var(--primary); }
.header-titles h2 { font-size: 1.1rem; font-weight: 700; }

/* --- BOTTOM NAV (ESTILO GEOMÉTRICO) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--bg-nav);
    display: flex;
    justify-content: space-around;
    padding: 5px 0 calc(5px + env(safe-area-inset-bottom, 10px));
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    z-index: 9000;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.5);
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 8px;
    position: relative;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}

.nav-item i { font-size: 1.4rem; }
.nav-item span { font-size: 0.7rem; font-weight: 600; }

/* Indicador visual del tab activo — línea superior + fondo pill */
.nav-item.active {
    color: var(--primary);
    background: var(--primary-alpha-10, rgba(16,185,129,0.08));
}
.nav-item.active::before {
    content: '';
    position: absolute;
    top: -5px; /* sale por encima del padding del nav */
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
}
.nav-item:hover:not(.active) {
    color: var(--text-color);
    background: rgba(255,255,255,0.04);
}

/* Admin Hub opciones — ocultas por defecto, visibles según rol (auth.js) */
.admin-hub-option {
    display: none;           /* auth.js las muestra con el.style.display='flex' */
    -webkit-appearance: none;
    appearance: none;
    background: transparent; /* evita fondo blanco de sistema en iOS/macOS */
    border: none;
    width: 100%;
    padding: 16px 20px;
    text-align: left;
    cursor: pointer;
    align-items: center;
    gap: 15px;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: inherit;
}
.admin-hub-option:last-child { border-bottom: none; }
.admin-hub-option:active { background: rgba(255,255,255,0.06); }




/* --- TAB SYSTEM --- */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    /* min-height en auto — el bug de Chrome que requería 600px fijo ya no existe en navegadores modernos */
    min-height: auto;
}

/* Asegurar que el contenido de admin/perfil sea siempre visible */
#admin-section .profile-card, 
#superadmin-section .profile-card,
#stats-view .profile-card,
#perfil-section .profile-card {
    display: block !important;
    min-height: 100px;
    overflow: visible !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.app-header.global-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(15, 23, 42, 0.8);
}

.notif-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--primary-light);
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

.notif-bell:hover {
    color: var(--primary);
}

.notif-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger);
    border-radius: 8px;
    border: 1.5px solid var(--bg-dark);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
    font-size: 0.55rem;
    font-weight: 900;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

#notif-btn.has-notifs i {
    color: #ef4444 !important;
    filter: drop-shadow(0 0 5px rgba(239, 68, 68, 0.4));
    animation: bell-pulse 2s infinite;
}

/* Badge siempre visible cuando hay notificaciones (el número es el indicador) */

@keyframes bell-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.notif-panel {
    position: fixed;
    top: 55px;   /* fallback; JS lo sobreescribe al abrir */
    right: 10px; /* fallback; JS lo sobreescribe al abrir */
    width: 300px;
    max-width: calc(100vw - 20px);
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 99999;
    overflow: hidden;
    transform-origin: top right;
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.notif-panel-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 800;
    font-size: 0.78rem;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notif-list {
    max-height: 350px;
    overflow-y: auto;
}

.notif-empty {
    padding: 30px 15px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.notif-item {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    transition: 0.2s;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-item-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
}

.notif-item-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notif-item-time {
    font-size: 0.7rem;
    color: var(--primary-light);
    opacity: 0.7;
}



/* --- HEADER ACTIONS --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* --- HEADER COMPACTO EN MÓVIL (<480px) --- */
@media (max-width: 480px) {
    /* Ocultar nombre de usuario y comunidad: la info está en Mi Perfil */
    #user-display-name { display: none !important; }
    #header-community-name { display: none !important; }
    /* Reducir tamaño del nombre del club para que quepa en 1 línea */
    .club-name-label { font-size: 0.78rem; }
    .header-eyebrow { font-size: 0.48rem; }
    /* Icono del header ligeramente más pequeño */
    .header-logo i { font-size: 1.4rem; }
}

/* --- PANEL DE NOTIFICACIONES COMO BOTTOM SHEET EN MÓVIL --- */
@media (max-width: 600px) {
    /* Drag handle en la parte superior */
    .notif-panel:not(.hidden)::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: rgba(255,255,255,0.18);
        border-radius: 2px;
        margin: 10px auto 4px;
        flex-shrink: 0;
    }
    .notif-panel:not(.hidden) {
        position: fixed !important;
        bottom: 70px !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 75vh !important;
        border-radius: 8px 8px 0 0 !important;
        box-shadow: 0 -8px 40px rgba(0,0,0,0.75), 0 0 0 1px rgba(0,255,132,0.06) !important;
        z-index: 9500 !important;
        overflow-y: auto !important;
        background: #0f1a2e !important;
        transform: none !important;
        display: flex !important;
        flex-direction: column !important;
    }
    .notif-list {
        max-height: none;
        flex: 1;
    }
    .notif-panel-header {
        font-size: 0.72rem;
        padding: 4px 16px 10px;
    }
}

.notif-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9490;
    cursor: pointer;
}

.header-username {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--primary-light);
    margin-right: 4px;
    line-height: 1; /* Forzar centrado vertical */
}



/* --- HEADER SUBTITLE --- */
.header-eyebrow {
    font-size: 0.55rem;
    opacity: 0.7;
    display: block;
    letter-spacing: 1.5px;
    font-weight: 800;
    text-transform: uppercase;
}



/* --- HEADER CLUB NAME --- */
.club-name-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-light);
}



/* --- SEGMENTED CONTROL (V4.1.0) --- */
.segmented-control {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    background: transparent;
    border: none;
    margin-top: 6px;
}
.segmented-control input[type="radio"] {
    display: none;
}
.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 6px 16px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid rgba(255,255,255,0.1);
    background: transparent;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.segmented-control label i {
    font-size: 1rem;
    opacity: 0.7;
}
.segmented-control input:checked + label {
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    border-color: var(--primary);
    color: var(--primary);
}
.segmented-control input:checked + label i {
    opacity: 1;
}
.segmented-control label:hover:not(input:checked + label) {
    background: rgba(255,255,255,0.03);
    color: var(--text-color);
}

/* Native Ads Responsive System */
.native-ad-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    color: #fff;
    cursor: pointer;
    width: 100%;
    height: auto;
    max-height: 100%;
    overflow-y: auto;
}

.native-ad-16-9 {
    max-width: 800px;
    aspect-ratio: 16/9;
    padding: 30px;
}

.native-ad-1-1 {
    width: 95vw;
    max-width: 550px;
    aspect-ratio: 1/1;
    padding: 35px;
}

.native-ad-9-16 {
    width: 90vw;
    max-width: 420px;
    aspect-ratio: 9/16;
    padding: 40px 25px;
}

.native-ad-icon-gift {
    position: relative;
    margin-bottom: 20px;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,.3));
}

.native-ad-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,.4);
}

.native-ad-gift-badge {
    position: absolute;
    top: -12px;
    right: -12px;
    background: linear-gradient(135deg, #fbbf24, #d97706);
    border: 3px solid #fff;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 15px rgba(217,119,6,.4);
    z-index: 10;
}

.native-ad-gift-badge i {
    font-size: 1.4rem;
    color: #fff;
}

.native-ad-icon-logo {
    margin-bottom: 20px;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,.3));
}

.native-ad-icon-font {
    font-size: 6rem;
    margin-bottom: 20px;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,.3));
}

.native-ad-qr-wrapper {
    margin: 15px 0;
    background: white;
    padding: 12px;
    border-radius: 8px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,.15);
}

.native-ad-qr-img {
    width: 160px;
    height: 160px;
    display: block;
}

.native-ad-qr-label {
    font-size: 0.65rem;
    color: #333;
    font-weight: 800;
    margin-top: 6px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.native-ad-button {
    background: #fff;
    color: #111;
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 20px rgba(0,0,0,.2);
    margin-top: 15px;
}

.native-ad-title {
    font-weight: 900;
    line-height: 1.1;
    margin: 0 0 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,.3);
    font-size: 2rem;
}

.native-ad-9-16 .native-ad-title {
    font-size: 1.8rem;
}

.native-ad-1-1 .native-ad-title {
    font-size: 1.9rem;
}

.native-ad-subtitle {
    opacity: 0.9;
    margin: 0 0 20px;
    line-height: 1.4;
    font-size: 1.1rem;
}

.native-ad-9-16 .native-ad-subtitle {
    font-size: 1rem;
}

.native-ad-1-1 .native-ad-subtitle {
    font-size: 1.05rem;
}

@media (max-width: 600px) {
    .native-ad-container {
        padding: 20px 15px !important;
        width: 100% !important;
    }
    .native-ad-16-9, .native-ad-1-1 {
        aspect-ratio: auto !important;
        height: auto !important;
    }
    .native-ad-9-16 {
        aspect-ratio: 9/16 !important;
        height: auto !important;
    }
    .native-ad-icon-font {
        font-size: 3.5rem !important;
        margin-bottom: 12px !important;
    }
    .native-ad-logo {
        width: 70px !important;
        height: 70px !important;
    }
    .native-ad-gift-badge {
        width: 32px !important;
        height: 32px !important;
        top: -8px !important;
        right: -8px !important;
        border-width: 2px !important;
    }
    .native-ad-gift-badge i {
        font-size: 1rem !important;
    }
    .native-ad-title {
        font-size: 1.35rem !important;
        margin-bottom: 8px !important;
    }
    .native-ad-subtitle {
        font-size: 0.85rem !important;
        margin-bottom: 12px !important;
    }
    .native-ad-qr-wrapper {
        padding: 8px !important;
        margin: 8px 0 !important;
    }
    .native-ad-qr-img {
        width: 120px !important;
        height: 120px !important;
    }
    .native-ad-button {
        padding: 8px 18px !important;
        font-size: 0.85rem !important;
        margin-top: 10px !important;
    }
}
