/* static/css/components/mobile_bottom_nav.css */
/* ============================================
   KELIBATMU V2 - MOBILE BOTTOM NAVIGATION
   Isolated mobile-only navigation system
   Namespace: kv2-mbn-
   Appears only on mobile (< 768px)
   V2 Update: 5-item layout with search overlay trigger + unread notification badge
   ============================================ */

/* Base Container - Fixed to bottom on mobile only */
.kv2-mbn {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-mobile-bottom-nav, 210);
    
    /* Subtle glassmorphism - cinematic feel */
    background: color-mix(in srgb, var(--theme-surface) 92%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    
    border-top: 1px solid var(--theme-border);
    
    /* Smooth appearance */
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Visible state on mobile */
@media (max-width: 768px) {
    .kv2-mbn {
        display: block;
        opacity: 1;
        transform: translateY(0);
    }

    body.kv2-search-keyboard-open .kv2-mbn {
        opacity: 0;
        pointer-events: none;
        transform: translateY(100%);
    }
}

/* Container for proper spacing */
.kv2-mbn__container {
    max-width: 500px;
    margin: 0 auto;
    padding: 8px 20px;
    
    /* Safe area inset for modern iPhones */
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.kv2-mbn__app-prompt {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 0 2px 8px;
    padding: 10px 42px 10px 12px;
    border: 1px solid color-mix(in srgb, #9bd184 38%, var(--theme-border));
    border-radius: 16px;
    background:
        linear-gradient(
            135deg,
            color-mix(in srgb, #9bd184 15%, transparent),
            color-mix(in srgb, var(--theme-surface) 92%, transparent)
        );
    color: var(--color-text-primary);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.14),
        0 0 0 1px color-mix(in srgb, #9bd184 8%, transparent);
}

.kv2-mbn__app-prompt[data-app-state="update"] {
    border-color: color-mix(in srgb, #9bd184 58%, var(--theme-border));
    background: color-mix(in srgb, #9bd184 20%, var(--theme-surface));
}

.kv2-mbn__app-prompt-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, #9bd184, #72bd6e);
    color: #08200f;
    font-size: 20px;
    line-height: 1;
}

.kv2-mbn__app-prompt-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.kv2-mbn__app-prompt-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--theme-surface-soft) 80%, transparent);
    color: var(--color-text-secondary);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
}

body.kv2-app-prompt-hidden .kv2-mbn__app-prompt {
    display: none;
}

.kv2-mbn__app-prompt-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.2;
}

.kv2-mbn__app-prompt-subtitle {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-muted);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.25;
}

.kv2-mbn__app-prompt-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    min-height: 30px;
    border: 1px solid color-mix(in srgb, #9bd184 54%, transparent);
    border-radius: 999px;
    padding: 0 12px;
    background: linear-gradient(135deg, #9bd184, #72bd6e);
    color: #08200f;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0;
    text-decoration: none;
}

/* Navigation - 5-item flex grid (updated from 4 to 5) */
.kv2-mbn__nav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 4px; /* Reduced gap for 5 items */
}

/* Individual navigation item */
.kv2-mbn__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    
    text-decoration: none;
    
    /* Minimal hit area */
    padding: 8px 4px;
    
    border-radius: 12px;
    
    /* Smooth transitions - no layout shifting */
    transition: background-color 0.2s ease,
                color 0.2s ease;
    
    cursor: pointer;
    position: relative;
}

/* Icon wrapper - stable dimensions */
.kv2-mbn__icon-wrapper {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Stable, no movement */
    flex-shrink: 0;
    position: relative;
}

/* Icon styling */
.kv2-mbn__icon {
    width: 22px;
    height: 22px;
    stroke: rgba(255, 255, 255, 0.55);
    stroke-width: 1.5;
    fill: none;
    
    transition: stroke 0.2s ease,
                fill 0.2s ease;
}

/* Notification Badge - Cinematic unread indicator */
.kv2-mbn__notification-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: linear-gradient(135deg, rgba(190, 72, 72, 0.95), rgba(150, 48, 62, 0.95));
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px rgba(139, 44, 44, 0.5);
    backdrop-filter: blur(4px);
    letter-spacing: -0.01em;
    transition: transform 0.2s ease;
}

.kv2-mbn__item:hover .kv2-mbn__notification-badge {
    transform: scale(1.05);
}

/* Avatar image styling - identical dimensions to icons */
.kv2-mbn__avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    
    /* Subtle border for depth */
    border: 1px solid rgba(255, 255, 255, 0.15);
    
    transition: border-color 0.2s ease;
}

/* Avatar initial fallback */
.kv2-mbn__avatar-initial {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(139, 44, 44, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    
    transition: background 0.2s ease;
}

/* Label styling */
.kv2-mbn__label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.45);
    
    transition: color 0.2s ease;
}

/* Hover state - subtle background only */
.kv2-mbn__item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.kv2-mbn__item:hover .kv2-mbn__icon {
    stroke: rgba(255, 255, 255, 0.75);
}

.kv2-mbn__item:hover .kv2-mbn__avatar {
    border-color: rgba(255, 255, 255, 0.3);
}

.kv2-mbn__item:hover .kv2-mbn__avatar-initial {
    background: rgba(139, 44, 44, 0.8);
}

.kv2-mbn__item:hover .kv2-mbn__label {
    color: rgba(255, 255, 255, 0.6);
}

/* Active state - cinematic restrained glow */
.kv2-mbn__item--active .kv2-mbn__icon {
    stroke: rgba(139, 44, 44, 0.9);
    fill: none;
}

.kv2-mbn__item--active .kv2-mbn__avatar {
    border-color: rgba(139, 44, 44, 0.6);
    box-shadow: 0 0 0 1px rgba(139, 44, 44, 0.3);
}

.kv2-mbn__item--active .kv2-mbn__avatar-initial {
    background: rgba(139, 44, 44, 0.9);
}

.kv2-mbn__item--active .kv2-mbn__label {
    color: rgba(139, 44, 44, 0.85);
}

/* Active state hover override */
.kv2-mbn__item--active:hover .kv2-mbn__icon {
    stroke: rgba(139, 44, 44, 1);
}

.kv2-mbn__item--active:hover .kv2-mbn__label {
    color: rgba(139, 44, 44, 1);
}

/* Ensure search button looks identical to anchor items */
.kv2-mbn__item--search {
    background: none;
    border: none;
    font-family: inherit;
    width: auto;
}

/* Keep active state for consistency */
.kv2-mbn__item--search:hover .kv2-mbn__icon {
    stroke: rgba(255, 255, 255, 0.75);
}

.kv2-mbn__item--search:hover .kv2-mbn__label {
    color: rgba(255, 255, 255, 0.6);
}

/* Active state for search (if needed for some pages) */
.kv2-mbn__item--search.kv2-mbn__item--active .kv2-mbn__icon {
    stroke: rgba(139, 44, 44, 0.9);
}

.kv2-mbn__item--search.kv2-mbn__item--active .kv2-mbn__label {
    color: rgba(139, 44, 44, 0.85);
}

/* ============================================
   PLAYER OFFSET - Space above mobile nav
   ============================================ */

@media (max-width: 768px) {
    .global-player-container {
        bottom: var(--mobile-nav-height, 0px) !important;
    }
}

/* ============================================
   CONTENT SAFETY SPACING
   Prevents footer/hidden content behind nav
   ============================================ */

@media (max-width: 768px) {
    /* Main content bottom padding */
    .main-content {
        padding-bottom: 18px;
    }
    
    /* Footer offset */
    .footer {
        margin-bottom: 0;
    }
    
    /* Playlist page safety */
    .playlist-songs-section {
        margin-bottom: 20px;
    }
    
    /* Blog page safety */
    .blog-preview-section {
        margin-bottom: 20px;
    }
    
    /* Music page safety */
    .music-grid-section {
        margin-bottom: 20px;
    }
}

/* ============================================
   LANDSCAPE MODE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
    .kv2-mbn__container {
        padding: 6px 20px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }
    
    .kv2-mbn__item {
        padding: 6px 2px; /* Reduced padding for 5 items in landscape */
    }

    .kv2-mbn__app-prompt {
        display: none;
    }

    .kv2-mbn__icon-wrapper {
        width: 20px;
        height: 20px;
    }
    
    .kv2-mbn__icon,
    .kv2-mbn__avatar,
    .kv2-mbn__avatar-initial {
        width: 18px;
        height: 18px;
    }
    
    .kv2-mbn__label {
        font-size: 9px;
    }
    
    .kv2-mbn__notification-badge {
        top: -6px;
        right: -8px;
        min-width: 15px;
        height: 15px;
        font-size: 9px;
        padding: 0 4px;
    }
    
    .main-content {
        padding-bottom: 14px;
    }
    
    /* Tighter gap for landscape with 5 items */
    .kv2-mbn__nav {
        gap: 2px;
    }
}

/* ============================================
   REDUCED MOTION SUPPORT
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .kv2-mbn,
    .kv2-mbn__item,
    .kv2-mbn__icon,
    .kv2-mbn__avatar,
    .kv2-mbn__label,
    .kv2-mbn__notification-badge,
    .global-player-container {
        transition: none !important;
    }
    
    .kv2-mbn {
        opacity: 1;
        transform: translateY(0);
    }
    
    .kv2-mbn__item:hover .kv2-mbn__notification-badge {
        transform: none;
    }
}

/* ============================================
   DARK/AMBIENT BACKGROUND COMPATIBILITY
   Preserves cinematic feel
   ============================================ */

.kv2-mbn {
    background: rgba(12, 12, 16, 0.92);
}

/* Subtle glow when ambient is active */
.ambient-glow-layer ~ .kv2-mbn {
    border-top-color: rgba(255, 255, 255, 0.08);
}
