/* CSS Variables for consistent styling */
:root {
    --bg-color: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-color: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --primary-color: #667eea;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Body background with the new background image */
body {
    background: linear-gradient(rgba(255,255,255,0.9), rgba(255,255,255,0.9)), url('../background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Logo styling */
.logo a {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    color: var(--text-color);
}

.logo-image {
    height: 90px;
    width: auto;
}

.logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.logo-text h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--text-color);
    line-height: 1.1;
}

.logo-text h1 .world-radio {
    color: #ff6b35;
    display: block;
}

.logo-text h1 .stream {
    color: #4a90e2;
    display: block;
    margin-top: -2px;
}

.logo-text .tagline {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* Dark mode variables */
[data-theme="dark"] {
    --bg-color: #1a1a1a;
    --bg-secondary: #2a2a2a;
    --text-color: #ffffff;
    --text-muted: #cccccc;
    --border-color: #444444;
    --primary-color: #764ba2;
    --shadow-color: rgba(255, 255, 255, 0.1);
}

/* Dark mode body background */
[data-theme="dark"] body {
    background: linear-gradient(rgba(26,26,26,0.9), rgba(26,26,26,0.9)), url('../background.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Homepage Styles */
.homepage {
    min-height: 100vh;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: var(--text-color);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Navigation Enhancements */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dropdown-arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 25px var(--shadow-color), 0 0 0 1px rgba(255,255,255,0.05);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 9999;
    max-height: none;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 4px;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: 12px 16px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin: 2px;
    font-weight: 500;
    position: relative;
}

.dropdown-menu a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateX(2px);
}

.dropdown-menu a:active {
    background-color: var(--primary-color);
    opacity: 0.9;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-secondary);
    padding: 6px 10px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.search-container:focus-within {
    border-color: var(--primary-color);
}

#search-input {
    border: none;
    background: transparent;
    color: var(--text-color);
    padding: 5px;
    width: 150px;
    outline: none;
    font-size: 14px;
}

#search-input::placeholder {
    color: var(--text-muted);
}

#search-button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 16px;
    padding: 2px;
}

#search-button:hover {
    color: var(--primary-color);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 80px 0;
    text-align: center;
}

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.hero-content p {
    font-size: 1.3rem;
    margin-bottom: 40px;
    opacity: 0.9;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: 40px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.8;
}

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

.station-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

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

.station-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 15px;
    object-fit: cover;
}

.station-card h3 {
    margin-bottom: 8px;
    color: var(--text-color);
}

.station-card p {
    color: var(--text-muted);
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.listen-btn {
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease;
    display: inline-block;
}

.listen-btn:hover {
    background: var(--primary-dark);
    color: white;
}

/* Countries Grid */  
.countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.country-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.3s ease;
    position: relative;
}

.country-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    border-color: var(--primary-color);
    color: var(--text-color);
}

.country-flag {
    font-size: 3rem;
    margin-bottom: 15px;
    display: block;
}

.country-card h3 {
    margin-bottom: 8px;
    font-size: 1.3rem;
}

.country-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.popular-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* View All Button */
.view-all-container {
    text-align: center;
    margin-top: 40px;
}

.view-all-btn {
    background: var(--primary-color);
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s ease;
    display: inline-block;
}

.view-all-btn:hover {
    background: var(--primary-dark);
    color: white;
}

/* Sections */
section {
    padding: 60px 0;
}

section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

section p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 40px;
    font-size: 1.1rem;
}

/* Footer Countries Section */
.countries-section {
    flex: 2;
}

.countries-footer-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 1rem;
    justify-content: center;
}

.country-link {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    white-space: nowrap;
}

.country-link:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

/* Navigation Layout */
nav {
    display: flex;
    align-items: center;
    width: 100%;
}

.nav-items {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.nav-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

nav li {
    position: relative;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 30px;
    }
    
    .stations-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .countries-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .countries-footer-grid {
        grid-template-columns: 1fr;
    }
    
    .search-container {
        width: auto;
        margin-top: 10px;
        margin-left: 0;
    }
    
    #search-input {
        width: 120px;
    }
    
    .nav-items {
        flex-direction: column;
        gap: 15px;
        margin-left: 0;
        width: 100%;
        align-items: center;
    }
    
    .nav-link {
        text-align: center;
        width: auto;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .stations-grid {
        grid-template-columns: 1fr;
    }
    
    .countries-grid {
        grid-template-columns: 1fr;
    }
}