/* Country Grid - Android TV / Smart TV Style */

/* Main container for country selection view */
.country-view {
    display: block;
}

.country-view.hidden {
    display: none;
}

/* Global Search Results */
.global-search-results {
    margin-bottom: 2rem;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.search-results-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
}

.clear-search-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.clear-search-btn:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* Hide country grid when showing search results */
.country-view.searching #countryGrid {
    display: none;
}

/* Global search results - vertical list layout */
.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Global search channel cards - horizontal layout */
.global-search-card {
    min-height: 70px;
    max-height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.global-search-card .channel-name {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    font-size: 1rem;
    font-weight: 500;
}

.global-search-card .channel-name i {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.global-search-card .channel-country {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.global-search-card .channel-flag {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.global-search-card .country-code {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.global-search-card .channel-status {
    flex-shrink: 0;
    margin: 0;
}

@media (max-width: 768px) {
    .global-search-card {
        min-height: 60px;
        max-height: 60px;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    
    .global-search-card .channel-name {
        font-size: 0.9rem;
    }
    
    .global-search-card .country-code {
        display: none;
    }
}

/* Country grid header */
.country-header {
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid #1a1a1a;
}

.country-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.country-header-text {
    flex: 1;
    min-width: 250px;
}

.country-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #fff;
    margin: 0 0 10px 0;
    letter-spacing: -0.02em;
}

.country-header p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

.country-header .modern-search-wrapper {
    flex: 0 0 auto;
    width: 400px;
    max-width: 100%;
    margin: 0;
}

@media (max-width: 768px) {
    .country-header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .country-header .modern-search-wrapper {
        width: 100%;
    }
}

/* Country grid layout */
.country-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .country-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
}

/* Country card - grey-based design */
.country-card {
    background: #0a0a0a;
    border: 1px solid #151515;
    border-radius: 12px;
    padding: 24px 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    text-decoration: none;
    color: inherit;
}

.country-card:hover {
    background: #121212;
    border-color: #1a1a1a;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    text-decoration: none;
}

.country-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #1c6cdb 0%, #00a8ff 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.country-card:hover::before {
    transform: scaleX(1);
}

/* Country flag */
.country-flag {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin-bottom: 16px;
    object-fit: cover;
    border: 2px solid rgba(28, 108, 219, 0.2);
    transition: all 0.3s ease;
}

.country-card:hover .country-flag {
    border-color: rgba(28, 108, 219, 0.6);
    transform: scale(1.1);
}

/* Country name */
.country-name {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

/* Channel count badge */
.country-channels {
    font-size: 0.8rem;
    color: rgba(28, 108, 219, 0.9);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.country-channels i {
    font-size: 0.75rem;
}

/* Channels view (hidden by default) */
.channels-view {
    display: none;
}

.channels-view.active {
    display: block;
}

/* Back navigation */
.back-navigation {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 12px 0;
    border-bottom: 1px solid #1a1a1a;
}

.back-btn {
    background: #0a0a0a;
    border: 1px solid #151515;
    border-radius: 8px;
    padding: 10px 20px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-btn:hover {
    background: #121212;
    border-color: #1a1a1a;
    transform: translateX(-3px);
}

.back-btn i {
    font-size: 1rem;
}

.current-country {
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-country-flag {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(28, 108, 219, 0.3);
}

.current-country-info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    letter-spacing: -0.01em;
}

.current-country-info p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
}

/* Loading state */
.country-card.loading {
    pointer-events: none;
    opacity: 0.6;
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.country-card {
    animation: fadeInUp 0.4s ease-out forwards;
    opacity: 0;
}

.country-card:nth-child(1) { animation-delay: 0.05s; }
.country-card:nth-child(2) { animation-delay: 0.1s; }
.country-card:nth-child(3) { animation-delay: 0.15s; }
.country-card:nth-child(4) { animation-delay: 0.2s; }
.country-card:nth-child(5) { animation-delay: 0.25s; }
.country-card:nth-child(6) { animation-delay: 0.3s; }
.country-card:nth-child(7) { animation-delay: 0.35s; }
.country-card:nth-child(8) { animation-delay: 0.4s; }

/* Live badge indicator */
.status-live-badge {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #00ff00;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
    animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 12px rgba(0, 255, 0, 0.8);
    }
}

.channel-status {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 16px;
}

/* Light mode support */
body.light-mode .country-card {
    background: #f8f9fa;
    border-color: #e9ecef;
}

body.light-mode .country-card:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

body.light-mode .country-name {
    color: #000;
}

body.light-mode .back-btn {
    background: #f8f9fa;
    border-color: #e9ecef;
    color: #000;
}

body.light-mode .back-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

body.light-mode .current-country-info h3 {
    color: #000;
}

body.light-mode .country-header h2 {
    color: #000;
}

body.light-mode .country-header,
body.light-mode .back-navigation {
    border-bottom-color: #dee2e6;
}
