:root {
    --primary: #8a2be2;
    --primary-hover: #9b4bed;
    --bg-dark: #0f0f13;
    --bg-panel: #1a1a20;
    --bg-glass: rgba(26, 26, 32, 0.7);
    --text-main: #f0f0f5;
    --text-muted: #9e9ea7;
    --border: rgba(255, 255, 255, 0.1);
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    background: radial-gradient(circle at top right, rgba(138, 43, 226, 0.1), transparent 40%),
                var(--bg-dark);
    backdrop-filter: blur(10px);
}

/* Sidebar / Player */
.player-sidebar {
    width: 320px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 32px;
    z-index: 10;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    color: var(--primary);
    transition: opacity 0.3s ease, max-height 0.3s ease, margin 0.3s ease, padding 0.3s ease;
    max-height: 50px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
}

.brand-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(138, 43, 226, 0.3));
    transition: filter 0.3s ease;
}

.brand:hover .brand-logo {
    filter: drop-shadow(0 0 12px rgba(138, 43, 226, 0.6));
}

.brand:hover h1 {
    filter: brightness(1.2);
    transition: filter 0.3s ease;
}

.brand h1 {
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #8a2be2 10%, #ff00ea 50%, #ffc107 90%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.now-playing-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.now-playing-card.playing {
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
    border-color: rgba(138, 43, 226, 0.5);
}

@keyframes bounce {
    0% { height: 4px; }
    100% { height: 20px; }
}

.player-image {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: contain;
    background-color: #2a2a32;
    margin-bottom: 20px;
    padding: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.now-playing-card.playing .player-image {
    animation: spin 10s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.player-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.player-tags {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 20px;
}

.control-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4);
}

.control-btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

.control-btn:disabled {
    background-color: #333;
    cursor: not-allowed;
    box-shadow: none;
    color: #666;
}

.sidebar-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: auto;
    text-align: center;
    opacity: 0.7;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.top-nav {
    padding: 24px 40px;
    background: rgba(15, 15, 19, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.top-nav-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 16px;
}

.search-row {
    justify-content: space-between;
}

.search-container {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px 20px;
    width: 100%;
    max-width: 500px;
    gap: 12px;
    transition: all 0.3s ease;
}

.search-container:focus-within {
    border-color: var(--primary);
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.2);
}

.search-container i {
    color: var(--text-muted);
}

.search-container input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1rem;
    width: 100%;
    outline: none;
    font-family: inherit;
}

.filters-row {
    flex-wrap: wrap;
}

.filters-container {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.filters-container select {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: 20px;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239e9ea7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 180px;
}

.filters-container select:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background-color: rgba(255, 255, 255, 0.08);
}

.filters-container select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(138, 43, 226, 0.2);
}

.filters-container select option {
    background-color: var(--bg-panel);
    color: var(--text-main);
}

.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
}

/* Custom Scrollbar for content-body */
.content-body::-webkit-scrollbar {
    width: 8px;
}
.content-body::-webkit-scrollbar-track {
    background: transparent;
}
.content-body::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.content-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.section-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.section-title span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.station-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.station-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(138, 43, 226, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.station-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.station-card:hover::before {
    opacity: 1;
}

.station-card.active {
    border-color: var(--primary);
    background: rgba(138, 43, 226, 0.05);
}

.station-card .play-overlay {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--primary);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.station-card:hover .play-overlay {
    opacity: 1;
    top: 60px;
}

.station-card.active .play-overlay {
    opacity: 1;
    top: 60px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--primary);
}

.station-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    object-fit: contain;
    background-color: #222;
    margin-bottom: 16px;
    padding: 8px;
    z-index: 1;
    transition: all 0.3s ease;
}

.station-card:hover .station-icon {
    filter: brightness(0.6);
}

.station-info {
    text-align: center;
    width: 100%;
    z-index: 1;
}

.station-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.station-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.station-tags {
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.station-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-bottom: 20px;
}

.page-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.page-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-dots {
    color: var(--text-muted);
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

/* Responsive */
@media (max-width: 900px) {
    body {
        overflow: visible;
        overflow-y: auto;
    }

    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .player-sidebar {
        width: 100%;
        border-right: none;
        padding: 20px;
        order: -1; 
        position: sticky;
        top: 0;
        z-index: 100;
        gap: 16px;
        background: black;
    }

    .now-playing-card {
        flex-direction: row;
        text-align: left;
        padding: 0;
        align-items: center;
        border: none;
        /* background-color: var(--bg-panel); */
    }

    .player-tags {
        margin-bottom: 0;
    }

    .player-image {
        width: 80px;
        height: 80px;
        margin-bottom: 0;
        margin-right: 16px;
    }

    .player-info {
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .player-title {
        font-size: 1.1rem;
    }

    .player-controls {
        width: auto;
        flex-direction: row;
        margin-left: auto;
    }

    .sidebar-info {
        display: none;
    }

    body.scrolled-down .brand {
        opacity: 0;
        max-height: 0;
        margin: 0;
        padding: 0;
        pointer-events: none;
        overflow: hidden;
    }

    .main-content {
        overflow-y: visible;
    }
    
    .top-nav {
        position: static;
        padding: 16px 20px;
    }

    .filters-container select {
        flex: 1 1 100%;
    }

    .content-body {
        padding: 20px;
    }

    .stations-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}
