/* ==========================================================================
   Mercurium Solutions — Unified App Shell & Ecosystem Header Styles
   ========================================================================== */

:root {
    --shell-header-height: 58px;
    --shell-bg: rgba(10, 10, 18, 0.85);
    --shell-border: rgba(255, 255, 255, 0.08);
    --shell-border-glow: rgba(0, 243, 255, 0.25);
    --shell-accent: #00f3ff;
    --shell-accent-dim: rgba(0, 243, 255, 0.12);
    --shell-surface: #101222;
    --shell-surface-hover: #171a30;
    --shell-text: #f1f5f9;
    --shell-text-muted: #94a3b8;
}

/* Glass Header Standardization */
.glass-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--shell-header-height);
    background: var(--shell-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--shell-border);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 1.25rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: top 0.25s ease, background 0.25s ease;
}

body.has-active-banner .glass-header {
    top: 42px !important;
}

/* Header Interior Nav */
.glass-header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1280px;
    height: 100%;
    gap: 0.75rem;
}

/* Left Brand & Breadcrumb Section */
.shell-brand-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.shell-logo {
    display: flex;
    align-items: center;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: 1px;
    color: #ffffff;
    text-decoration: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
    flex-shrink: 0;
}

.shell-logo:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.shell-logo .highlight {
    color: var(--shell-accent);
    text-shadow: 0 0 12px rgba(0, 243, 255, 0.5);
}

.shell-divider {
    color: rgba(255, 255, 255, 0.2);
    font-size: 1rem;
    font-weight: 300;
    user-select: none;
}

.shell-breadcrumb {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #cbd5e1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.shell-breadcrumb .badge-sub {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--shell-accent-dim);
    color: var(--shell-accent);
    border: 1px solid rgba(0, 243, 255, 0.3);
    letter-spacing: 0.5px;
}

/* Center / Apps Switcher Section */
.shell-center-group {
    position: relative;
    display: flex;
    align-items: center;
}

.app-switcher-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.38rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    user-select: none;
}

.app-switcher-trigger:hover,
.app-switcher-trigger.active {
    background: rgba(0, 243, 255, 0.08);
    border-color: rgba(0, 243, 255, 0.4);
    color: #ffffff;
    box-shadow: 0 0 14px rgba(0, 243, 255, 0.15);
}

.app-switcher-trigger svg.grid-icon {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    color: var(--shell-accent);
}

.app-switcher-trigger svg.chevron-icon {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    opacity: 0.6;
    transition: transform 0.2s ease;
}

.app-switcher-trigger.active svg.chevron-icon {
    transform: rotate(180deg);
}

/* Apps Dropdown Menu */
.app-switcher-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px) scale(0.97);
    width: 360px;
    max-width: 92vw;
    background: #0d0f1a;
    border: 1px solid rgba(0, 243, 255, 0.4);
    border-radius: 14px;
    padding: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 30px rgba(0, 243, 255, 0.2);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.18s;
}

.app-switcher-menu.open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.app-switcher-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.65rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-switcher-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--shell-accent);
}

.app-switcher-badge {
    font-size: 0.65rem;
    color: var(--shell-text-muted);
    font-weight: 600;
}

.app-switcher-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.app-switcher-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.65rem 0.85rem;
    border-radius: 9px;
    text-decoration: none;
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: all 0.18s ease;
    cursor: pointer;
}

.app-switcher-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 243, 255, 0.4);
    transform: translateX(3px);
}

.app-switcher-item.current {
    background: rgba(0, 243, 255, 0.1);
    border-color: rgba(0, 243, 255, 0.5);
}

.app-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}
    flex-shrink: 0;
}

.app-switcher-item.current .app-item-icon {
    background: rgba(0, 243, 255, 0.15);
    border-color: rgba(0, 243, 255, 0.4);
}

.app-item-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.app-item-name-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.app-item-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
}

.app-item-badge {
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    text-transform: uppercase;
}

.app-item-badge.active-dot {
    background: rgba(0, 243, 255, 0.15);
    color: var(--shell-accent);
    border: 1px solid rgba(0, 243, 255, 0.3);
}

.app-item-badge.pwa-dot {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.app-item-desc {
    font-size: 0.72rem;
    color: var(--shell-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.app-switcher-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.75rem;
}

.app-switcher-footer a {
    color: var(--shell-text-muted);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.2s ease;
}

.app-switcher-footer a:hover {
    color: var(--shell-accent);
}

/* Right Controls / Auth Section */
.shell-right-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-shrink: 0;
}

.shell-auth-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.38rem 0.95rem;
    background: transparent;
    border: 1px solid var(--shell-accent);
    border-radius: 8px;
    color: var(--shell-accent);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
}

.shell-auth-btn:hover {
    background: var(--shell-accent);
    color: #0a0a12;
    box-shadow: 0 0 16px rgba(0, 243, 255, 0.3);
}

.shell-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.32rem 0.75rem 0.32rem 0.45rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #f1f5f9;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.shell-user-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 243, 255, 0.4);
    box-shadow: 0 0 12px rgba(0, 243, 255, 0.15);
}

.shell-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00f3ff, #bc13fe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #0a0a12;
    text-transform: uppercase;
}

.shell-user-email {
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* App-Specific Action Group Integration */
.shell-app-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .glass-header {
        padding: 0 0.85rem;
    }
    
    .shell-breadcrumb {
        font-size: 0.75rem;
        max-width: 110px;
    }

    .app-switcher-trigger span.label-text {
        display: none;
    }
    
    .app-switcher-trigger {
        padding: 0.38rem 0.55rem;
    }

    .shell-user-email {
        display: none;
    }
    
    .shell-user-pill {
        padding: 0.3rem;
    }

    .app-switcher-menu {
        position: fixed;
        top: calc(var(--shell-header-height) + 8px);
        left: 50%;
        transform: translateX(-50%) scale(0.95);
        width: calc(100vw - 24px);
        max-height: 80vh;
        overflow-y: auto;
    }

    .app-switcher-menu.open {
        transform: translateX(-50%) scale(1);
    }
}
