/* ═══════════════════════════════════════════════════════════
   SPOTIFY STATS — Production UI
   Fonts: Bebas Neue (display) + DM Sans (body)
═══════════════════════════════════════════════════════════ */

/* ── VARIABLES ── */
:root {
    --green:        #1DB954;
    --green-bright: #1ed760;
    --green-dim:    rgba(29,185,84,0.15);
    --green-glow:   rgba(29,185,84,0.25);
    --bg:           #0b0b0b;
    --bg-2:         #111111;
    --surface:      #161616;
    --surface-2:    #1c1c1c;
    --surface-3:    #242424;
    --border:       rgba(255,255,255,0.07);
    --border-light: rgba(255,255,255,0.12);
    --text-1:       #ffffff;
    --text-2:       #a8a8a8;
    --text-3:       #555555;
    --red:          #e91429;
    --radius-sm:    8px;
    --radius-md:    12px;
    --radius-lg:    18px;
    --radius-xl:    24px;
    --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
    --shadow-md:    0 4px 20px rgba(0,0,0,0.5);
    --shadow-lg:    0 8px 40px rgba(0,0,0,0.6);
    --shadow-green: 0 0 0 1px rgba(29,185,84,0.35), 0 8px 32px rgba(0,0,0,0.6);
    --ease:         cubic-bezier(0.4,0,0.2,1);
    --dur:          0.22s;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text-1);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

/* ═══════════════════════════
   HEADER
═══════════════════════════ */
#main-header {
    position: sticky;
    top: 0;
    z-index: 200;
    width: 100%;
    background: rgba(11,11,11,0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 40px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    user-select: none;
}

.brand-icon { width: 28px; height: 28px; flex-shrink: 0; }

.brand-text {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 22px;
    letter-spacing: 2px;
    color: var(--text-1);
}

.header-right { display: flex; align-items: center; gap: 12px; }
.header-user  { display: flex; align-items: center; gap: 10px; }

.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--green);
}

.header-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ═══════════════════════════
   BUTTONS
═══════════════════════════ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.2px;
    border: none;
    border-radius: 500px;
    cursor: pointer;
    transition: background var(--dur) var(--ease),
                transform var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease),
                color var(--dur) var(--ease);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--green);
    color: #000;
    padding: 10px 22px;
}
.btn-primary:hover {
    background: var(--green-bright);
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(29,185,84,0.35);
}

.btn-ghost {
    background: transparent;
    color: var(--text-2);
    padding: 9px 18px;
    border: 1px solid var(--border-light);
}
.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text-1);
    border-color: var(--border-light);
}

.btn-sm { font-size: 13px; padding: 7px 14px; }
.btn-lg { font-size: 16px; padding: 14px 32px; }

/* ═══════════════════════════
   LOGIN SCREEN
═══════════════════════════ */
.login-screen {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.login-hero {
    position: relative;
    text-align: center;
    max-width: 560px;
}

.login-hero-glow {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    width: 500px;
    height: 400px;
    background: radial-gradient(ellipse at center, rgba(29,185,84,0.14) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
}

.login-title {
    position: relative;
    z-index: 1;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(56px, 9vw, 96px);
    letter-spacing: 3px;
    line-height: 1;
    color: var(--text-1);
    margin-bottom: 20px;
}
.login-title em { color: var(--green); font-style: normal; }

.login-sub {
    position: relative;
    z-index: 1;
    font-size: 17px;
    color: var(--text-2);
    max-width: 420px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

/* ═══════════════════════════
   PAGE LAYOUT
═══════════════════════════ */
.page-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 40px 100px;
}

.content-section { margin-bottom: 60px; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.section-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 32px;
    letter-spacing: 2px;
    color: var(--text-1);
    position: relative;
    padding-left: 16px;
}
.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 65%;
    background: var(--green);
    border-radius: 2px;
}

.section-actions { display: flex; gap: 8px; }

/* ═══════════════════════════
   PROFILE
═══════════════════════════ */
.profile-section {
    position: relative;
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 40px 48px;
    margin-bottom: 32px;
    background: linear-gradient(135deg, #0f2218 0%, var(--surface) 50%, var(--bg-2) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.profile-section::before {
    content: '';
    position: absolute;
    top: -100px;
    left: -60px;
    width: 400px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(29,185,84,0.10) 0%, transparent 65%);
    pointer-events: none;
}

.profile-section::after {
    content: '';
    position: absolute;
    bottom: -40px;
    right: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(ellipse, rgba(29,185,84,0.05) 0%, transparent 70%);
    pointer-events: none;
}

.profile-avatar {
    position: relative;
    flex-shrink: 0;
    z-index: 1;
}

.profile-avatar img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--green);
    box-shadow: 0 0 0 6px rgba(29,185,84,0.12), var(--shadow-md);
    display: block;
}

.profile-avatar-placeholder {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 3px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

.profile-info {
    z-index: 1;
    flex: 1;
    min-width: 0;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--green);
    margin-bottom: 8px;
}

.profile-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(28px, 4vw, 48px);
    letter-spacing: 1.5px;
    color: var(--text-1);
    line-height: 1.1;
    margin-bottom: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.profile-meta-item {
    font-size: 13px;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 5px;
}

.profile-meta-item span { color: var(--text-1); font-weight: 600; }

.profile-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 500px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.profile-type-badge.premium {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
}
.profile-type-badge.free {
    background: var(--surface-3);
    color: var(--text-2);
}

/* ═══════════════════════════
   TIME RANGE SELECTOR
═══════════════════════════ */
.time-range-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 40px;
    padding: 16px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.time-range-label {
    font-size: 13px;
    color: var(--text-3);
    font-weight: 500;
    white-space: nowrap;
}

.time-range-pills { display: flex; gap: 8px; flex-wrap: wrap; }

.pill {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: 500px;
    padding: 6px 16px;
    cursor: pointer;
    transition: all var(--dur) var(--ease);
}

.pill:hover { background: var(--surface-2); color: var(--text-1); }

.pill.active {
    background: var(--green);
    color: #000;
    border-color: var(--green);
}

/* ═══════════════════════════
   CARD GRID
═══════════════════════════ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
}

.artist-card,
.track-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 12px 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    box-shadow: var(--shadow-sm);
    opacity: 0;
    animation: fadeUp 0.4s var(--ease) forwards;
    transition: transform var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease),
                border-color var(--dur) var(--ease);
}

.artist-card:hover,
.track-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-green);
    border-color: rgba(29,185,84,0.4);
}

.artist-card:nth-child(1),  .track-card:nth-child(1)  { animation-delay: .04s }
.artist-card:nth-child(2),  .track-card:nth-child(2)  { animation-delay: .08s }
.artist-card:nth-child(3),  .track-card:nth-child(3)  { animation-delay: .12s }
.artist-card:nth-child(4),  .track-card:nth-child(4)  { animation-delay: .16s }
.artist-card:nth-child(5),  .track-card:nth-child(5)  { animation-delay: .20s }
.artist-card:nth-child(6),  .track-card:nth-child(6)  { animation-delay: .24s }
.artist-card:nth-child(7),  .track-card:nth-child(7)  { animation-delay: .28s }
.artist-card:nth-child(8),  .track-card:nth-child(8)  { animation-delay: .32s }
.artist-card:nth-child(9),  .track-card:nth-child(9)  { animation-delay: .36s }
.artist-card:nth-child(10), .track-card:nth-child(10) { animation-delay: .40s }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.card-rank {
    position: absolute;
    top: 10px;
    left: 10px;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 13px;
    letter-spacing: 1px;
    color: var(--green);
    background: rgba(0,0,0,0.55);
    padding: 2px 6px;
    border-radius: 4px;
}

.artist-card img,
.track-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--surface-3);
    display: block;
}

.artist-card img { border-radius: 50%; }

.card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-1);
    text-align: center;
    width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

.card-sub {
    font-size: 12px;
    color: var(--text-2);
    text-align: center;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ═══════════════════════════
   RECENTLY PLAYED
═══════════════════════════ */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--dur) var(--ease),
                border-color var(--dur) var(--ease),
                transform var(--dur) var(--ease);
    color: inherit;
}

.recent-item:hover {
    background: var(--surface-2);
    border-color: var(--border-light);
    transform: translateX(4px);
}

.recent-num {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 15px;
    letter-spacing: 1px;
    color: var(--text-3);
    min-width: 24px;
    text-align: center;
}

.recent-img {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--surface-3);
}

.recent-info { flex: 1; min-width: 0; }

.recent-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-1);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.recent-artist {
    font-size: 12px;
    color: var(--text-2);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.recent-time {
    font-size: 12px;
    color: var(--text-3);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ═══════════════════════════
   SEARCH
═══════════════════════════ */
.search-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 20px;
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    color: var(--text-1);
    outline: none;
    transition: border-color var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}

.search-input::placeholder { color: var(--text-3); }

.search-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(29,185,84,0.12);
}

.search-type-pills { display: flex; gap: 8px; }

.search-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 12px 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    transition: transform var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease),
                border-color var(--dur) var(--ease);
    text-decoration: none;
}

.search-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-green);
    border-color: rgba(29,185,84,0.4);
}

.search-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--surface-3);
}

.search-card.artist-type img { border-radius: 50%; }

/* ═══════════════════════════
   LOADING SKELETON
═══════════════════════════ */
.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position:   0% 50%; }
}

.skeleton-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 12px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
}

.skeleton-img     { width: 100%; aspect-ratio: 1; border-radius: var(--radius-sm); }
.skeleton-line    { height: 12px; width: 80%; }
.skeleton-line-sm { height: 10px; width: 55%; }

/* ═══════════════════════════
   TOAST
═══════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-1);
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    animation: toastIn 0.3s var(--ease) forwards;
    max-width: 340px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red);   }
.toast-icon    { font-size: 18px; flex-shrink: 0; }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0)    scale(1);    }
    to   { opacity: 0; transform: translateY(8px)  scale(0.97); }
}

/* ═══════════════════════════
   MODAL
═══════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: var(--surface-2);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 36px 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    animation: fadeUp 0.3s var(--ease) forwards;
}

.modal-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

.modal-body {
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ═══════════════════════════
   EMPTY STATE
═══════════════════════════ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-3);
    font-size: 14px;
}

.empty-state-icon { font-size: 36px; margin-bottom: 10px; }

/* ═══════════════════════════
   RESPONSIVE
═══════════════════════════ */
@media (max-width: 860px) {
    .header-inner   { padding: 0 20px; }
    .page-wrap      { padding: 24px 20px 60px; }
    .card-grid      { grid-template-columns: repeat(3, 1fr); }
    .profile-section { flex-direction: column; text-align: center; padding: 32px 24px; }
    .profile-meta   { justify-content: center; }
}

@media (max-width: 520px) {
    .card-grid      { grid-template-columns: repeat(2, 1fr); }
    .time-range-bar { flex-direction: column; align-items: flex-start; }
}