/* ============================================================
   Spotify Playlist Analyzer — Styles
   Spotify-inspired dark mode, Wrapped aesthetic
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --spotify-green: #1DB954;
    --spotify-green-light: #1ED760;
    --bg: #0A0A0A;
    --bg-elevated: #121212;
    --bg-surface: #1A1A1A;
    --bg-card: #181818;
    --bg-hover: #282828;
    --text-primary: #FFFFFF;
    --text-secondary: #B3B3B3;
    --text-muted: #535353;
    --border: #282828;
    --radius: 8px;
    --shadow: 0 4px 20px rgba(0, 0, 0, .4);
    --font: 'Inter', -apple-system, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
}

.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

.header {
    text-align: center;
    padding: 32px 0 24px;
}

.header h1 {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -.5px;
}

.header h1 span {
    color: var(--spotify-green);
}

.header p {
    color: var(--text-secondary);
    font-size: .9rem;
    margin-top: 6px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 24px;
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 200ms;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.btn-green {
    background: var(--spotify-green);
    color: #000;
}

.btn-green:hover {
    background: var(--spotify-green-light);
    transform: scale(1.04);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: .75rem;
    border-radius: 16px;
}

.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

textarea.input-area {
    width: 100%;
    min-height: 100px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .85rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    margin-bottom: 16px;
}

textarea.input-area:focus {
    border-color: var(--spotify-green);
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--spotify-green);
    line-height: 1;
}

.stat-label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 6px;
}

/* --- Chart Cards --- */
.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.chart-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 12px;
}

.chart-canvas {
    width: 100%;
    height: 180px;
}

/* --- Bar Chart (CSS) --- */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 120px;
    padding-top: 8px;
}

.bar-item {
    flex: 1;
    min-width: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
}

.bar-fill {
    width: 100%;
    border-radius: 4px 4px 0 0;
    background: var(--spotify-green);
    transition: height 600ms ease;
}

.bar-label {
    font-size: .65rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Leaderboard --- */
.leaderboard {}

.leader-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.leader-rank {
    font-weight: 900;
    font-size: 1rem;
    color: var(--spotify-green);
    width: 30px;
    text-align: center;
}

.leader-name {
    font-weight: 600;
    flex: 1;
}

.leader-count {
    color: var(--text-muted);
    font-size: .85rem;
}

.leader-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--spotify-green);
    opacity: .3;
    margin-top: 2px;
}

/* --- Mood Badge --- */
.mood-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--spotify-green), #0d7038);
    font-weight: 800;
    font-size: 1.1rem;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px 24px;
    font-size: .85rem;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: all 200ms;
    z-index: 200;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}