/* ========== Navigation ========== */

/* Top bar */
#topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(16px, calc((100vw - 768px) / 2));
    z-index: 100;
}

#topbar::before,
#topbar::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: max(0px, calc((100vw - 768px) / 2));
    pointer-events: none;
}

#topbar::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-primary), var(--bg-secondary));
}

#topbar::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-primary), var(--bg-secondary));
}

/* Desktop nav links in topbar */
.nav-links-desktop {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.nav-links-desktop .tab-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: var(--space-2);
    border-radius: var(--radius);
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
}

.nav-links-desktop .tab-icon-svg {
    width: 20px;
    height: 20px;
}

.nav-links-desktop .tab-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-links-desktop .tab-link.active {
    color: var(--accent);
    background: var(--accent-bg-strong);
}

/* Divider nav / date */
.nav-divider {
    width: 1px;
    height: 24px;
    background: linear-gradient(180deg, transparent, var(--accent), transparent);
    opacity: 0.3;
    margin: 0 10px;
}

/* Date in topbar */
.nav-date {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 0;
    margin-right: 8px;
    position: relative;
}

#nav-date-label {
    font-size: 0.85rem;
    color: var(--accent);
    white-space: nowrap;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.nav-date-btn {
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.nav-date-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.hidden-date-input {
    position: absolute;
    right: 0;
    top: 100%;
    opacity: 0;
    width: 0;
    height: 0;
    border: none;
    pointer-events: none;
}

/* Mobile night toggle (hidden on desktop) */
.mobile-only {
    display: none;
}

/* Bottom bar (hidden on desktop) */
#bottombar {
    display: none;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    #topbar {
        height: calc(56px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }

    .nav-links-desktop {
        display: none;
    }

    .nav-divider {
        display: none;
    }

    .twi-hide-mobile {
        display: none !important;
    }

    .mobile-only {
        display: block;
    }

    .nav-date {
        margin-left: auto;
        margin-right: 6px;
    }

    #nav-date-label {
        font-size: 0.78rem;
    }

    .nav-date-btn {
        width: 28px;
        height: 28px;
    }

    .nav-date-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Bandeau cookies mobile : meme hauteur que la bottombar, contenu centre */
    #cookie-banner {
        height: calc(56px + env(safe-area-inset-bottom));
        padding: 0 var(--space-4) env(safe-area-inset-bottom);
        box-sizing: border-box;
    }
    .cookie-content {
        width: 100%;
        height: 100%;
        font-size: 0.72rem;
        gap: 10px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        margin: 0;
    }
    .cookie-content span {
        flex: 1;
        min-width: 0;
        line-height: 1.25;
        display: flex;
        align-items: center;
    }
    .cookie-btn {
        padding: 6px 14px;
        font-size: 0.75rem;
        align-self: center;
    }

    #bottombar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(56px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-subtle);
        display: flex;
        align-items: center;
        justify-content: space-around;
        z-index: 100;
    }

    #app {
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }

    .home-controls {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .home-controls .form-group.inline {
        flex: 2 1 0;
        min-width: 0;
    }
    .home-controls .form-group.inline.filter-group {
        flex: 1 1 0;
        max-width: 28%;
    }

    .home-controls .form-group.inline select {
        font-size: 0.78rem;
        padding: 7px 6px;
        width: 100%;
    }

    .home-controls .form-group.inline label {
        font-size: 0.68rem;
    }

    .home-controls .select-icon {
        display: none;
    }

    .screen-header h1 {
        font-size: 1.3rem;
    }

    .screen-header p {
        font-size: 0.75rem;
    }

    .site-coords {
        font-size: 0.65rem;
        white-space: nowrap;
    }
}

/* Tab links (bottom bar mobile) */
#bottombar .tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    padding: 6px 8px;
    border-radius: 8px;
    transition: color 0.2s;
}

#bottombar .tab-link.active {
    color: var(--accent);
}

.tab-icon {
    font-size: 1.2rem;
    line-height: 1;
}

.tab-icon-svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
}

.tab-label {
    font-weight: 500;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-name {
    font-family: 'Orbitron', sans-serif;
    color: var(--accent);
    text-shadow: 0 0 8px var(--accent-glow-strong), 0 0 16px var(--accent-border-strong);
    -webkit-text-stroke: 0.5px rgba(0,0,0,0.3);
}


.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.nav-link.active {
    color: var(--accent);
    background: rgba(74, 144, 217, 0.1);
}

/* ========== Main content ========== */

#app {
    padding-top: 56px;
    min-height: 100dvh;
}

.screen {
    display: none;
    padding: var(--space-4);
    max-width: 800px;
    margin: 0 auto;
}

.screen.active {
    display: block;
}

.screen.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 200;
    overflow-y: auto;
    padding: 40px 20px;
    max-width: 100%;
}

.screen.overlay.active {
    display: block;
}

.screen.overlay .overlay-header {
    max-width: 800px;
    margin: 0 auto;
}

.screen.overlay #detail-content {
    background: var(--bg-primary);
    border: 1px solid var(--border-color, rgba(255,255,255,0.1));
    border-radius: 16px;
    padding: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.screen-header {
    margin-bottom: 20px;
}

#screen-setups .screen-header,
#screen-checklist .screen-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

/* Header sous-section Planètes (dans #solar-content) */
.solar-planets-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

/* Bulle d'aide Planètes : encadré lilas comme .sampling-info-panel */
#plan-info-bubble {
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin: 0 0 14px 0;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--text-secondary);
    font-style: normal;
    text-align: left;
}
#plan-info-bubble strong {
    color: var(--text-primary);
}

.screen-header h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.screen-header h2 {
    font-size: 1.1rem;
    color: var(--text-secondary);
}
