:root {
    --bg-dark: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --text-main: #ffffff;
    --text-muted: #a3a3a3;
    --primary-glow: #7c3aed;
    --secondary-glow: #2563eb;
    --accent-color: #3b82f6;

    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;

    --glass-bg: rgba(18, 18, 24, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --blur-amount: 20px;

    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Mesh Gradient Animation */
.background-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background:
        radial-gradient(circle at 15% 50%, rgba(124, 58, 237, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(37, 99, 235, 0.15), transparent 25%);
    filter: blur(60px);
    opacity: 0.8;
    animation: moveMesh 20s ease-in-out infinite alternate;
}

@keyframes moveMesh {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(1.1);
    }
}

/* Keyframes for Card Entry */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    color: var(--accent-color);
    width: 32px;
    height: 32px;
}

.main-header h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Search Bar */
.search-bar {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

#station-search {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 0.75rem 1rem 0.75rem 3rem;
    border-radius: 12px;
    color: white;
    font-family: var(--font-body);
    transition: var(--transition-smooth);
}

#station-search:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--bg-card-hover);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

/* Filters */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 500;
    transition: var(--transition-smooth);
}

.tab.active {
    background: var(--bg-card-hover);
    color: white;
}

.tab:hover:not(.active) {
    color: white;
}

/* Grid */
.station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding-bottom: 120px;
    /* Space for player */
}

/* Station Card */
.station-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.station-card:hover {
    transform: translateY(-5px) scale(1.02);
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.station-card.playing {
    border-color: var(--accent-color);
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.1);
    animation: pulseBorder 2s infinite;
}

@keyframes pulseBorder {
    0% {
        border-color: var(--accent-color);
        box-shadow: 0 0 25px rgba(59, 130, 246, 0.3);
    }

    50% {
        border-color: #60a5fa;
        box-shadow: 0 0 35px rgba(59, 130, 246, 0.5);
    }

    100% {
        border-color: var(--accent-color);
        box-shadow: 0 0 25px rgba(59, 130, 246, 0.3);
    }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.station-logo-container {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    display: flex;
    align-items: center;
    justify-content: center;
}

.station-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.station-placeholder {
    color: var(--text-muted);
}

.fav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 8px;
    border-radius: 50%;
}

.fav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ef4444;
}

.fav-btn.active {
    color: #ef4444;
    fill: #ef4444;
}

.card-info h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.card-info .category-tag {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
}

/* Playing Animation in Card */
.visualizer-bars {
    display: flex;
    gap: 3px;
    height: 20px;
    align-items: flex-end;
    margin-top: auto;
    opacity: 0;
    transition: opacity 0.3s;
}

.station-card.playing .visualizer-bars {
    opacity: 1;
}

.bar {
    width: 3px;
    background-color: var(--accent-color);
    animation: bounce 1s infinite ease-in-out;
}

.bar:nth-child(2) {
    animation-delay: 0.1s;
}

.bar:nth-child(3) {
    animation-delay: 0.2s;
}

.bar:nth-child(4) {
    animation-delay: 0.3s;
}

@keyframes bounce {

    0%,
    100% {
        height: 4px;
    }

    50% {
        height: 16px;
    }
}

/* Player Bar */
.player-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1rem 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.player-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.now-playing {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 250px;
}

.np-logo-container {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.np-info h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    margin-bottom: 2px;
}

.np-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.control-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn.sm {
    color: var(--text-muted);
}

.control-btn.sm:hover {
    color: white;
}

.control-btn.lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: white;
    color: black;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.control-btn.lg:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

.volume-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 200px;
}

#volume-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
}

#volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: transform 0.1s;
}

#volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
}

.hidden {
    display: none !important;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .player-content {
        flex-direction: column;
        gap: 1rem;
    }

    .player-bar {
        width: 100%;
        bottom: 0;
        border-radius: 20px 20px 0 0;
        padding: 1.5rem;
    }

    .now-playing {
        width: 100%;
        justify-content: flex-start;
    }

    .volume-controls {
        display: none;
        /* Hide volume on mobile to save space, rely on system volume */
    }
}

/* Section Divider */
.section-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 3rem 0;
    position: relative;
    color: var(--text-muted);
    font-family: var(--font-heading);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.section-divider::before,
.section-divider::after {
    content: '';
    height: 1px;
    background: var(--border-subtle);
    flex: 1;
    margin: 0 1rem;
}

/* Enhancements for scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Status Bar in Player */
.status-bar {
    width: 100%;
    text-align: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#status-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: var(--transition-smooth);
}

.status-bar.active #status-text {
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.status-bar.error #status-text {
    color: #ef4444;
}

.status-bar.loading #status-text {
    animation: pulse-text 1.5s infinite;
}

@keyframes pulse-text {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}
