:root {
    --bg-color: #000000;
    --card-bg: rgba(0, 0, 0, 0.4);
    --card-hover: rgba(0, 0, 0, 0.6);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent: #39ff14;
    --accent-hover: #32e012;
    --glass-bg: rgba(0, 0, 0, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: url('assets/background.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 120px; /* Space for the fixed player */
    overflow-x: hidden; /* Prevent horizontal scroll on mobile */
}

#space-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1; /* Behind everything */
    pointer-events: none; /* Don't block clicks */
}

.app-container {
    width: 100%;
    margin: 0 auto;
    /* Removed padding: 2rem; so Bootstrap handles responsive padding natively */
}

header {
    text-align: center;
    margin-bottom: 0;
}

.main-logo {
    width: 100%;
    max-width: 350px;
    height: auto;
    margin: 0 auto 1rem auto;
    display: block;
    transform: translateX(-2%); /* Fix visual padding without breaking SVG coordinate space */
}

@keyframes spinVinyl {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.main-logo #spin {
    transform-origin: 88.1px 90.2px;
    transform-box: view-box; /* Forces origin to use absolute SVG coordinates */
    animation: spinVinyl 5s linear infinite;
    animation-play-state: paused;
}

.mini-player-wrapper {
    position: relative;
    height: 85px;
    width: auto;
    aspect-ratio: 250 / 185;
    flex-shrink: 0;
}

.mini-logo {
    width: 100%;
    height: auto;
    display: block;
}

.mini-logo #spin_mini {
    transform-origin: 88.1px 90.2px;
    transform-box: view-box;
    animation: spinVinyl 5s linear infinite;
    animation-play-state: paused;
}

.main-logo.spinning #spin,
.mini-logo.spinning #spin_mini {
    animation-play-state: running;
}

.main-logo #igla,
.mini-logo #igla_mini {
    transform-origin: 193.5px 33.5px;
    transform-box: view-box;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(0deg);
}

.main-logo.spinning #igla,
.mini-logo.spinning #igla_mini {
    transform: rotate(30deg); /* Swings needle over the record */
}

header h1 {
    font-size: 3rem;
    font-weight: 600;
    background: linear-gradient(135deg, #a3ff94 0%, #39ff14 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.search-box {
    background-color: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    width: 100%;
    max-width: 600px;
    transition: border-color 0.3s;
    overflow: hidden;
}

.search-box:focus-within {
    border-color: transparent;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.15);
}

.search-box .input-group-text {
    color: var(--text-secondary);
    padding-left: 1.5rem;
}

.search-box input {
    color: var(--text-primary);
    font-size: 1rem;
}

.search-box input:focus {
    color: var(--text-primary);
    background-color: transparent;
    box-shadow: none;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-box .btn {
    background-color: var(--accent);
    color: #000000;
    border-radius: 50px !important;
    padding: 0.5rem 1.5rem;
    font-weight: 700;
    margin: 4px;
    border: none;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.5);
    transition: all 0.3s;
    z-index: 5;
}

.search-box .btn:hover {
    background-color: var(--accent-hover);
    color: #000000;
}

.genre-chips {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.chip {
    background-color: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.25rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.15);
}

.chip:hover {
    background-color: var(--card-hover);
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.chip.active {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #000000;
    font-weight: 600;
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.5);
}

.station-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255,255,255,0.2) !important;
    background-color: rgba(255,255,255,0.05) !important;
    color: rgba(255,255,255,0.8) !important;
}

/* Stations Grid */

.station-card {
    background-color: var(--card-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    overflow: hidden;
}

.station-card:hover {
    background-color: var(--card-hover);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.station-card.playing {
    border-color: var(--glass-border);
    background-color: var(--card-bg);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 40px rgba(255, 255, 255, 0.4);
}

.station-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    background-color: rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.station-icon .material-symbols-rounded {
    font-size: 32px;
    color: var(--text-secondary);
}

.fallback-icon {
    background-color: rgba(57, 255, 20, 0.1);
}

.fallback-icon .material-symbols-rounded {
    color: var(--accent);
}

.player-info .station-icon {
    border-radius: 50%;
}

.player-info .station-icon.spinning {
    animation: spinVinyl 5s linear infinite;
}

.station-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.station-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.station-tags span {
    font-size: 0.75rem;
    background-color: rgba(255,255,255,0.05);
    padding: 0.2rem 0.7rem;
    border-radius: 50px;
    color: var(--text-secondary);
}

/* Fixed Player */
.player-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background-color: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    position: relative;
    z-index: 1;
}

.player-info img {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    object-fit: cover;
}

.player-text h3 {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.player-text p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

#play-pause-btn {
    background-color: var(--text-primary);
    color: var(--bg-color);
    border: none;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s;
}

#play-pause-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

#play-pause-btn:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.5;
}

#play-pause-btn .material-symbols-rounded {
    font-size: 32px;
}

.player-volume {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 30%;
    justify-content: flex-end;
    position: relative;
    z-index: 1;
}

.player-volume .material-symbols-rounded {
    color: var(--text-secondary);
    font-size: 20px;
}

.volume-slider-wrapper {
    position: relative;
    width: 150px;
    height: 20px;
    display: flex;
    align-items: center;
}

.volume-slider-glow {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--vol-percent, 50%);
    border-radius: 20px;
    background: transparent;
    box-shadow: 0 0 15px var(--vol-color, #39ff14);
    pointer-events: none;
    z-index: 1;
    transition: width 0.1s ease;
}

input[type=range] {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    --vol-color: #39ff14; 
    -webkit-appearance: none;
    width: 150px;
    height: 20px;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.4); /* Thin white stroke */
    border-radius: 20px;
    outline: none;
    overflow: hidden; /* This is the magic that clips the inner fill! */
    cursor: pointer;
    /* No box shadow on the container, so it doesn't glow overall */
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 0px; /* Hide the thumb entirely */
    height: 20px;
    box-shadow: -150px 0 0 150px var(--vol-color); /* The fill dynamically changes color */
}

input[type=range]::-moz-range-progress {
    background-color: var(--vol-color);
    height: 20px;
    border-radius: 20px;
    box-shadow: 0 0 12px var(--vol-color);
}

input[type=range]::-moz-range-track {
    background-color: var(--card-bg);
    height: 20px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

input[type=range]::-moz-range-thumb {
    width: 0px;
    height: 20px;
    border: none;
    background: transparent;
}

input[type=range]:focus {
    outline: none;
}

/* Utilities */
.hidden {
    display: none !important;
}

#loading, #error-message {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.spin {
    animation: spin 1.5s linear infinite;
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.spin-slow {
    animation: spin 3s linear infinite;
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 2rem;
}

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

@media (max-width: 768px) {
    .player-container {
        padding: 0 1rem;
    }
    .player-volume { display: none; }
    .app-container { padding: 1rem; }
    
    .mini-player-wrapper {
        height: 75px;
        width: auto;
    }
    #play-pause-btn {
        width: 44px;
        height: 44px;
    }
}

/* Equalizer Effects */
.equalizer-container {
    position: absolute;
    bottom: 0;
    left: 235px;
    right: 0;
    height: 100%;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 0 2rem 0 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: 0;
}

.equalizer-container.active {
    opacity: 1;
}

.eq-bar {
    flex: 1;
    margin: 0 3px;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
    transform-origin: bottom;
    animation: equalize 1s infinite alternate ease-in-out;
    transform: scaleY(0.1);
    opacity: 0.1;
}

@keyframes equalize {
    0% { 
        transform: scaleY(0.02);
        opacity: 0.05;
    }
    100% { 
        transform: scaleY(1);
        opacity: 0.5;
    }
}

#load-more-btn:hover {
    background-color: var(--accent) !important;
    color: #000 !important;
    box-shadow: 0 0 15px var(--accent);
}
