/**
 * KalviYogi Premium App UI
 * Spotify-like sidebar and header design
 */

/* ============================================
   DESKTOP SIDEBAR (Icon-only)
   ============================================ */
.app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 72px;
    background: linear-gradient(180deg, #0a0a0f 0%, #111827 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    z-index: 1000;
    transition: width 0.3s ease;
}

@media (max-width: 768px) {
    .app-sidebar {
        display: none;
    }
}

.app-sidebar-logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #D4AF37 0%, #A68B2C 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
    box-shadow: 0 4px 20px rgba(212, 175, 55, 0.3);
}

.app-sidebar-logo svg {
    width: 28px;
    height: 28px;
    color: #000;
}

.sidebar-logo-img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    object-fit: cover;
}

.app-sidebar-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.app-sidebar-link {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #64748b;
    transition: all 0.2s ease;
    position: relative;
}

.app-sidebar-link:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.08);
}

.app-sidebar-link.active {
    color: #D4AF37;
    background: rgba(212, 175, 55, 0.1);
}

.app-sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: #D4AF37;
    border-radius: 0 3px 3px 0;
}

.app-sidebar-link svg {
    width: 24px;
    height: 24px;
}

.app-sidebar-divider {
    width: 32px;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 16px 0;
}

/* ============================================
   PREMIUM HEADER BAR
   ============================================ */
.app-header-premium {
    position: fixed;
    top: 0;
    left: 72px;
    right: 0;
    height: 64px;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
}

@media (max-width: 768px) {
    .app-header-premium {
        left: 0;
        padding: 0 16px;
    }
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-header-logo {
    display: none;
    align-items: center;
    text-decoration: none;
}

.app-header-logo-img {
    height: 48px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
    display: block;
}

@media (max-width: 768px) {
    .app-header-logo {
        display: flex;
    }
}

/* Search Bar */
.app-header-search {
    position: relative;
    width: 320px;
}

@media (max-width: 768px) {
    .app-header-search {
        display: none;
    }
}

.app-header-search input {
    width: 100%;
    height: 42px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 21px;
    padding: 0 16px 0 44px;
    font-size: 14px;
    color: #f8fafc;
    outline: none;
    transition: all 0.2s ease;
}

.app-header-search input::placeholder {
    color: #64748b;
}

.app-header-search input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
}

.app-header-search svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #64748b;
    pointer-events: none;
}

/* Header Actions */
.app-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-header-action {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.app-header-action:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.1);
}

.app-header-action svg {
    width: 20px;
    height: 20px;
}

.app-header-action.active,
.app-header-action.premium {
    color: #D4AF37;
}

/* Theme Toggle */
.app-header-theme {
    position: relative;
}

/* Premium Badge */
.app-header-premium-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(166, 139, 44, 0.1) 100%);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 20px;
    color: #D4AF37;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.app-header-premium-badge:hover {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(166, 139, 44, 0.15) 100%);
}

.app-header-premium-badge svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* User Avatar */
.app-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(212, 175, 55, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.app-header-avatar:hover {
    border-color: #D4AF37;
    transform: scale(1.05);
}

.app-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-header-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #D4AF37 0%, #A68B2C 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: #000;
}

/* User Dropdown */
.app-header-dropdown {
    position: relative;
}

.app-header-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px;
    border-radius: 24px;
    transition: all 0.2s ease;
}

.app-header-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
}

.app-header-dropdown-arrow {
    width: 16px;
    height: 16px;
    color: #64748b;
    transition: transform 0.2s ease;
}

.app-header-dropdown.open .app-header-dropdown-arrow {
    transform: rotate(180deg);
}

.app-header-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1001;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.app-header-dropdown.open .app-header-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.app-header-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.app-header-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

.app-header-dropdown-item svg {
    width: 18px;
    height: 18px;
    color: #94a3b8;
}

.app-header-dropdown-item.danger {
    color: #ef4444;
}

.app-header-dropdown-item.danger svg {
    color: #ef4444;
}

.app-header-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 8px 0;
}

/* ============================================
   MAIN CONTENT AREA WITH SIDEBAR
   ============================================ */
.app-main-with-sidebar {
    margin-left: 72px;
    padding-top: 64px;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .app-main-with-sidebar {
        margin-left: 0;
    }
}

/* ============================================
   MOBILE BOTTOM NAV (remains same)
   ============================================ */
.app-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(10, 10, 15, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: none;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

@media (max-width: 768px) {
    .app-bottom-nav {
        display: flex;
    }

    .app-main-with-sidebar {
        padding-bottom: 80px;
    }
}

.app-bottom-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    color: #64748b;
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.app-bottom-link svg {
    width: 24px;
    height: 24px;
}

.app-bottom-link.active {
    color: #D4AF37;
}

.app-bottom-link:active {
    transform: scale(0.95);
}

/* ============================================
   HIDE OLD HEADER (when premium UI is active)
   ============================================ */
.app-header:not(.app-header-premium) {
    display: none !important;
}

/* Override old layout padding */
.app-main-with-sidebar.app-content {
    padding-top: 64px;
}

/* Adjust old header styles for mobile menu */
.mobile-menu {
    z-index: 1002;
}

.mobile-menu-overlay {
    z-index: 1001;
}