* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

:root {
    --bg: #080b12;
    --panel: #111827;
    --panel-soft: #151e2d;
    --panel-deep: #0d1320;
    --line: rgba(255, 255, 255, 0.08);
    --text: #f8fafc;
    --muted: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --success: #22c55e;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(99, 102, 241, 0.16), transparent 34rem),
        linear-gradient(180deg, #090d16 0%, var(--bg) 45%, #070a11 100%);
    color: var(--text);
    overflow-x: hidden;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 900;
    width: calc(100% - 250px);
    min-height: 72px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 12px 28px;
    background: rgba(8, 11, 18, 0.82);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line);
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: clamp(20px, 2.4vw, 28px);
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0;
    white-space: nowrap;
}

.app-logo::before {
    content: "";
    width: 11px;
    height: 11px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow-x: auto;
}

.app-nav a {
    text-decoration: none;
    color: var(--muted);
    padding: 9px 15px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease;
}

.app-nav a:hover,
.app-nav a.active {
    background: var(--text);
    color: #0f172a;
}

.app-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-search {
    display: flex;
    align-items: center;
    width: min(260px, 24vw);
    background: var(--panel-deep);
    border: 1px solid var(--line);
    border-radius: 999px;
    overflow: hidden;
}

.app-search input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    padding: 12px 14px;
    font-size: 14px;
}

.app-search button {
    width: 44px;
    height: 44px;
    border: none;
    cursor: pointer;
    background: transparent;
    color: var(--muted);
}

.theme-toggle {
    width: 46px;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.18s ease, color 0.18s ease;
}

.theme-toggle:hover {
    background: var(--accent);
    color: #fff;
}

.app-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1000;
    width: 250px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    overflow-y: auto;
    background: rgba(9, 13, 22, 0.94);
    border-left: 1px solid var(--line);
}

.app-profile-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    margin-bottom: 18px;
    background: var(--panel-deep);
    border: 1px solid var(--line);
    border-radius: 18px;
}

.app-profile-img {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.18);
}

.app-profile-info {
    min-width: 0;
}

.app-profile-info h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-profile-info span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.app-logout-btn {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 999px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.app-logout-btn:hover {
    background: var(--accent-hover);
    color: #fff;
}

.app-menu-title {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    margin: 18px 8px 12px;
    text-transform: uppercase;
}

.app-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--muted);
    padding: 12px 13px;
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 700;
    transition: background 0.18s ease, color 0.18s ease;
}

.app-menu-item:hover,
.app-menu-item.active {
    background: rgba(99, 102, 241, 0.13);
    color: var(--text);
}

.app-menu-divider {
    width: 100%;
    height: 1px;
    background: var(--line);
    margin: 16px 0;
}

.app-main {
    width: calc(100% - 250px);
    padding: 24px 28px 32px;
}

body.light-mode {
    --bg: #e5e7eb;
    --panel: #ffffff;
    --panel-soft: #f1f5f9;
    --panel-deep: #f8fafc;
    --line: rgba(15, 23, 42, 0.12);
    --text: #0f172a;
    --muted: #475569;
    background: #e5e7eb;
}

.light-mode .app-header,
.light-mode .app-sidebar {
    background: rgba(248, 250, 252, 0.9);
}

@media (max-width: 1200px) {
    .app-sidebar {
        display: none;
    }

    .app-header,
    .app-main {
        width: 100%;
    }
}

@media (max-width: 950px) {
    .app-header {
        height: auto;
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
    }

    .app-nav,
    .app-header-actions,
    .app-search {
        width: 100%;
    }

    .app-main {
        padding: 16px;
    }
}

@media (max-width: 900px) {
    body {
        padding-bottom: 78px;
    }

    .app-header {
        position: sticky;
        top: 0;
        z-index: 1100;
        min-height: 62px;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        background: rgba(8, 11, 18, 0.94);
    }

    .app-logo {
        font-size: 22px !important;
        min-width: 0;
    }

    .app-logo::before {
        width: 9px;
        height: 9px;
        box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.12);
    }

    .app-header-actions {
        justify-content: flex-end;
        width: auto;
        min-width: 0;
    }

    .people-search {
        width: 42px !important;
    }

    .people-search input {
        width: 42px;
        height: 42px;
        min-height: 42px;
        padding: 0;
        color: transparent;
        cursor: pointer;
    }

    .people-search:focus-within {
        position: fixed;
        left: 12px;
        right: 12px;
        top: 70px;
        z-index: 1002;
        width: auto !important;
    }

    .people-search:focus-within input {
        width: 100%;
        color: #fff;
        padding: 0 42px 0 14px;
    }

    .pwa-install-btn {
        min-height: 42px !important;
        width: 42px;
        padding: 0 !important;
        border-radius: 999px !important;
        font-size: 0 !important;
    }

    .pwa-install-btn i {
        font-size: 15px;
    }

    .app-nav {
        display: none;
    }

    .app-nav a {
        min-width: 0;
        display: grid;
        place-items: center;
        min-height: 48px;
        padding: 0 4px;
        border-radius: 16px;
        font-size: 11px;
        line-height: 1.1;
        text-align: center;
        white-space: normal;
    }

    .app-nav a.active {
        background: rgba(99, 102, 241, 0.22);
        color: #fff;
    }

    .app-main,
    .main,
    .music-page,
    .details-main,
    .profile-main,
    .messages-main,
    .person-main,
    .browse-main,
    .artist-main {
        padding-bottom: 92px !important;
    }
}

/* ===== RAEPLAY MOBILE NAV FIX ===== */
.mobile-login-btn{
    display:none !important;
}

@media (max-width: 900px){
    body{
        padding-bottom:86px !important;
    }

    .app-header{
        position:sticky !important;
        top:0 !important;
        z-index:5000 !important;
        width:100% !important;
        min-height:62px !important;
        display:flex !important;
        flex-direction:row !important;
        align-items:center !important;
        justify-content:space-between !important;
        padding:10px 14px !important;
    }

    .app-logo{
        font-size:22px !important;
        color:#fff !important;
        text-decoration:none !important;
    }

    .app-header-actions{
        display:none !important;
    }

    .app-nav{
        position:fixed !important;
        left:10px !important;
        right:10px !important;
        bottom:10px !important;
        z-index:999999 !important;
        width:auto !important;
        min-height:62px !important;
        display:grid !important;
        grid-template-columns:repeat(5, 1fr) !important;
        align-items:center !important;
        gap:4px !important;
        padding:8px !important;
        border-radius:22px !important;
        background:rgba(8, 11, 18, .96) !important;
        border:1px solid rgba(255,255,255,.10) !important;
        box-shadow:0 18px 45px rgba(0,0,0,.45) !important;
        backdrop-filter:blur(18px) !important;
        overflow:visible !important;
        pointer-events:auto !important;
    }

    .app-nav a{
        display:flex !important;
        align-items:center !important;
        justify-content:center !important;
        min-width:0 !important;
        min-height:46px !important;
        padding:0 4px !important;
        border-radius:16px !important;
        color:#94a3b8 !important;
        text-decoration:none !important;
        font-size:11px !important;
        font-weight:800 !important;
        line-height:1.1 !important;
        text-align:center !important;
        white-space:normal !important;
        pointer-events:auto !important;
    }

    .app-nav a.active{
        background:rgba(99, 102, 241, .24) !important;
        color:#fff !important;
    }

    .app-main,
    .main,
    .music-page,
    .details-main,
    .profile-main,
    .messages-main,
    .person-main,
    .browse-main,
    .artist-main{
        width:100% !important;
        padding-bottom:100px !important;
    }
}
@media(max-width:900px){

    .app-sidebar{
        display:none !important;
    }

    .app-profile-box{
        display:none !important;
    }

    .app-header .app-profile-box{
        display:none !important;
    }

    .app-main,
    .main,
    .music-page,
    .details-main,
    .profile-main,
    .messages-main,
    .person-main,
    .browse-main,
    .artist-main{
        width:100% !important;
    }
}

/* ===== FINAL MOBILE FIX: sidebar should not block mobile content ===== */
@media (max-width: 900px) {
    .app-sidebar {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .app-mobile-bottom-nav {
        display: grid !important;
        grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    }
}
