/* Reset styles to prevent theme interference */
.channels-lists-container * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.channels-lists-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    padding: 24px;
    background-color: #f1f5f9;
    border-radius: 12px;
    color: #333;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Countries container needs relative positioning for absolute nav buttons */
.channels-lists-container .countries-container {
    position: relative !important;
}

.countries-slider {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
    scroll-behavior: smooth;
    padding: 10px 0;
    margin: 0 60px;
    overflow-x: auto;
    white-space: nowrap;
    display: flex;
    cursor: grab;
    user-select: none;
}

.countries-slider.active {
    cursor: grabbing;
    cursor: -webkit-grabbing;
}

.countries-slider::-webkit-scrollbar {
    height: 6px;
}

.countries-slider::-webkit-scrollbar-track {
    background: transparent;
}

.countries-slider::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 20px;
}

.country-item {
    min-width: 180px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 8px;
    margin: 0 8px;
    font-size: 16px;
}

.country-item:hover {
    transform: translateY(-2px);
    background-color: #dbeafe !important;
}

.country-item.active {
    background-color: #1e40af !important; /* Dark blue color */
    color: white;
}

.country-item.active:hover {
    background-color: #395bb6 !important; /* Slightly darker blue on hover */
}

.country-item img {
    margin-right: 12px;
}

.country-item span {
    font-weight: 500;
    white-space: nowrap;
}

.channel-item {
    transition: all 0.3s ease;
    border-radius: 8px;
    margin-bottom: 4px;
    background-color: white !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
}

.channel-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    background-color: #f9fafb !important;
}

.channel-item span {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 40px);
}

.flag-icon {
    width: 24px;
    height: 18px;
    margin-right: 8px;
    border-radius: 2px;
    object-fit: cover;
    flex-shrink: 0;
    background-color: #f1f1f1;
}

/* Add a placeholder style for lazy-loaded images */
.flag-icon.lazyload {
    opacity: 0.2;
    transition: opacity 0.3s ease;
}

.flag-icon:not(.lazyload) {
    opacity: 1;
}

.channels-container {
    display: flex;
    gap: 16px;
    max-height: 600px; /* Adjusted to show approximately 12 channels per column */
    overflow-y: auto;
    padding-right: 10px;
    padding-top: 20px;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

.channels-container::-webkit-scrollbar {
    width: 6px;
}

.channels-container::-webkit-scrollbar-track {
    background: transparent;
}

.channels-container::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 20px;
}

.channel-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.channel-item {
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 20px;
    background-color: white;
    display: flex;
    align-items: center;
    height: 42px; /* Fixed height for consistent sizing */
    margin-bottom: 0; /* Remove margin-bottom since we're using gap */
}

/* Navigation buttons with stronger specificity to override theme styles */
.channels-lists-container .country-nav-btn {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    opacity: 0.8;
    transition: opacity 0.3s ease;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    z-index: 20 !important;
    background-color: white !important;
    border-radius: 50% !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    outline: none !important;
}

.channels-lists-container .country-nav-btn:hover {
    opacity: 1 !important;
    background-color: #f9fafb !important;
}

.channels-lists-container .country-nav-btn:focus {
    outline: none !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(59, 130, 246, 0.5) !important;
}

.channels-lists-container .country-nav-btn.prev {
    left: 5px !important;
}

.channels-lists-container .country-nav-btn.next {
    right: 5px !important;
}

/* Ensure SVG icons inside nav buttons display correctly */
.channels-lists-container .country-nav-btn svg {
    width: 20px !important;
    height: 20px !important;
    color: #6b7280 !important;
    pointer-events: none !important;
}

#channels-search {
    font-size: 20px;
    height: 60px;
    padding-left: 20px;
    padding-right: 60px;
    border-radius: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    width: 100%;
}

#channels-search:focus {
    outline: none;
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(165, 180, 252, 0.5);
}

#channels-search::placeholder {
    color: #9ca3af;
}

.search-icon {
    color: #1e40af; /* Dark blue color */
}

/* Reset some styles to prevent theme interference */
.channels-lists-container * {
    box-sizing: border-box;
}

.channels-lists-container input,
.channels-lists-container button {
    font-family: inherit;
}

/* Hello Elementor theme compatibility fixes */
.channels-lists-container .country-nav-btn {
    /* Override any theme button resets */
    min-width: auto !important;
    min-height: auto !important;
    line-height: 1 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    font-weight: normal !important;
    font-size: inherit !important;
    color: inherit !important;
}

/* Ensure the container has proper stacking context */
.channels-lists-container .countries-container {
    z-index: 1 !important;
}

/* Fix for themes that might override absolute positioning */
.channels-lists-container .countries-container .country-nav-btn {
    position: absolute !important;
    display: flex !important;
}

/* Media queries for responsive design */
@media screen and (max-width: 768px) {
    .channels-lists-container {
        padding: 16px;
        border-radius: 8px;
    }

    .countries-slider {
        margin: 0 40px;
        padding: 8px 0;
    }

    /* Mobile navigation button adjustments */
    .channels-lists-container .country-nav-btn {
        width: 32px !important;
        height: 32px !important;
    }

    .channels-lists-container .country-nav-btn svg {
        width: 18px !important;
        height: 18px !important;
    }

    #channels-search {
        font-size: 16px;
        height: 50px;
    }

    /* Mobile-specific channel container styles */
    .channels-container {
        gap: 10px;
    }

    /* This class will be added via JavaScript for mobile view */
    .channels-container.mobile-view {
        /* For 2 columns on mobile */
        display: flex;
        flex-wrap: wrap;
    }

    .channels-container.mobile-view .channel-column {
        flex: 0 0 calc(50% - 5px); /* 50% width minus half the gap */
    }

    .channel-item {
        padding: 8px;
        height: auto; /* Allow height to adjust based on content */
        min-height: 42px;
    }

    .channel-item span {
        font-size: 15px;
    }

    .flag-icon {
        width: 20px;
        height: 15px;
        margin-right: 6px;
    }

    .country-item {
        min-width: 150px;
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    .channels-lists-container {
        padding: 12px;
    }

    .channels-container.mobile-view .channel-column {
        flex: 0 0 calc(50% - 4px); /* 50% width minus half the gap */
    }

    .channels-container {
        gap: 8px;
    }

    .channel-item {
        padding: 6px;
        min-height: 38px;
    }

    .channel-item span {
        font-size: 12px;
    }

    .flag-icon {
        width: 18px;
        height: 14px;
        margin-right: 5px;
    }

    #channels-search {
        font-size: 14px;
        height: 45px;
        padding-left: 15px;
        padding-right: 45px;
    }

    .search-icon {
        width: 20px;
        height: 20px;
    }
}