/*
 * Global navigation (header, desktop icon nav, account avatar menu, mobile
 * bottom nav bar) - extracted from comdata/templates/comdata/base.html.
 * comdata/base.html is the single layout root for the whole site (every
 * template extends it, directly or via accounts/base.html), so this file
 * is loaded on every page.
 *
 * Strava/Instagram-inspired: icon+text top nav and an avatar-as-account-menu
 * on desktop, a fixed 5-icon bottom bar on mobile (this site's existing
 * icon convention - raw emoji in <i class="icon">, no icon font/library -
 * is kept, see static/comdata/css/list_view.css:.icon).
 */

header {
    background: var(--color-accent);
    color: white;
    padding: 12px 0;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
}

.header-container h1 {
    font-size: 22px;
    font-weight: 600;
    flex-shrink: 0;
}

.brand-link {
    color: inherit;
    text-decoration: none;
}

/* Desktop nav: icon + label, horizontal */
.desktop-nav ul {
    list-style: none;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.desktop-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.desktop-nav a:hover,
.desktop-nav a.active {
    background: rgba(255, 255, 255, 0.15);
}

.desktop-nav .icon {
    font-size: 1.05rem;
}

/* Right-hand cluster of the header: icon-only links (no text) - Pilotes,
 * notification bell, profil. A single flex item for .header-container's
 * justify-content:space-between, so they sit a small fixed gap apart
 * instead of being spread across the leftover space of a 3-4 item
 * space-between row. */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm, 0.5rem);
}

/* Shared visual style for every icon-only header link (Pilotes, cloche,
 * avatar profil). */
.header-icon-link {
    flex-shrink: 0;
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    line-height: 1;
    display: inline-flex;
}

/* Notification bell: links to pending follow requests, small badge with the
 * pending count (see comdata.context_processors.pending_follow_requests_count).
 * Only .position:relative is bell-specific (anchors the badge) - the rest of
 * the visual style comes from .header-icon-link above. */
.notification-bell {
    position: relative;
}

.notification-bell-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--color-danger, #e5484d);
    color: white;
    border-radius: 999px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 18px;
    text-align: center;
}

/* Mobile bottom nav bar - hidden on desktop */
.bottom-nav {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 8px 0;
    }

    .header-container h1 {
        font-size: 17px;
    }

    .desktop-nav {
        display: none;
    }

    /* Profil déjà accessible via l'onglet dédié de la bottom-nav mobile
       (voir plus bas) - masquer l'avatar du header ici évite un doublon.
       Pilotes et la cloche (.header-icon-link / .notification-bell), eux,
       n'ont pas d'équivalent dans la bottom-nav et restent visibles. */
    .header-profile-link {
        display: none;
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 2500;
        background: var(--color-bg-surface);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px 4px;
        min-height: var(--touch-target-min);
        color: var(--color-text-muted);
        text-decoration: none;
        font-size: 0.68rem;
    }

    .bottom-nav-item .icon {
        font-size: 1.4rem;
        line-height: 1;
    }

    .bottom-nav-item.active {
        color: var(--color-accent);
    }

    /* Was a single <i class="icon">➕</i> styled directly as the accent
       circle (background+border-radius on the icon element itself). A CSS
       mask icon can't play both roles at once - mask clips whatever the
       element paints (including its own background), so the circle fill
       would get punched into a plus-shaped hole instead of showing a white
       plus on a solid circle. Split into a wrapper (the circle) plus the
       masked icon inside it (see base.html). */
    .create-icon-circle {
        background: var(--color-accent);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .bottom-nav-item--create .icon {
        font-size: 1.1rem;
        color: white;
    }

    .bottom-nav-item--profile.active .avatar {
        outline: 2px solid var(--color-accent);
        outline-offset: 2px;
    }

    /* "+" bottom-nav item, now a small choice menu (see base.html and
       static/comdata/css/components.css's .action-menu-* for the generic
       dropdown this reuses) instead of a direct link. */
    .bottom-nav-item--create {
        position: relative; /* anchors the dropdown below */
    }

    .bottom-nav-create-toggle {
        all: unset;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        width: 100%;
        min-height: var(--touch-target-min);
        cursor: pointer;
    }

    /* .action-menu-dropdown opens downward by default (components.css) -
       unusable this close to the bottom edge of the screen, so this
       variant opens upward and centers on the toggle instead of hugging
       its right edge. */
    .bottom-nav-create-dropdown {
        top: auto;
        bottom: calc(100% + 0.6rem);
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        min-width: 200px;
    }
}
