/* styles/channels.css - Channel list and icons styling */

/* Channel List Container */
.channel-list-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    position: relative;
}

/* Channel Icons Wrapper */
.channel-icons-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    overflow-x: auto;
    scroll-behavior: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* Hide scrollbar for webkit browsers */
.channel-icons-wrapper::-webkit-scrollbar {
    display: none;
}

/* Individual Channel Icon */
.channel-icon {
    min-width: 150px;
    width: 150px;
    height: 75px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

/* Selected Channel Styling */
.channel-icon.selected {
    border: 4px solid #00BFFF;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.5);
    opacity: 1;
    visibility: visible;
}

/* Channel Icon Hover Effect */
.channel-icon:hover:not(.selected) {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.02);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Channel Icon Focus Effect */
.channel-icon:focus {
    outline: 2px solid #00BFFF;
    outline-offset: 2px;
}

/* Channel Icon Active State */
.channel-icon:active {
    transform: scale(0.98);
}

/* Channel Icon Image */
.channel-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    opacity: 1;
    visibility: visible;
}

/* Ensure images remain visible in selected state */
.channel-icon.selected img {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Channel Icon Text (for generated icons) */
.channel-icon-text {
    font-size: 21px;
    font-weight: bold;
    color: #ffffff;
    text-align: center;
    padding: 8px;
    word-wrap: break-word;
    line-height: 1.2;
    opacity: 1;
    visibility: visible;
}

/* Ensure text remains visible in selected state */
.channel-icon.selected .channel-icon-text {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Generated Channel Icon Background Colors */
.channel-icon.color-1 { background-color: #3498DB; }
.channel-icon.color-2 { background-color: #9B59B6; }
.channel-icon.color-3 { background-color: #E74C3C; }
.channel-icon.color-4 { background-color: #2ECC71; }
.channel-icon.color-5 { background-color: #F39C12; }
.channel-icon.color-6 { background-color: #1ABC9C; }
.channel-icon.color-7 { background-color: #E67E22; }
.channel-icon.color-8 { background-color: #34495E; }

/* Ensure selected state keeps the border and visibility */
.channel-icon.selected.color-1,
.channel-icon.selected.color-2,
.channel-icon.selected.color-3,
.channel-icon.selected.color-4,
.channel-icon.selected.color-5,
.channel-icon.selected.color-6,
.channel-icon.selected.color-7,
.channel-icon.selected.color-8 {
    border: 4px solid #00BFFF;
    box-shadow: 0 4px 12px rgba(0, 191, 255, 0.5);
    opacity: 1 !important;
    visibility: visible !important;
}

/* Channel Number Badge (optional) */
.channel-number {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    padding: 3px 6px;
    border-radius: 4px;
    line-height: 1;
}

/* Channel Name Overlay (optional, for hover) */
.channel-name-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #ffffff;
    font-size: 12px;
    padding: 9px 6px 6px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.channel-icon:hover .channel-name-overlay {
    opacity: 1;
}

/* Loading state for channel icons */
.channel-icon.loading {
    background: rgba(255, 255, 255, 0.1);
    position: relative;
}

.channel-icon.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Fade-in animation for channel icons */
.channel-icon {
    animation: fadeInChannel 0.3s ease forwards;
}

@keyframes fadeInChannel {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure icons remain visible after animation */
.channel-icon.selected {
    opacity: 1 !important;
}

/* Stagger animation delay for each channel */
.channel-icon:nth-child(1) { animation-delay: 0.05s; }
.channel-icon:nth-child(2) { animation-delay: 0.1s; }
.channel-icon:nth-child(3) { animation-delay: 0.15s; }
.channel-icon:nth-child(4) { animation-delay: 0.2s; }
.channel-icon:nth-child(5) { animation-delay: 0.25s; }
.channel-icon:nth-child(6) { animation-delay: 0.3s; }
.channel-icon:nth-child(7) { animation-delay: 0.35s; }
.channel-icon:nth-child(8) { animation-delay: 0.4s; }
.channel-icon:nth-child(9) { animation-delay: 0.45s; }
.channel-icon:nth-child(10) { animation-delay: 0.5s; }

/* Continue pattern for more channels */
.channel-icon:nth-child(n+11) { animation-delay: 0.5s; }

/* Responsive Design */
@media (max-width: 1024px) {
    .channel-icon {
        min-width: 68px;
        width: 68px;
        height: 34px;
    }

    .channel-icon-text {
        font-size: 9px;
    }

    .channel-number {
        font-size: 7px;
        padding: 1px 2px;
    }
}

@media (max-width: 768px) {
    .channel-icons-wrapper {
        gap: 8px;
        padding: 8px 12px;
    }

    .channel-icon {
        min-width: 60px;
        width: 60px;
        height: 30px;
    }

    .channel-icon-text {
        font-size: 8px;
    }

    .channel-number {
        font-size: 6px;
        padding: 1px 2px;
    }
}

@media (max-width: 480px) {
    .channel-icon {
        min-width: 53px;
        width: 53px;
        height: 26px;
    }

    .channel-icon-text {
        font-size: 7px;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .channel-icon {
        border: 2px solid #ffffff;
    }
    
    .channel-icon.selected {
        border: 3px solid #00FFFF;
        background: rgba(0, 255, 255, 0.3);
    }
}

/* Smooth scroll indicators (optional) */
.channel-list-container::before,
.channel-list-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 20px;
    pointer-events: none;
    z-index: 10;
}

.channel-list-container::before {
    left: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.3), transparent);
}

.channel-list-container::after {
    right: 0;
    background: linear-gradient(to left, rgba(0,0,0,0.3), transparent);
}