/* Category items */
.cat-item {
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cat-item:hover {
    background-color: #374151;
}

.cat-icon {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.cat-info {
    flex: 1;
    min-width: 0;
}

.cat-name {
    font-weight: 500;
    font-size: 0.875rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cat-count {
    font-size: 0.7rem;
    color: #6b7280;
}

/* Channel items */
.channel-item {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.channel-item.active {
    background-color: #2563eb;
}

.channel-item:hover {
    background-color: #374151;
}

.channel-logo {
    width: 2rem;
    height: 2rem;
    background-color: #374151;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.channel-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.channel-info {
    flex: 1;
    min-width: 0;
}

.channel-name {
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Section cards (Home: Live TV / Movies / Series) */
.section-card {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: #1f2937;
}

.section-card:hover {
    background-color: #374151;
}

.section-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
    color: white;
}

.section-info {
    flex: 1;
    min-width: 0;
}

.section-label {
    font-weight: 600;
    font-size: 1rem;
}

.section-sub {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 2px;
}

/* Show cards (Series → Shows list) */
.show-card, .movie-card {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}
.show-card:hover, .movie-card:hover { background-color: #374151; }
.movie-card.active { background-color: #1e3a5f; }

.show-poster, .movie-poster {
    width: 2.75rem;
    height: 4rem;
    background-color: #374151;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.show-poster img, .movie-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.show-meta {
    flex: 1;
    min-width: 0;
}
.show-genre {
    font-size: 0.65rem;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 1px;
}
.show-sub {
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 2px;
}
.show-rating {
    color: #facc15;
    font-size: 0.7rem;
}

/* Info card (show detail at top of episode list) */
.info-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #1f2937;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}
.info-cover {
    width: 5rem;
    height: 7.5rem;
    object-fit: cover;
    border-radius: 0.375rem;
    flex-shrink: 0;
}
.info-body { flex: 1; min-width: 0; }
.info-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
.info-genre { font-size: 0.7rem; color: #60a5fa; margin-bottom: 2px; }
.info-rating { font-size: 0.75rem; color: #facc15; margin-bottom: 4px; }
.info-detail { font-size: 0.7rem; color: #9ca3af; margin-bottom: 2px; line-height: 1.3; }
.info-detail b { color: #d1d5db; }
.info-plot {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 4px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Season tabs */
.season-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
}
.season-tab {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 1rem;
    background: #374151;
    color: #9ca3af;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}
.season-tab:hover { background: #4b5563; }
.season-tab.active { background: #2563eb; color: white; }

/* Episode number badge */
.ep-number {
    min-width: 3rem;
    padding: 0.25rem 0.5rem;
    background-color: #374151;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    flex-shrink: 0;
    color: #9ca3af;
}

/* Movie detail panel (replaces video area) */
.movie-detail-panel {
    position: absolute;
    inset: 0;
    background: #111827;
    display: flex;
    padding: 2rem;
    gap: 2rem;
    overflow-y: auto;
    z-index: 20;
}
.md-poster {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.md-poster img {
    width: 100%;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.md-info { flex: 1; min-width: 0; }
.md-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.md-genre { font-size: 0.85rem; color: #60a5fa; margin-bottom: 0.5rem; }
.md-rating { font-size: 0.9rem; margin-bottom: 0.75rem; }
.md-meta { font-size: 0.85rem; color: #9ca3af; margin-bottom: 0.375rem; }
.md-meta b { color: #d1d5db; }
.md-plot {
    font-size: 0.85rem;
    color: #d1d5db;
    line-height: 1.6;
    margin-top: 0.75rem;
    margin-bottom: 1rem;
}
.md-play-btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 0.5rem;
}
.md-play-btn:hover { background: #1d4ed8; }

/* Favorite button */
.fav-btn {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    flex-shrink: 0;
    font-size: 0.85rem;
    transition: color 0.15s;
}
.fav-btn:hover { color: #f472b6; }
.fav-btn.active { color: #ec4899; }
.fav-btn.active i { font-weight: 900; }

/* Settings */
.settings-tab {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 0.5rem;
    background: #374151;
    color: #9ca3af;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}
.settings-tab:hover { background: #4b5563; }
.settings-tab.active { background: #2563eb; color: white; }

.settings-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.8rem;
    outline: none;
    transition: border-color 0.15s;
    display: block;
}
.settings-input:focus { border-color: #2563eb; }
.settings-input:disabled { opacity: 0.5; cursor: not-allowed; }

.provider-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #374151;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
}
.provider-item.active { border: 1px solid #2563eb; }

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #1f2937;
}

::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Modal animations */
.modal-enter {
    animation: modalEnter 0.3s ease-out;
}

.modal-leave {
    animation: modalLeave 0.3s ease-in;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes modalLeave {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Channel list animations */
.channel-item-enter {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Toast Notifications ── */
.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    animation: toastIn 0.3s ease-out;
    max-width: 320px;
    min-width: 200px;
}
.toast.success { background: #065f46; border-left: 3px solid #10b981; }
.toast.error { background: #7f1d1d; border-left: 3px solid #ef4444; }
.toast.info { background: #1e3a5f; border-left: 3px solid #3b82f6; }
.toast.warning { background: #78350f; border-left: 3px solid #f59e0b; }
.toast.removing { animation: toastOut 0.3s ease-in forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ── Splash / Loader ── */
.pulse-icon { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}
.loader-bar {
    width: 120px;
    height: 3px;
    background: #374151;
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}
.loader-fill {
    width: 40%;
    height: 100%;
    background: #3b82f6;
    border-radius: 2px;
    animation: loaderSlide 1s ease-in-out infinite;
}
@keyframes loaderSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* ── Skeleton Loading ── */
.skeleton {
    background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.375rem;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}
.skeleton-icon { width: 3rem; height: 3rem; border-radius: 0.75rem; }
.skeleton-line { height: 0.75rem; border-radius: 0.25rem; }
.skeleton-line.w-40 { width: 10rem; }
.skeleton-line.w-24 { width: 6rem; }
.skeleton-line.w-full { width: 100%; }

/* ── Sidebar (desktop & mobile) ── */
.sidebar-panel {
    width: 320px;
    min-width: 320px;
    transition: transform 0.3s ease;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
    backdrop-filter: blur(2px);
}

.mobile-top-bar { display: none; }

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
    .sidebar-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 50;
        width: 85vw;
        min-width: unset;
        max-width: 320px;
        transform: translateX(-100%);
    }
    .sidebar-panel.open { transform: translateX(0); }

    .mobile-top-bar { display: flex !important; }

    .movie-detail-panel {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    .md-poster { width: 120px; }
    .md-title { font-size: 1.1rem; }

    .channel-item { padding: 0.5rem; }
    .channel-logo { width: 2rem; height: 2rem; }

    .section-icon { width: 2.5rem; height: 2.5rem; font-size: 1rem; }
    .section-label { font-size: 0.9rem; }

    .info-card { flex-direction: column; }
    .info-cover { width: 100%; height: auto; max-height: 200px; object-fit: contain; }
}

/* ── Custom Player Controls ── */
.player-controls {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(transparent 40%, rgba(0,0,0,0.7) 100%);
    opacity: 0;
    transition: opacity 0.3s;
    cursor: pointer;
}
.player-controls.visible { opacity: 1; }
.player-controls.always-show { opacity: 1; }

/* Center play/seek buttons */
.pc-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 2rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.player-controls.visible .pc-center,
.player-controls.always-show .pc-center {
    opacity: 1;
    pointer-events: auto;
}

.pc-play-btn {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pc-play-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.1); }

.pc-seek-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    border: none;
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    line-height: 1;
}
.pc-seek-btn span { font-size: 0.6rem; font-weight: 700; margin-top: -2px; }
.pc-seek-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.1); }

/* Prev/Next nav buttons */
.pc-nav-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pc-nav-btn:hover { background: rgba(255,255,255,0.2); color: white; transform: scale(1.1); }
.pc-nav-btn:disabled { opacity: 0.25; cursor: default; transform: none; }
.pc-nav-btn:disabled:hover { background: rgba(255,255,255,0.08); transform: none; }

/* Prev/Next info labels */
.pc-nav-info {
    display: flex;
    justify-content: space-between;
    padding: 0 0.25rem;
    margin-bottom: 0.25rem;
}
.pc-nav-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.5);
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pc-nav-label:last-child { text-align: right; }

/* Bottom bar */
.pc-bottom {
    padding: 0 0.75rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    pointer-events: auto;
}

/* Progress bar */
.pc-progress-wrap {
    position: relative;
    height: 20px;
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0.25rem;
}
.pc-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    transition: height 0.15s;
}
.pc-progress-wrap:hover .pc-progress-bar { height: 6px; }

.pc-progress-buffered {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255,255,255,0.25);
    border-radius: 2px;
    transition: width 0.1s;
}
.pc-progress-played {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: #3b82f6;
    border-radius: 2px;
    transition: width 0.1s;
}
.pc-progress-thumb {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #3b82f6;
    border: 2px solid white;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}
.pc-progress-wrap:hover .pc-progress-thumb { opacity: 1; }

/* Bottom controls row */
.pc-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pc-time {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.8);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.pc-spacer { flex: 1; }
.pc-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    padding: 0.25rem;
    font-size: 0.85rem;
    transition: color 0.15s;
}
.pc-btn:hover { color: white; }

.pc-volume {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.pc-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
}
.pc-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
}

.pc-speed {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 0.7rem;
    padding: 0.15rem 0.25rem;
    border-radius: 0.25rem;
    cursor: pointer;
    outline: none;
}
.pc-speed option { background: #1f2937; color: white; }

/* Seek indicator animation */
.seek-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    animation: seekPop 0.6s ease-out forwards;
    pointer-events: none;
}
.seek-indicator.left { left: 20%; }
.seek-indicator.right { right: 20%; }
@keyframes seekPop {
    0% { opacity: 1; transform: translateY(-50%) scale(1); }
    100% { opacity: 0; transform: translateY(-50%) scale(1.3); }
}

@media (max-width: 768px) {
    .pc-center { gap: 1rem; }
    .pc-play-btn { width: 3rem; height: 3rem; font-size: 1rem; }
    .pc-seek-btn { width: 2.25rem; height: 2.25rem; font-size: 0.65rem; }
    .pc-nav-btn { width: 2rem; height: 2rem; font-size: 0.75rem; }
    .pc-volume { display: none; }
    .pc-bottom { padding: 0 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px)); }
}

/* ── Favorites Drag & Drop ── */
.fav-draggable { transition: background 0.15s; }
.fav-dragging {
    opacity: 0.85;
    background: #1e293b !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    border-radius: 0.5rem;
}
.fav-placeholder, .fav-group-placeholder {
    background: rgba(59, 130, 246, 0.1);
    border: 2px dashed rgba(59, 130, 246, 0.3);
    border-radius: 0.5rem;
    transition: height 0.15s;
}
.fav-group-header {
    display: flex;
    align-items: center;
    user-select: none;
}
.fav-items-container { min-height: 4px; }
.fav-drag-grip, .fav-group-grip {
    touch-action: none;
}

/* ── Fade transitions ── */
.fade-in { animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
