/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

/* Header and Navigation */
header {
    background: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.navbar {
    display: grid;
    grid-template-columns: 180px 1fr 180px;
    align-items: center;
    padding: 0.25rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    gap: 1rem;
}

.navbar .logo {
    display: flex;
    align-items: center;
}

.navbar .logo h1 {
    font-size: 1.1rem;
    margin: 0;
    color: #007bff;
    white-space: nowrap;
}

.now-playing-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.now-playing-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.15rem;
    max-width: 450px;
    width: 100%;
}

.now-playing-header img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
}

.now-playing-header .station-info {
    flex: 0 1 150px;
    min-width: 80px;
    text-align: left;
}

.now-playing-header .station-info h2 {
    font-size: 0.8rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #666;
    font-weight: 600;
}

.nav-right {
    display: flex;
    justify-content: flex-end;
}

.search-bar {
    position: relative;
    max-width: 200px;
    width: 100%;
}

.search-bar input {
    width: 100%;
    padding: 0.35rem 0.75rem 0.35rem 2rem;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.search-bar .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 0.85rem;
}

@media (max-width: 1024px) {
    .navbar {
        grid-template-columns: auto 1fr auto;
        gap: 1rem;
    }
    
    .now-playing-header {
        max-width: 400px;
    }
}

@media (max-width: 768px) {
    .navbar {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .logo {
        justify-content: center;
    }

    .nav-right {
        justify-content: center;
    }

    .search-bar {
        max-width: 100%;
    }

    .now-playing-header {
        max-width: 100%;
    }
}

/* Main Content */
main {
    margin-top: 0;
    padding: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Hero Section */
.hero {
    position: relative;
    padding: 1rem;
    text-align: center;
    background: linear-gradient(135deg, #0052cc, #007bff);
    color: white;
    overflow: hidden;
    margin-top: -1px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.hero-text h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.hero-text p {
    font-size: 0.9rem;
    margin-bottom: 0;
    opacity: 0.9;
    line-height: 1.3;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 100%);
}

.search-container {
    max-width: 500px;
}

/* Player Section */
.now-playing {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    text-align: center;
}

.now-playing-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.15rem;
    max-width: 450px;
    width: 100%;
}

.now-playing-header img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
}

.now-playing-header .station-info {
    flex: 0 1 150px;
    min-width: 80px;
    text-align: left;
}

.now-playing-header .station-info h2 {
    font-size: 0.8rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #666;
    font-weight: 600;
}

.now-playing-header .player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.now-playing-header .control-button {
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.85rem;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.now-playing-header .control-button:hover {
    color: #007bff;
}

.now-playing-header .volume-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-left: 0.25rem;
}

.now-playing-header .volume-control i {
    font-size: 0.85rem;
}

.now-playing-header .volume-slider {
    width: 50px;
    height: 2px;
    vertical-align: middle;
}

.now-playing-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

.now-playing img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.station-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.station-info h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.control-button {
    background: #2563eb;
    color: white;
    border: none;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-button:hover {
    background: #1d4ed8;
    transform: scale(1.05);
}

.control-button i {
    font-size: 1.5rem;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
}

.volume-control i {
    color: #666;
    font-size: 1.2rem;
}

.volume-slider {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    background: #e5e7eb;
    border-radius: 2px;
    outline: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #2563eb;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    background: #1d4ed8;
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .now-playing {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .now-playing-info {
        width: 100%;
    }

    .player-controls {
        width: 100%;
        justify-content: center;
    }

    .volume-control {
        margin-left: 0;
    }
}

/* Stations Grid */
.stations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
}

.station-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.station-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.station-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    text-align: center;
}

.station-content img {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    object-fit: cover;
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.station-content h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.play-station {
    background: #2563eb;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.play-station:hover {
    background: #1d4ed8;
}

.play-station i {
    font-size: 0.8rem;
}

.station-card.playing {
    border: 2px solid #2563eb;
    transform: translateY(-5px);
}

.station-card.playing .play-station {
    background: #1d4ed8;
}

/* Ad Banner */
.stations-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 2rem;
}

.ad-banner {
    grid-column: 1 / -1;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    margin: 0.5rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

.ad-content {
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
}

.station-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

@media (max-width: 1024px) {
    .stations-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stations-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* Responsive Design */
@media (max-width: 1200px) {
    .stations-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }
    
    .station-content img {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 768px) {
    .stations-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
        padding: 15px;
    }
    
    .station-content img {
        width: 90px;
        height: 90px;
    }
    
    .station-content h3 {
        font-size: 1rem;
    }
    
    .play-station {
        padding: 6px 16px;
        font-size: 0.85rem;
    }
}

/* Loading Animation */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.loading .station-card {
    opacity: 0.7;
    pointer-events: none;
}

.loading-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 1.1rem;
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-size: 1.1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Responsive grid */
@media (max-width: 1200px) {
    .stations-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .stations-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stations-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* Genre Section */
.genre-section {
    margin-bottom: 3rem;
}

.genre-section h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
}

.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.genre-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
    text-decoration: none;
    color: #4b5563;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.genre-card:hover {
    transform: translateY(-5px);
    color: #2563eb;
}

.genre-card i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Error State */
.error-message {
    text-align: center;
    padding: 40px;
    color: #dc3545;
}

.error-message button {
    margin-top: 20px;
    padding: 8px 20px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.error-message button:hover {
    background: #c82333;
}

/* Focus States for Accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.station-card:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 4px;
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Footer */
footer {
    background-color: #1f2937;
    color: white;
    padding: 4rem 2rem 2rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: white;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    font-size: 1.5rem;
}

.footer-bottom {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid #374151;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .player-container {
        flex-direction: column;
    }

    .station-info {
        flex-direction: column;
        text-align: center;
    }
}

/* Ad Container */
.stations-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1rem;
}

.station-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.ad-container {
    grid-column: 1 / -1; /* Span all columns */
    margin: 1rem 0;
}

.ad-placeholder {
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-size: 0.9rem;
}

@media (max-width: 1024px) {
    .stations-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .stations-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stations-grid {
        grid-template-columns: 1fr;
    }
    
    .ad-placeholder {
        height: 100px;
    }
}
