/**
 * Header & Navigation - Premium SaaS Design
 * Dark header with refined navigation
 *
 * @package BeepBeep_AI
 * @since 8.0.0
 */

/* ============================================
   HEADER
   ============================================ */

.bbai-header {
    background: #0f172a;
    padding: var(--bbai-space-4) var(--bbai-space-6);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.bbai-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--bbai-dashboard-max-width);
    margin: 0 auto;
    gap: var(--bbai-space-4);
    overflow: visible;
}

/* ============================================
   LOGO
   ============================================ */

.bbai-logo {
    display: flex;
    align-items: center;
    gap: var(--bbai-space-3);
    text-decoration: none;
    flex-shrink: 0;
}

.bbai-logo-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.bbai-logo-text {
    font-size: var(--bbai-text-base);
    font-weight: var(--bbai-font-bold);
    color: white;
    letter-spacing: -0.01em;
}

/* ============================================
   NAVIGATION
   ============================================ */

.bbai-nav {
    display: flex;
    align-items: center;
    gap: var(--bbai-space-4);
    flex: 1 1 auto;
    min-width: 0;
}

.bbai-nav__primary {
    display: flex;
    align-items: center;
    gap: var(--bbai-space-2);
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.bbai-nav__primary::-webkit-scrollbar {
    display: none;
}

.bbai-nav-link {
    display: inline-flex;
    align-items: center;
    gap: var(--bbai-space-2);
    padding: var(--bbai-space-2) var(--bbai-space-4);
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    border-radius: var(--bbai-radius);
    font-size: var(--bbai-text-sm);
    font-weight: var(--bbai-font-medium);
    transition: all var(--bbai-transition-fast) var(--bbai-ease-out);
    background: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    min-height: 36px;
}

.bbai-nav-link:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.bbai-nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: var(--bbai-font-semibold);
}

.bbai-nav-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.bbai-nav-link svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.bbai-nav-link:hover svg,
.bbai-nav-link.active svg {
    opacity: 1;
}

/* ============================================
   GUIDE/HELP LINK
   ============================================ */

.bbai-header-guide-link {
    display: inline-flex;
    align-items: center;
    gap: var(--bbai-space-2);
    padding: var(--bbai-space-2) var(--bbai-space-3);
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    border-radius: var(--bbai-radius-full);
    font-size: var(--bbai-text-sm);
    font-weight: var(--bbai-font-medium);
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.04);
    transition: all var(--bbai-transition-fast) var(--bbai-ease-out);
    margin-left: auto;
    flex-shrink: 0;
}

.bbai-header-guide-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.24);
}

.bbai-header-guide-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.24);
}

.bbai-header-guide-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.bbai-header-guide-link svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.bbai-header-guide-text {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .bbai-header-guide-link {
        padding: var(--bbai-space-1) var(--bbai-space-2);
    }

    .bbai-header-guide-text {
        display: none;
    }
}

/* ============================================
   HEADER ACTIONS
   ============================================ */

.bbai-header-actions {
    display: flex;
    align-items: center;
    gap: var(--bbai-space-3);
    flex-shrink: 0;
}

/* Credits pill (connected account — remaining generations) */
.bbai-credits-pill {
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.3;
}

.bbai-credits-pill[data-state="low"] {
    background: rgba(255, 165, 0, 0.15);
    color: #ff9800;
}

.bbai-credits-pill[data-state="empty"] {
    background: rgba(255, 0, 0, 0.15);
    color: #ff4d4f;
}

/* Free plan: single inline header line (plan + credits + upgrade) — not a button */
.bbai-header-free-credits-upgrade-line {
    display: inline-block;
    font-size: 13px;
    font-weight: var(--bbai-font-medium, 500);
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.94);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    padding-bottom: 1px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.bbai-header-free-credits-upgrade-line:hover {
    color: #fff;
    border-bottom-color: rgba(255, 255, 255, 0.65);
}

.bbai-header-free-credits-upgrade-line:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Auth Badge */
.bbai-auth-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--bbai-space-2);
    padding: var(--bbai-space-2) var(--bbai-space-3);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--bbai-radius);
    font-size: var(--bbai-text-sm);
    color: white;
}

.bbai-auth-badge__user {
    font-weight: var(--bbai-font-medium);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bbai-auth-badge__logout {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--bbai-text-xs);
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    transition: color var(--bbai-transition-fast);
}

.bbai-auth-badge__logout:hover {
    color: white;
}

/* Logout/Disconnect Button */
.bbai-header-logout-btn,
.bbai-header-disconnect-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--bbai-space-2);
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--bbai-radius);
    font-size: var(--bbai-text-xs);
    font-weight: var(--bbai-font-medium);
    cursor: pointer;
    transition: all var(--bbai-transition-fast) var(--bbai-ease-out);
    white-space: nowrap;
    text-decoration: none;
}

.bbai-header-logout-btn:hover,
.bbai-header-disconnect-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.bbai-header-logout-btn:focus-visible,
.bbai-header-disconnect-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.bbai-header-logout-btn:disabled,
.bbai-header-disconnect-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Login Button - Header specific */
.bbai-header-login-btn,
.bbai-header .bbai-header-login-btn,
.wrap .bbai-header-login-btn,
button.bbai-header-login-btn,
a.bbai-header-login-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 8px 16px !important;
    background: #10B981 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none !important;
    white-space: nowrap;
    box-shadow: none !important;
    text-shadow: none !important;
    height: auto !important;
    min-height: auto !important;
    line-height: 1.4 !important;
}

.bbai-header-login-btn:hover,
.bbai-header .bbai-header-login-btn:hover,
.wrap .bbai-header-login-btn:hover,
button.bbai-header-login-btn:hover,
a.bbai-header-login-btn:hover {
    background: #059669 !important;
    color: #ffffff !important;
    border: none !important;
}

.bbai-header-login-btn:focus,
.bbai-header-login-btn:focus-visible,
.bbai-header .bbai-header-login-btn:focus,
.bbai-header .bbai-header-login-btn:focus-visible,
a.bbai-header-login-btn:focus,
a.bbai-header-login-btn:focus-visible {
    outline: 2px solid rgba(16, 185, 129, 0.5) !important;
    outline-offset: 2px !important;
    background: #10B981 !important;
    color: #ffffff !important;
}

.bbai-header-login-btn svg,
.bbai-header .bbai-header-login-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
    .bbai-header-content {
        flex-wrap: wrap;
    }

    .bbai-nav {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        margin-top: var(--bbai-space-2);
        padding-bottom: var(--bbai-space-2);
    }

    .bbai-nav-link {
        padding: var(--bbai-space-2) var(--bbai-space-3);
        font-size: var(--bbai-text-xs);
    }

    .bbai-nav__primary {
        flex: 1 1 auto;
    }
}

@media (max-width: 640px) {
    .bbai-header {
        padding: var(--bbai-space-3) var(--bbai-space-4);
    }

    .bbai-logo-text {
        display: none;
    }

    .bbai-header-actions {
        gap: var(--bbai-space-2);
    }

    .bbai-auth-badge__user {
        max-width: 100px;
    }
}
