/* --------------------------------------------------------------------------
   App Container & Background Override
   -------------------------------------------------------------------------- */
.hh-app {
    display: flex;
    min-height: 100dvh;
    position: relative;
    overflow-x: hidden;
}

.hh-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--hh-dark);
    z-index: var(--hh-z-background);
}

/* Topbar logo */
.hh-topbar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
    visibility: visible;
    opacity: 1;
}

.hh-topbar-logo-icon {
    width: 1.5rem;
    height: 1.5rem;
    display: inline-block;
    object-fit: contain;
    flex: 0 0 auto;
}

.hh-topbar-logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--hh-primary-light);
    text-shadow: var(--hh-logo-text-shadow);
}

/* E2E Encrypted badge */
.hh-metric-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    background: rgba(var(--hh-security-rgb), 0.08);
    border: 1px solid rgba(var(--hh-security-rgb), 0.15);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(var(--hh-security-rgb), 0.9);
    letter-spacing: 0.02em;
}

/* Main Content — full width (no sidebar) */
.hh-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
}

.hh-app--document {
    display: block;
    min-height: 100dvh;
    overflow: visible;
}

.hh-main--document {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    overscroll-behavior: auto;
}

/* Custom Scrollbar - Neon Noir Theme */
.hh-content::-webkit-scrollbar {
    width: 8px;
}

.hh-content::-webkit-scrollbar-track {
    background: var(--hh-scrollbar-track);
}

.hh-content::-webkit-scrollbar-thumb {
    background: var(--hh-scrollbar-thumb);
    border-radius: 4px;
}

.hh-content::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--hh-primary-rgb), 0.4);
}

.hh-topbar {
    display: none;
    height: 56px;
    background: var(--hh-chrome-topbar-bg);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border: 1px solid var(--hh-glass-border);
    border-radius: 16px;
    position: sticky;
    top: 0.5rem;
    z-index: var(--hh-z-topbar);
    margin: 0.5rem 0.5rem 0;
    box-shadow: var(--hh-chrome-topbar-shadow);
    transition: background 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.hh-topbar::after {
    display: none;
}

.hh-topbar-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    padding: 0 1rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    gap: 0.5rem;
    overflow: hidden;
}

/* Guest auth actions (Login + Start Free) */
.hh-auth-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    white-space: nowrap;
}

.hh-login-link,
.hh-login-link .mud-button-label {
    color: var(--hh-text-primary) !important;
}

/* User Greeting — inline single-line */
.hh-user-greeting {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.hh-greeting-label {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--hh-chrome-nav-secondary);
    white-space: nowrap;
}

.hh-greeting-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--hh-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 150px;
}

.hh-topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.hh-notification-inbox-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    border: 1px solid var(--hh-border);
    border-radius: 50%;
    color: var(--hh-text-secondary);
    text-decoration: none;
}

.hh-notification-inbox-link:hover,
.hh-notification-inbox-link:focus-visible {
    border-color: var(--hh-primary);
    color: var(--hh-primary);
}

/* Content Area */
.hh-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding: 0.75rem;
    background: var(--hh-dark);
    padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
    padding-left: calc(0.75rem + env(safe-area-inset-left, 0px));
    padding-right: calc(0.75rem + env(safe-area-inset-right, 0px));
    padding-bottom: calc(0.75rem + 72px + env(safe-area-inset-bottom, 0px) + var(--hh-android-mobile-nav-lift, 0px));
    scroll-padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    width: 100%;
}

.hh-content--document {
    flex: 0 0 auto;
    min-height: calc(100dvh - 4.5rem);
    overflow: visible;
    overscroll-behavior: auto;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    scroll-padding-bottom: 0;
}

.hh-content-inner--document {
    min-height: inherit;
}

html.hh-platform-android .hh-content {
    padding-bottom: calc(0.75rem + 72px + var(--hh-android-mobile-nav-lift, 0px));
}

html.hh-platform-android .hh-content--document {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
}

.hh-content-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    animation: pageEnter 0.2s ease-out;
}

.hh-shell-loading {
    min-height: min(50dvh, 28rem);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--hh-text-secondary);
    font-size: var(--hh-font-size-sm);
}

.hh-shell-loading-indicator {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(var(--hh-primary-rgb), 0.25);
    border-top-color: var(--hh-primary);
    border-radius: 50%;
    animation: hh-shell-spin 0.8s linear infinite;
}

@keyframes hh-shell-spin {
    to { transform: rotate(360deg); }
}

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

@media (prefers-reduced-motion: reduce) {
    .hh-content-inner,
    .hh-shell-loading-indicator { animation: none; }
}

/* ==========================================================================
   Topbar Navigation (Icon Tabs)
   ========================================================================== */
.hh-topnav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    justify-content: center;
}

.hh-topnav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    height: 44px;
    min-height: 44px;
    padding: 0 0.625rem;
    border-radius: 12px;
    color: var(--hh-chrome-nav-muted);
    text-decoration: none;
    transition: color 0.2s ease, background 0.2s ease;
    position: relative;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Labels hidden by default, shown on wide desktop */
.hh-topnav-label {
    display: none;
}

@media (hover: hover) {
    .hh-topnav-item:hover {
        color: var(--hh-chrome-nav-hover);
        background: var(--hh-chrome-nav-hover-bg);
    }
}

.hh-topnav-item.active {
    color: var(--hh-primary);
    background: rgba(var(--hh-primary-rgb), 0.1);
}

.hh-topnav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--hh-primary);
    border-radius: 2px;
}

.hh-topnav-icon-wrap {
    position: relative;
    display: inline-flex;
}

.hh-topnav-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--hh-primary);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hh-topnav-badge-msg {
    background: var(--hh-accent);
}

.hh-topnav-more {
    color: var(--hh-chrome-nav-muted);
    transition: color 0.2s ease;
}

.hh-topnav-more:hover {
    color: var(--hh-chrome-nav-hover);
}

/* ==========================================================================
   Tablet / Desktop (≥769px)
   ========================================================================== */
@media (min-width: 769px) {
    .hh-topbar {
        display: flex;
    }

    .hh-content {
        padding: 1rem;
        scroll-padding-bottom: 0;
    }
}

.hh-topbar--public,
.hh-topbar--admin {
    display: flex;
}

@media (max-width: 480px) {
    .hh-topbar--public,
    .hh-topbar--admin {
        margin: 0.375rem;
        border-radius: 14px;
    }

    .hh-topbar--public .hh-topbar-content,
    .hh-topbar--admin .hh-topbar-content {
        padding: 0 0.625rem;
    }

    .hh-topbar--public .hh-topbar-logo-text,
    .hh-topbar--admin .hh-topbar-logo-text {
        display: none;
    }

    .hh-topbar--public .mud-button-root {
        min-width: 0;
        padding-inline: 0.65rem;
        font-size: 0.75rem;
    }
}

/* ==========================================================================
   Desktop Enhancements (≥1024px)
   ========================================================================== */
@media (min-width: 1024px) {

    /* Show text labels alongside icons */
    .hh-topnav-label {
        display: inline;
    }

    /* Wider topbar padding */
    .hh-topbar-content {
        padding: 0 1.75rem;
    }

    /* Slight separator between nav zone and right side */
    .hh-topnav {
        padding: 0.25rem 0.75rem;
        margin: 0 0.5rem;
        background: var(--hh-chrome-nav-strip-bg);
        border-radius: 12px;
    }

    /* Content area gets more breathing room */
    .hh-content {
        padding: 1.5rem 2rem;
    }
}

/* Extra-wide desktop ≥1200px */
@media (min-width: 1200px) {
    .hh-actions-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .hh-action-featured {
        grid-column: 1 / -1;
    }

    .hh-stat-pill {
        padding: 0.625rem 1.25rem;
    }

    .hh-stat-pill-value {
        font-size: 1.25rem;
    }
}

/* --------------------------------------------------------------------------
   Mobile Bottom Navigation Bar
   -------------------------------------------------------------------------- */
.hh-mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--hh-z-mobile-nav);
    background: var(--hh-chrome-mobile-nav-bg);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-top: 1px solid var(--hh-glass-border);
    padding: 0.375rem 0.5rem calc(0.375rem + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    align-items: stretch;
    box-shadow: var(--hh-chrome-mobile-nav-shadow);
    border-radius: 16px 16px 0 0;
    will-change: transform;
}

html.hh-platform-android {
    --hh-android-mobile-nav-lift: 0px;
}

html.hh-platform-android .hh-mobile-nav {
    padding-bottom: calc(0.375rem + var(--hh-android-mobile-nav-lift, 0px));
}

html.hh-platform-android.hh-complycube-active .hh-mobile-nav {
    display: none !important;
}

.hh-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    flex: 1;
    min-height: 44px;
    padding: 0.4rem 0.25rem;
    color: var(--hh-chrome-nav-secondary);
    text-decoration: none;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    border-radius: 10px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    position: relative;
}

@media (hover: hover) {
    .hh-mobile-nav-item:hover {
        color: var(--hh-chrome-nav-hover);
    }
}

.hh-mobile-nav-item.active {
    color: var(--hh-primary);
    background: rgba(var(--hh-primary-rgb), 0.14);
    font-weight: 600;
}

.hh-mobile-nav-item.active::before {
    content: '';
    position: absolute;
    top: -0.375rem;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--hh-primary);
    border-radius: 0 0 3px 3px;
}

.hh-mobile-nav-item > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.hh-mobile-nav-icon-wrap {
    position: relative;
    display: inline-flex;
}

.hh-mobile-nav-badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--hh-primary);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.hh-mobile-nav-badge-msg {
    background: var(--hh-accent);
}

.hh-mobile-nav-item:active {
    transform: scale(0.94);
    opacity: 0.85;
    transition-duration: 80ms;
}

.hh-mobile-nav-cta {
    color: var(--hh-primary) !important;
    font-weight: 600;
}

.hh-mobile-nav-cta.active {
    background: rgba(var(--hh-primary-rgb), 0.15);
}

/* Hide mobile nav on desktop (must come after base .hh-mobile-nav styles) */
@media (min-width: 769px) {
    .hh-mobile-nav {
        display: none;
    }
}
