/* ============================================
   BOTTOM NAVIGATION - Mobile Only
   TikTok/Instagram-inspired thumb navigation
   Gen Z Optimized: Thumb zone, haptic feedback hints
   ============================================ */

/* ===========================================
   BASE COMPONENT - Hidden by default
   =========================================== */

.bottom-nav {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--ds-glass-solid, rgba(15, 23, 42, 0.92));
    backdrop-filter: blur(var(--ds-blur-xl, 40px)) var(--ds-saturation, saturate(180%));
    -webkit-backdrop-filter: blur(var(--ds-blur-xl, 40px)) var(--ds-saturation, saturate(180%));
    border-top: 1px solid var(--ds-glass-border-default, rgba(148, 163, 184, 0.12));
    box-shadow:
        0 -4px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 var(--ds-glass-shine-subtle, rgba(255, 255, 255, 0.02));
}

/* Show only on mobile */
@media (max-width: 767px) {
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: stretch;
    }

    /* Adjust fixed elements when bottom nav is present */
    body.has-bottom-nav .studio-input-section.studio-input-fixed {
        bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    /* Adjust page padding */
    body.has-bottom-nav .studio-page-wrapper,
    body.has-bottom-nav .history-v2 {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }
}

/* ===========================================
   NAV ITEMS
   =========================================== */

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px;
    min-height: 56px;
    background: transparent;
    border: none;
    color: var(--ds-text-muted, #94a3b8);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s var(--ds-ease-out, cubic-bezier(0, 0, 0.2, 1));
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

/* Ripple effect container */
.bottom-nav-item::before {
    content: '';
    position: absolute;
    inset: 4px;
    background: var(--ds-accent-subtle, rgba(139, 92, 246, 0.1));
    border-radius: var(--ds-radius-lg, 16px);
    opacity: 0;
    transform: scale(0.8);
    transition:
        opacity 0.2s ease,
        transform 0.2s ease;
}

.bottom-nav-item:active::before {
    opacity: 1;
    transform: scale(1);
}

/* Active state */
.bottom-nav-item.active {
    color: var(--ds-accent-primary, #8b5cf6);
}

.bottom-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--ds-gradient-accent, linear-gradient(135deg, #8b5cf6 0%, #a855f7 50%, #a78bfa 100%));
    border-radius: 0 0 var(--ds-radius-full, 9999px) var(--ds-radius-full, 9999px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* Hover state (for touch devices with hover capability) */
@media (hover: hover) {
    .bottom-nav-item:hover:not(.active) {
        color: var(--ds-text-secondary, #e2e8f0);
    }
}

/* ===========================================
   ICON & LABEL
   =========================================== */

.nav-icon {
    position: relative;
    z-index: 1;
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 0.2s var(--ds-ease-spring, cubic-bezier(0.175, 0.885, 0.32, 1.275));
}

.bottom-nav-item.active .nav-icon {
    transform: scale(1.1);
}

/* Icon bounce on tap */
.bottom-nav-item:active .nav-icon {
    transform: scale(0.9);
}

.nav-label {
    position: relative;
    z-index: 1;
    font-size: 10px;
    font-weight: var(--ds-font-medium, 500);
    letter-spacing: 0.02em;
    line-height: 1.2;
    white-space: nowrap;
}

/* Credits badge (special styling for credits item) */
.bottom-nav-item .credits-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 20px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--ds-gradient-accent, linear-gradient(135deg, #8b5cf6 0%, #a855f7 100%));
    border-radius: var(--ds-radius-full, 9999px);
    color: white;
    font-size: 10px;
    font-weight: var(--ds-font-bold, 700);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.4);
}

/* ===========================================
   MORE MENU (Dropdown)
   =========================================== */

.bottom-nav-more-menu {
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 8px);
    right: 8px;
    width: 200px;
    background: var(--ds-glass-2, rgba(30, 41, 59, 0.7));
    backdrop-filter: blur(var(--ds-blur-lg, 24px));
    -webkit-backdrop-filter: blur(var(--ds-blur-lg, 24px));
    border: 1px solid var(--ds-glass-border-emphasis, rgba(148, 163, 184, 0.2));
    border-radius: var(--ds-radius-xl, 20px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 var(--ds-glass-shine-default, rgba(255, 255, 255, 0.05));
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transform-origin: bottom right;
    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.25s var(--ds-ease-spring, cubic-bezier(0.175, 0.885, 0.32, 1.275));
    z-index: 101;
}

.bottom-nav-more-menu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.more-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--ds-radius-md, 12px);
    color: var(--ds-text-secondary, #e2e8f0);
    font-size: 14px;
    font-weight: var(--ds-font-medium, 500);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.more-menu-item:hover {
    background: var(--ds-accent-subtle, rgba(139, 92, 246, 0.1));
    color: var(--ds-text-primary, #f8fafc);
}

.more-menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    color: var(--ds-text-muted, #94a3b8);
}

.more-menu-item:hover i {
    color: var(--ds-accent-primary, #8b5cf6);
}

.more-menu-divider {
    height: 1px;
    background: var(--ds-glass-border-subtle, rgba(148, 163, 184, 0.08));
    margin: 4px 8px;
}

/* ===========================================
   OVERLAY (for closing menu)
   =========================================== */

.bottom-nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 99;
    background: transparent;
    display: none;
}

.bottom-nav-overlay.visible {
    display: block;
}

/* ===========================================
   REDUCED MOTION
   =========================================== */

@media (prefers-reduced-motion: reduce) {
    .bottom-nav-item::before,
    .bottom-nav-more-menu {
        transition: opacity 0.1s ease;
    }

    .bottom-nav-item:active .nav-icon,
    .bottom-nav-item.active .nav-icon {
        transform: none;
    }
}

/* ===========================================
   PRINT - Hide on print
   =========================================== */

@media print {
    .bottom-nav {
        display: none !important;
    }
}
