/* ============================================
   LautBox Tools – Dark Mode Style
   ============================================ */

:root {
    --bg:           #0f0f1e;
    --bg-card:      #1a1a2e;
    --bg-hover:     #232342;
    --border:       #2a2a44;
    --text:         #e4e4f1;
    --muted:        #8b8b9e;
    --accent:       #6366f1;
    --accent-hover: #818cf8;
    --live:         #ef4444;
    --success:      #10b981;
    --shadow:       0 4px 20px rgba(0, 0, 0, 0.4);
    --radius:       12px;
    --transition:   0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
}

/* ===== Header ===== */
header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header h1 i {
    -webkit-text-fill-color: var(--accent);
}

.back-link {
    color: var(--muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: color var(--transition);
    font-weight: 500;
}

.back-link:hover {
    color: var(--accent-hover);
}

.status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.live-dot {
    width: 10px;
    height: 10px;
    background: var(--live);
    border-radius: 50%;
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ===== Main ===== */
main {
    flex: 1;
    padding: 2rem 0;
}

main h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}

main h2 i {
    color: var(--accent);
}

/* ===== Grid ===== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.station-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    display: block;
    cursor: pointer;
}

.station-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.station-cover {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg-hover);
    display: block;
}

.station-info {
    padding: 1rem;
}

.station-name {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
}

.station-song {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.station-artist {
    font-size: 0.875rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Current Song (Detail) ===== */
.current-song {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    align-items: center;
    box-shadow: var(--shadow);
}

.current-song img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius);
    object-fit: cover;
    box-shadow: var(--shadow);
}

.current-song .info .label {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
}

.current-song .info .song {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.current-song .info .artist {
    font-size: 1.25rem;
    color: var(--muted);
    margin-bottom: 1rem;
}

.current-song .info .meta {
    display: flex;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.875rem;
}

.current-song .info .meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* ===== History ===== */
.history {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 1rem;
    align-items: center;
    transition: background var(--transition), border-color var(--transition);
}

.history-item:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}

.history-item img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.history-item .info {
    min-width: 0;
}

.history-item .song {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item .artist {
    font-size: 0.875rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item .time {
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
}

/* ===== States ===== */
.loading,
.error {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
    grid-column: 1 / -1;
}

.loading i {
    animation: spin 1s linear infinite;
    font-size: 2rem;
    display: inline-block;
}

.error {
    color: var(--live);
}

.error i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ===== Footer ===== */
footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--muted);
    font-size: 0.875rem;
}

footer a {
    color: var(--accent);
    text-decoration: none;
}

footer a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    header h1 {
        font-size: 1.25rem;
    }
    
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
    
    .current-song {
        grid-template-columns: 1fr;
        padding: 1.5rem;
        text-align: center;
    }
    
    .current-song img {
        max-width: 250px;
        margin: 0 auto;
    }
    
    .current-song .info .meta {
        justify-content: center;
    }
    
    .current-song .info .song {
        font-size: 1.5rem;
    }
    
    .history-item {
        grid-template-columns: 50px 1fr;
        gap: 0.75rem;
    }
    
    .history-item img {
        width: 50px;
        height: 50px;
    }
    
    .history-item .time {
        grid-column: 2;
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .station-info {
        padding: 0.75rem;
    }
    
    .station-song {
        font-size: 0.875rem;
    }
    
    .station-artist {
        font-size: 0.75rem;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}
