/* assets/css/app.css */

/* 1. KOYU TEMA (Logodaki Gece Laciverti ve Elektrik Mavisi Uyumu) */
:root,
html[data-theme="dark"] {
    --bg-body: #050814; /* Logodaki en koyu lacivert/siyah tonu */
    --bg-gradient: radial-gradient(circle at 15% 10%, #0f172a 0%, #050814 65%);
    --bg-surface: rgba(15, 23, 42, 0.75);
    --bg-elevated: rgba(30, 41, 59, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent: #2563eb; /* Logodaki Elektrik Mavisi */
    --accent-hover: #1d4ed8;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* 2. AÇIK TEMA (Ferah Gün Işığı Modu) */
html[data-theme="light"] {
    --bg-body: #dff2ff;
    --bg-gradient: radial-gradient(circle at 15% 10%, #e0e7ff 0%, #f4f6f9 65%);
    --bg-surface: rgba(255, 255, 255, 0.82);
    --bg-elevated: #ffffff;
    --border-color: rgba(15, 23, 42, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #2563eb; /* Logodaki Elektrik Mavisi */
    --accent-hover: #1d4ed8;
    --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    background-color: var(--bg-body);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    padding-bottom: 0;
    transition: background-color 0.25s ease, color 0.25s ease, padding-bottom 0.2s ease;
}

/* Sadece Player Açıldığında Alt Boşluk Bırak */
body:has(.bm-player.player-open) {
    padding-bottom: 96px;
}

a { color: inherit; text-decoration: none; }

.bemusic-shell {
    display: flex;
    max-width: 1520px;
    margin: 0 auto;
    padding: 16px;
    gap: 20px;
    min-height: 100vh;
}

body:has(.bm-player.player-open) .bemusic-shell {
    min-height: calc(100vh - 96px);
}

.bm-sidebar, .bm-topbar, .card-panel, .bm-player, .bm-modal {
    background: var(--bg-surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}

.bm-discog-bio {
  display: -webkit-box; -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden; white-space: normal;
  color: var(--text-secondary); font-size: 0.92rem;
  line-height: 1.5; flex: 1; }

/* Sol Menü (Player kapalıyken tam boy, açılınca yukarı çekilir) */
.bm-sidebar {
    width: 250px;
    flex-shrink: 0;
    padding: 22px 16px;
    display: flex;
    flex-direction: column;
    gap: 26px;
    position: sticky;
    top: 16px;
    height: calc(100vh - 32px);
    transition: height 0.2s ease;
}

body:has(.bm-player.player-open) .bm-sidebar {
    height: calc(100vh - 120px);
}

.bm-logo { font-size: 1.4rem; display: flex; align-items: center; gap: 10px; }
.bm-logo strong { color: var(--accent); }

.bm-nav-group { display: flex; flex-direction: column; gap: 6px; }
.bm-group-title { font-size: 0.72rem; font-weight: 700; color: var(--text-secondary); padding: 0 12px 6px; letter-spacing: 0.8px; }
.bm-nav-link {
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.bm-nav-link:hover, .bm-nav-link.active {
    background: rgba(16, 185, 129, 0.14);
    color: var(--text-primary);
}

.bm-guest-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Sağ Ana Bölge & Üst Bar */
.bm-main { flex: 1; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.bm-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    position: sticky;
    top: 16px;
    z-index: 40;
    gap: 16px;
}

.bm-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 99px;
    padding: 8px 16px;
    width: 100%;
    max-width: 440px;
}
.bm-search-wrap input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    margin-left: 10px;
    outline: none;
    font-size: 0.95rem;
}

.bm-topbar-actions { display: flex; align-items: center; gap: 12px; }

/* 3'lü Tema Seçici */
.theme-switcher {
    display: flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 99px;
    padding: 3px;
    gap: 2px;
}
.theme-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 99px;
    font-size: 0.9rem;
    opacity: 0.55;
    transition: all 0.2s;
}
.theme-btn.active {
    background: var(--accent);
    opacity: 1;
}

/* Butonlar */
.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 18px;
    border-radius: 99px;
    font-weight: 600;
    cursor: pointer;
}
.w-100 { width: 100%; }

/* Alt Player */
.bm-player {
    position: fixed;
    bottom: 12px; left: 16px; right: 16px;
    height: 76px;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}
.bm-player-left { display: flex; align-items: center; gap: 12px; width: 28%; }
.bm-player-left img { width: 50px; height: 50px; border-radius: 10px; object-fit: cover; cursor: pointer; }
.p-title { font-weight: 700; font-size: 0.95rem; cursor: pointer; transition: color 0.2s; }
.p-title:hover { color: var(--accent); }
.p-artist { font-size: 0.82rem; color: var(--text-secondary); }
.bm-player-center { width: 44%; max-width: 520px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bm-controls { display: flex; align-items: center; gap: 18px; }
.bm-icon-btn { background: transparent; border: none; color: var(--text-primary); font-size: 1.1rem; cursor: pointer; }
.bm-play-circle { width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--accent); color: #fff; cursor: pointer; }
.bm-timeline { display: flex; align-items: center; gap: 10px; width: 100%; font-size: 0.75rem; color: var(--text-secondary); }
.bm-timeline input, .bm-player-right input { flex: 1; accent-color: var(--accent); cursor: pointer; }
.bm-player-right { display: flex; align-items: center; gap: 10px; width: 22%; justify-content: flex-end; }
.bm-pill-btn { background: var(--bg-elevated); color: var(--text-primary); border: 1px solid var(--border-color); padding: 6px 12px; border-radius: 99px; cursor: pointer; font-size: 0.8rem; transition: all 0.2s ease; }
#p-lyrics-btn.has-lyrics,
.bm-pill-btn.has-lyrics { border-color: #22c55e !important; color: #22c55e !important; box-shadow: 0 0 8px rgba(34, 197, 94, 0.25); }
#floating-video-box {
    position: fixed;
    bottom: 98px;
    right: 20px;
    width: 300px;
    height: 175px;
    background: #000;
    border-radius: 12px;
    border: 2px solid var(--accent);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
    z-index: 9999;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

#bm-queue-drawer {
    position: fixed;
    bottom: 98px;
    right: 20px;
    width: 300px;
    max-width: calc(100vw - 32px);
    max-height: min(440px, calc(100vh - 194px));
    max-height: min(440px, calc(100dvh - 194px));
    z-index: 9998;
    flex-direction: column;
    padding: 16px;
    margin-bottom: 0 !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--border-color);
    transition: bottom 0.22s ease, max-height 0.22s ease;
}

/* Video açıkken kuyruk penceresini video ile üst sabit bar (topbar) arasına oturt */
body.video-pip-open #bm-queue-drawer {
    bottom: 283px;
    max-height: calc(100vh - 379px);
    max-height: calc(100dvh - 379px);
}

#bm-queue-list {
    min-height: 0;
}
/* Üyelik Modalı */
.bm-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.bm-modal-backdrop[hidden] { display: none !important; }
.bm-modal { width: 100%; max-width: 420px; padding: 32px; position: relative; background: var(--bg-elevated); }
.bm-modal-close { position: absolute; top: 16px; right: 16px; background: transparent; border: none; color: var(--text-secondary); font-size: 1.2rem; cursor: pointer; }
.bm-modal-header h2 { margin-bottom: 6px; }
.bm-modal-header p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; }
.bm-social-buttons { display: flex; flex-direction: column; gap: 10px; }
.btn-social {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 12px; border-radius: 12px; font-weight: 600;
    border: 1px solid var(--border-color); background: var(--bg-surface);
}
.bm-divider { text-align: center; margin: 18px 0; color: var(--text-secondary); font-size: 0.82rem; }
#auth-form { display: flex; flex-direction: column; gap: 12px; }
#auth-form input { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-primary); }

/* Canlı Arama Açılır Penceresi (Düzeni Bozmaması İçin Havada Asılı Kalır) */
.bm-search-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    width: 100%;
    min-width: 320px;
    max-height: 420px;
    overflow-y: auto;
    background: #0f172a !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 16px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.75);
    z-index: 999;
    padding: 6px 0;
}

html[data-theme="light"] .bm-search-dropdown {
    background: #ffffff !important;
    border-color: rgba(15, 23, 42, 0.12);
}

.bm-search-dropdown[hidden] {
    display: none !important;
}

.bm-search-dropdown a:hover {
    background: rgba(16, 185, 129, 0.1);
}

/* =========================================
   MOBİL EKRAN DÜZELTMELERİ (MAX 768PX)
========================================= */
.show-on-mobile { display: none !important; }

@media (max-width: 768px) {
    html, body { overflow-x: hidden !important; max-width: 100vw; }
    .hide-on-mobile { display: none !important; }
    .show-on-mobile { display: inline-flex !important; }

    .bemusic-shell { flex-direction: column; padding: 10px; }
  
  .bm-main { margin-top: -20px !important; }

    /* 1. ÜST BAR: Solda ufak logo, Ortada arama, Sağda hamburger */
    .bm-topbar {
        position: relative;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 8px 12px !important;
    }
    .bm-mobile-logo {
        font-size: 14px; width: 24px; height: 24px;
        align-items: center; justify-content: center;
        text-decoration: none; flex-shrink: 0;
    }
    .bm-search-wrap {
        flex: 1 !important; min-width: 0 !important; margin: 0 !important;
    }
    .bm-hamburger {
        background: none; border: none; font-size: 22px;
        color: var(--text-primary); cursor: pointer;
        padding: 0 4px; flex-shrink: 0;
    }

    /* 2. HAMBURGER AÇILIR KUTUSU (Sadece Tema ve Giriş/Kayıt barındırır) */
    #bm-mobile-menu.bm-topbar-actions {
        display: none !important;
        position: absolute;
        top: 100%; right: 12px;
        background: #0f172a !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 12px;
        padding: 14px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        z-index: 9999;
        box-shadow: 0 14px 36px rgba(0, 0, 0, 0.75);
        min-width: 210px;
    }
    html[data-theme="light"] #bm-mobile-menu.bm-topbar-actions {
        background: #ffffff !important;
        border-color: rgba(15, 23, 42, 0.12);
    }
    #bm-mobile-menu.bm-topbar-actions.open {
        display: flex !important;
    }
    #bm-mobile-menu .theme-switcher {
        justify-content: center;
    }

    /* 3. ALTTAKİ SABİT MENÜ: Asıl yerinde kalır (Yazı Üstte, İkon Altta) */
    .bm-sidebar {
        position: fixed;
        bottom: 0; left: 0; right: 0; top: auto;
        width: 100%; height: 60px !important;
        border-radius: 0; z-index: 95;
        flex-direction: row; align-items: center; justify-content: space-around;
        padding: 0 4px;
        border-top: 1px solid var(--border-color);
        background: var(--bg-surface);
    }
    .bm-brand, .bm-group-title, .bm-guest-card { display: none !important; }
    .bm-nav-group { flex-direction: row; width: 100%; justify-content: space-around; }
    
    .bm-sidebar .bm-nav-link {
        display: flex !important;
        flex-direction: column-reverse !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 3px !important;
        font-size: 11px !important;
        padding: 6px 2px !important;
        text-align: center !important;
        background: transparent !important;
    }
    .bm-sidebar .nav-ico {
        font-size: 16px;
        line-height: 1;
    }

    /* 4. SANATÇI KARTLARI: Mobilde Tekli Değil, Çift (2'li) Dizilir */
    .artist-grid,
    div[style*="minmax(160px"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    /* 5. MÜZİKÇALAR: İlk şarkı ▶ Play ile başlayana kadar kesin olarak kapalı tut */
    #bm-player-bar:not(.player-open),
    .bm-player:not(.player-open) {
        display: none !important;
    }
    .bm-player.player-open { 
        bottom: 60px; left: 0; right: 0;
        height: auto !important;
        padding: 6px 12px !important;
        border-radius: 12px 12px 0 0;
        display: grid !important;
        grid-template-columns: 34px auto 1fr auto 28px !important;
        grid-template-rows: auto auto !important;
        align-items: center !important;
        column-gap: 8px !important;
        row-gap: 4px !important;
    }
    .bm-player-left, .bm-player-center, .bm-player-right, .bm-timeline {
        display: contents !important;
    }
    #p-like-btn, #p-seek, #p-vol {
        display: none !important;
    }

    /* ÜST SATIR SOL: Sanatçı - Şarkı (Sola Kayan Yazı + Sol Padding) */
    .bm-player-meta {
        grid-column: 1 / 4;
        grid-row: 1;
        overflow: hidden;
        white-space: nowrap;
        width: 100%;
        padding-left: 6px !important;
    }

    /* ÜST SATIR SAĞ SOLU: Kuyruk ve Mikrofon İkonu Yanyana */
    #p-queue-btn {
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
        margin-right: 28px; /* Mikrofonun soluna iter */
        background: transparent !important;
        border: none !important;
        padding: 0 8px 0 0 !important;
        color: var(--text-primary) !important;
        font-size: 0.85rem !important;
    }
    #p-lyrics-btn {
        grid-column: 4;
        grid-row: 1;
        justify-self: end;
        background: transparent !important;
        border: 1px solid transparent !important;
        border-radius: 6px !important;
        padding: 2px 4px !important;
        font-size: 0 !important;
        line-height: 1;
    }
    #p-lyrics-btn.has-lyrics {
        border-color: #22c55e !important;
        background: rgba(34, 197, 94, 0.12) !important;
    }
    #p-lyrics-btn::before {
        content: "🎤";
        font-size: 0.95rem !important;
    }

    /* Mobilde Player Kapalıyken Sadece Alt Menü (45px) Kadar, Açılınca Player Kadar (115px) Boşluk Ver */
    body { padding-bottom: 45px !important; }
    body:has(.bm-player.player-open) { padding-bottom: 115px !important; }
    .bm-content { padding-bottom: 0 !important; }
    .bm-discog-bio { -webkit-line-clamp: 2 !important; }
  
    .bm-marquee-track {
        display: inline-flex;
        flex-direction: row-reverse;
        align-items: center;
        animation: bm-marquee 12s linear infinite;
    }
    .bm-marquee-track .p-artist::after {
        content: " - ";
        white-space: pre;
    }
    .bm-marquee-track .p-title, .bm-marquee-track .p-artist {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        color: var(--text-primary) !important;
    }
    @keyframes bm-marquee {
        0%, 15% { transform: translateX(0%); }
        100% { transform: translateX(-100%); }
    }

    /* ÜST SATIR EN SAĞ: Sade Video İkonu */
    #p-video-btn {
        grid-column: 5;
        grid-row: 1;
        justify-self: end;
        background: transparent !important;
        border: none !important;
        padding: 0 !important;
        font-size: 0.95rem !important;
        line-height: 1;
    }

    /* ALT SATIR: [Mini Resim] [0:20] [Geri-Play-İleri] [3:45] [Ses/Mute] */
    #p-cover {
        grid-column: 1; grid-row: 2;
        width: 32px !important; height: 32px !important;
        border-radius: 6px !important;
    }
    #p-cur {
        grid-column: 2; grid-row: 2;
        font-size: 0.75rem !important; color: var(--text-secondary);
    }
    .bm-controls {
        grid-column: 3; grid-row: 2;
        justify-self: center;
        display: flex !important; align-items: center; gap: 14px !important;
    }
    .bm-play-circle {
        width: 32px !important; height: 32px !important; font-size: 0.85rem !important;
    }
    #p-dur {
        grid-column: 4; grid-row: 2;
        font-size: 0.75rem !important; color: var(--text-secondary);
    }
    .bm-vol-icon {
        grid-column: 5; grid-row: 2;
        justify-self: end;
        font-size: 1rem !important;
    }

    /* Mobilde içeriğin kenarlara yapışmasını engeller */
    .card-panel {
        padding: 16px !important;
        margin-bottom: 16px !important;
    }

    /* Mobilde Yüzen Video ve Kuyruk Pencereleri: Player'ın Tam Üst Sınırının Dışında Açılır */
    #floating-video-box {
        bottom: 136px;
        right: 10px;
        width: 240px;
        height: 155px;
    }

    #bm-queue-drawer {
        bottom: 136px;
        right: 10px;
        width: 340px;
        max-width: calc(100vw - 20px);
        max-height: min(360px, calc(100vh - 206px));
        max-height: min(360px, calc(100dvh - 206px));
        margin-bottom: 0 !important;
    }

    /* Mobilde video açıkken kuyruk penceresi videonun tam üstünde açılır */
    body.video-pip-open #bm-queue-drawer {
        bottom: 299px;
        max-height: calc(100vh - 369px);
        max-height: calc(100dvh - 369px);
    }
}

/* =========================================
   SANATÇI KARTI (SPOTIFY TARZI HOVER + PLAY)
========================================= */
.bm-artist-card {
    padding: 16px !important;
    margin: 0 !important;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.bm-artist-card:hover {
    background: rgba(30, 41, 59, 0.96);
    border-color: rgba(255, 255, 255, 0.16);
}
html[data-theme="light"] .bm-artist-card:hover {
    background: rgba(219, 234, 254, 0.3);
    border-color: rgba(37, 99, 235, 0.1);
}
.bm-artist-avatar-wrap {
    position: relative;
    width: 104px;
    height: 104px;
    margin-bottom: 10px;
    flex-shrink: 0;
}
.bm-artist-avatar-link {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}
.bm-artist-avatar-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.bm-artist-play-btn {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(8px) scale(0.92);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.22s ease, background-color 0.15s ease;
}
.bm-artist-card:hover .bm-artist-play-btn,
.bm-artist-card:focus-within .bm-artist-play-btn,
.bm-artist-play-btn.is-loading {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.bm-artist-play-btn:hover {
    background: var(--accent-hover);
    transform: translateY(0) scale(1.07);
}
.bm-artist-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bm-artist-role {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

@media (hover: none), (max-width: 768px) {
    .bm-artist-card {
        margin: 0 !important;
    }
    .bm-artist-play-btn {
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
        width: 34px !important;
        height: 34px !important;
        font-size: 0.82rem !important;
    }
}