/* Styles */

:root {
    --bg-base: #0d0d0f;
    --bg-card: #151518;
    --bg-elevated: #1c1c21;
    --bg-hover: #232329;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --youtube-red: #ff0000;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border: #27272a;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

/* Web Video Cast Banner */
.wvc-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.wvc-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.wvc-text {
    flex: 1;
    font-size: 0.85rem;
    line-height: 1.4;
}

.wvc-text strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.wvc-text span {
    color: var(--text-secondary);
}

.wvc-text b {
    color: var(--accent);
}

.wvc-dismiss {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.wvc-dismiss:hover {
    border-color: var(--error);
    color: var(--error);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--bg-base);
    z-index: 100;
}

.logo { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.logo-icon { font-size: 1.5rem; }
.logo-text { font-size: 1.25rem; font-weight: 600; }

.header-status { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-secondary); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.offline { background: var(--text-muted); }
.status-dot.loading { background: var(--warning); animation: pulse 1.5s infinite; }
.status-dot.online { background: var(--success); }
.status-dot.error { background: var(--error); }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Main */
.main { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 16px 0; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

#searchSection {
    overflow: visible;
    z-index: 150;
    position: relative;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.card-body { padding: 16px; }

/* Search */
.search-wrapper {
    display: flex;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    position: relative;
}

.search-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Suggestions Dropdown */
.suggestions-box {
    position: absolute;
    top: calc(100% + 4px);
    left: -1px;
    right: -1px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    max-height: 350px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.suggestions-box.hidden { display: none; }

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: var(--bg-hover); }

.suggestion-poster {
    width: 40px;
    height: 56px;
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.suggestion-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

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

.suggestion-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

#searchInput {
    flex: 1;
    padding: 14px 16px;
    font-size: 1rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    outline: none;
}

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

.btn-search {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: white;
    cursor: pointer;
}

.btn-search:hover { background: var(--accent-hover); }
.btn-search svg { width: 20px; height: 20px; }

/* Results */
.results-header { padding: 8px 0; font-size: 0.875rem; color: var(--text-secondary); }

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.result-card:hover { border-color: var(--accent); transform: translateY(-2px); }

.result-poster {
    aspect-ratio: 2/3;
    background: var(--bg-elevated);
    position: relative;
}

.result-poster img { width: 100%; height: 100%; object-fit: cover; }
.result-poster .no-poster { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 3rem; color: var(--text-muted); }

.result-type {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 6px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--accent);
    color: white;
    border-radius: 4px;
}

.result-score {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0,0,0,0.8);
    color: var(--warning);
    border-radius: 4px;
}

.result-info { padding: 10px; }
.result-title {
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.result-year { font-size: 0.75rem; color: var(--text-muted); }

/* Detail */
.detail-header { display: flex; gap: 16px; padding: 16px; }
.detail-poster { width: 120px; flex-shrink: 0; }
.detail-poster img { width: 100%; border-radius: var(--radius-sm); }
.detail-info { flex: 1; }
.detail-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 8px; }
.detail-original { font-size: 0.875rem; color: var(--text-muted); font-style: italic; margin-bottom: 8px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.detail-genres { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.detail-tag { padding: 4px 8px; font-size: 0.75rem; background: var(--bg-elevated); border-radius: 4px; color: var(--text-secondary); }
.detail-tag.score { background: var(--warning); color: #000; font-weight: 600; }
.detail-plot { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 12px; }
.detail-cast { font-size: 0.8125rem; color: var(--text-muted); }
.detail-cast strong { color: var(--text-secondary); }
.detail-actions { padding: 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; }

/* Trailer Inline Section */
.trailer-section {
    margin: 16px;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    overflow: hidden;
}

.trailer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.trailer-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.trailer-lang {
    font-size: 0.7rem;
    color: var(--success);
    background: rgba(34, 197, 94, 0.15);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.trailer-lang-eng {
    color: var(--warning);
    background: rgba(245, 158, 11, 0.15);
}

.trailer-player-container {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trailer-load-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    background: transparent;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    margin: 16px;
    width: calc(100% - 32px);
}

.trailer-load-btn:hover {
    border-color: var(--youtube-red);
    color: var(--youtube-red);
    background: rgba(255, 0, 0, 0.05);
}

.trailer-load-btn svg {
    color: var(--youtube-red);
}

.trailer-load-btn span {
    font-size: 0.9rem;
    font-weight: 500;
}

.trailer-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted);
}

.trailer-player-inline {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
}

.trailer-player-inline iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.trailer-not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
}

.trailer-btn-small {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--youtube-red);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

.trailer-btn-small:hover {
    background: #cc0000;
}

/* Seasons & Episodes */
.seasons-list { padding: 16px; border-top: 1px solid var(--border); }

.season-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.watched-counter {
    font-size: 0.75rem;
    color: var(--success);
    text-transform: none;
    background: rgba(34, 197, 94, 0.1);
    padding: 4px 10px;
    border-radius: 12px;
}

.season-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

.season-tab {
    padding: 8px 16px;
    font-size: 0.875rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
}

.season-tab:hover { border-color: var(--accent); }
.season-tab.active { background: var(--accent); border-color: var(--accent); }

.ep-count { font-size: 0.75rem; color: var(--text-muted); }

.episodes-list { display: flex; flex-direction: column; gap: 8px; }

.episode-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.episode-item:hover { background: var(--bg-hover); }
.episode-item.is-watched { opacity: 0.7; background: var(--bg-card); }
.episode-item.is-watched .episode-title { text-decoration: line-through; color: var(--text-muted); }

.episode-number {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 50%;
    font-weight: 600;
    color: var(--accent);
}

.episode-info { flex: 1; }
.episode-title { font-size: 0.875rem; font-weight: 500; }
.episode-duration { font-size: 0.75rem; color: var(--text-muted); }

.episode-play {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: 50%;
    color: white;
}

.episode-play svg { width: 16px; height: 16px; }

/* Watched */
.watched-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
}

.watched-btn:hover { border-color: var(--success); color: var(--success); }
.watched-btn.watched { background: var(--success); border-color: var(--success); color: white; }
.watched-btn .check-icon { width: 18px; height: 18px; }

.btn-watched {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    gap: 8px;
}

.btn-watched:hover { border-color: var(--success); color: var(--success); }
.btn-watched.watched { background: var(--success); border-color: var(--success); color: white; }

/* Player */
.player-fullscreen {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.player-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: rgba(0,0,0,0.8);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.player-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 0.875rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
}

.player-back-btn svg { width: 18px; height: 18px; }
.player-title { flex: 1; font-size: 0.875rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.player-external-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 0.875rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    cursor: pointer;
    transition: var(--transition);
}

.player-external-btn:hover { background: var(--accent-hover); }
.player-external-btn svg { width: 16px; height: 16px; }

.video-container { flex: 1; position: relative; }

.embed-iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.player-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
}

.player-overlay.hidden { opacity: 0; pointer-events: none; }
.overlay-content { text-align: center; color: var(--text-secondary); }

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex: 1;
}

.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }

/* Footer */
.footer {
    padding: 16px 0;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.clear-cache-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    margin-bottom: 12px;
    font-size: 0.8125rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.clear-cache-btn:hover { background: var(--bg-elevated); border-color: var(--accent); }

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    z-index: 1001;
}

.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--error); }

/* Homepage */
.home-stats {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.stats-divider { margin: 0 12px; }

.home-categories {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 8px 16px 20px;
}

.category-chip {
    padding: 10px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.category-chip:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.home-section {
    margin-bottom: 24px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px 12px;
}

.section-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.clear-history-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
}

.clear-history-btn:hover { color: var(--error); }

.recent-searches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-chip {
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: var(--transition);
}

.recent-chip:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.content-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.content-row::-webkit-scrollbar { height: 6px; }
.content-row::-webkit-scrollbar-track { background: transparent; }
.content-row::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.content-row-loading, .content-row-error {
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 20px;
}

.content-card {
    flex-shrink: 0;
    width: 120px;
    cursor: pointer;
    transition: var(--transition);
}

.content-card:hover { transform: translateY(-4px); }

.content-poster {
    position: relative;
    width: 120px;
    height: 170px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 8px;
}

.content-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-poster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2.5rem;
    color: var(--text-muted);
}

.content-type-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--accent);
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 4px;
}

.content-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Utils */
.hidden { display: none !important; }
.loading-placeholder { text-align: center; padding: 40px; color: var(--text-muted); }

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    margin: 16px;
    font-size: 0.875rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.back-btn:hover { background: var(--bg-elevated); }
.back-btn svg { width: 16px; height: 16px; }

/* Live TV Section */
#liveSection {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.live-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.live-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.live-badge {
    padding: 4px 12px;
    background: var(--error);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 12px;
    animation: pulse 1.5s infinite;
}

.live-source {
    padding: 8px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0;
}

.live-source a {
    color: var(--accent);
    text-decoration: none;
}

.live-source a:hover {
    text-decoration: underline;
}

.no-matches {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.no-matches p {
    margin-bottom: 16px;
    font-size: 1rem;
}

.no-matches .btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

/* M3U Playlist Banner */
.m3u-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    margin: 16px;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(16, 185, 129, 0.1));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: var(--radius);
}

.m3u-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.m3u-content {
    flex: 1;
    min-width: 0;
}

.m3u-content strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.m3u-content p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.m3u-url-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

.m3u-url-box code {
    flex: 1;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.7rem;
    color: var(--success);
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.m3u-url-box .copy-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.m3u-url-box .copy-btn:hover {
    background: #16a34a;
    transform: scale(1.02);
}

.m3u-url-box .copy-btn:active {
    transform: scale(0.98);
}

/* Test Channels Banner */
.test-channels-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 0 16px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius);
}

.test-channels-btn {
    padding: 10px 20px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.test-channels-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

.test-hint {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Test Channels Modal */
.channels-test-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.channels-test-content {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}

.channels-test-content .close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
}

.channels-test-header {
    text-align: center;
    margin-bottom: 20px;
}

.channels-test-header h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.channels-test-header p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.channels-test-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.channel-test-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.channel-test-btn:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.channel-test-btn .channel-id {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-base);
    padding: 2px 6px;
    border-radius: 4px;
}

.channel-test-btn .channel-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Events list for PepperLive */
.pepper-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.pepper-link:hover {
    opacity: 0.9;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.event-category {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.event-category h4 {
    font-size: 0.9rem;
    color: var(--accent);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.event-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 6px;
    text-align: left;
}

.event-btn:last-child {
    margin-bottom: 0;
}

.event-btn:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.event-time {
    font-size: 0.75rem;
    color: var(--success);
    background: rgba(34, 197, 94, 0.15);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.event-name {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
}

.event-lang {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    padding: 3px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.live-category {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.live-category:last-child {
    border-bottom: none;
}

.live-category h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.live-channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.live-channel-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.live-channel-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.channel-icon {
    font-size: 2rem;
}

.channel-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.2;
}

/* Live TV Loading & Error */
.live-loading, .live-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 20px;
    color: var(--text-muted);
}

.live-error p {
    font-size: 1rem;
    color: var(--error);
}

/* Live Refresh Button */
.live-refresh-btn {
    margin-left: auto;
    padding: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.live-refresh-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Matches List */
.matches-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

.date-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 12px;
    margin-top: 16px;
    background: linear-gradient(135deg, var(--accent-glow), transparent);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
}

.date-header:first-child {
    margin-top: 0;
}

.date-icon {
    font-size: 1.3rem;
}

.date-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.match-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0 6px;
    margin-top: 4px;
}

.group-icon {
    font-size: 1.2rem;
}

.group-competition {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: capitalize;
}

.group-date {
    font-size: 0.8rem;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.match-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.match-card:hover {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.match-teams {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.match-teams .team {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.match-teams .vs {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: lowercase;
}

.match-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.match-time {
    font-size: 0.8rem;
    color: var(--warning);
}

.match-links {
    font-size: 0.7rem;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 4px 8px;
    border-radius: 10px;
}

/* Match Status Badges */
.match-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 12px;
}

.match-status.live {
    background: var(--error);
    color: white;
    animation: pulse 1.5s infinite;
}

.match-status.ended {
    background: var(--text-muted);
    color: var(--bg-base);
}

.match-status.scheduled {
    background: var(--warning);
    color: #000;
}

/* Match card states */
.match-card.is-live {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.match-card.is-live:hover {
    background: rgba(239, 68, 68, 0.2);
}

.match-card.is-ended {
    opacity: 0.6;
}

.match-card.is-ended:hover {
    opacity: 0.8;
}

/* Match Links Modal */
.match-links-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.match-links-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 400px;
    width: 100%;
}

.match-links-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.match-links-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.match-links-header .close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
}

.match-links-header .close-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

.match-links-body {
    padding: 16px;
}

.match-links-body p {
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.match-modal-time {
    color: var(--warning);
    font-weight: 600;
}

.match-modal-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 16px;
}

.match-modal-status {
    text-align: center;
    margin-bottom: 12px;
}

.yalla-fallback {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

/* Play Options Modal */
.play-options-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.play-options-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-width: 400px;
    width: 100%;
    overflow: hidden;
}

.play-options-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.play-options-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.play-options-header .close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
}

.play-options-header .close-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

.play-options-title {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.play-options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
}

.play-option-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.play-option-btn:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.play-option-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
}

.play-option-btn.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.play-option-btn.primary .option-label,
.play-option-btn.primary .option-desc {
    color: white;
}

.play-option-btn .option-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.play-option-btn .option-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.play-option-btn .option-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.play-options-hint {
    padding: 12px 16px;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg-base);
}

.match-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
}

.match-link-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
}

.match-link-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.match-link-btn-ext {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    min-width: 44px;
}

.match-link-btn-ext:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.match-links-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.hd-badge {
    background: var(--success);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
}

.viewers-badge {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 8px;
}

.match-modal-hint-small {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    margin-top: 8px;
}

/* HLS Video Player */
.hls-video-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: #000;
    object-fit: contain;
}

/* Stream Options Modal */
.stream-options {
    max-width: 350px;
}

.stream-success {
    color: var(--success);
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
}

.stream-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.stream-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.stream-option-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.stream-option-btn.secondary {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.stream-option-btn.secondary:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.stream-option-btn .option-icon {
    font-size: 1.5rem;
}

.stream-url-preview {
    font-size: 0.7rem;
    color: var(--text-muted);
    word-break: break-all;
    background: var(--bg-elevated);
    padding: 8px;
    border-radius: var(--radius-sm);
    text-align: center;
}

/* Live Tabs */
.live-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.live-tab {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.live-tab:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.live-tab.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* Channels Info */
.channels-info,
.events-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.channels-count,
.events-source {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Channels List */
.channels-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.channel-category {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--accent-glow), transparent);
    border-bottom: 1px solid var(--border);
}

.category-icon {
    font-size: 1.3rem;
}

.category-name {
    flex: 1;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.category-count {
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--bg-card);
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
}

/* Channels Grid */
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    padding: 16px;
}

.channel-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.channel-card:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
    transform: translateY(-2px);
}

.channel-card:active {
    transform: translateY(0);
}

.channel-logo {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: white;
}

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

.channel-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Responsive */
@media (max-width: 480px) {
    .app { padding: 0 12px; }
    .results-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .detail-header { flex-direction: column; }
    .detail-poster { width: 100%; max-width: 200px; margin: 0 auto; }
    .live-channels-grid { grid-template-columns: repeat(3, 1fr); }
    .channels-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
    .channel-logo { width: 50px; height: 50px; }
    .live-tab { padding: 10px 8px; font-size: 0.8rem; }
}

/* Admin Panel */
.admin-panel {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 99999;
    overflow-y: auto;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.admin-content {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 1px solid var(--border);
}

.admin-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.admin-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.admin-close:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.admin-section {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.admin-section:last-of-type {
    border-bottom: none;
}

.admin-section h3 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Connections */
.admin-connections {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.conn-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.conn-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.conn-dot.online { background: #4ecdc4; box-shadow: 0 0 8px #4ecdc4; }
.conn-dot.offline { background: #ff6b6b; box-shadow: 0 0 8px #ff6b6b; }
.conn-dot.loading {
    background: #ffd93d;
    animation: pulse 1s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.conn-latency {
    margin-left: auto;
    color: #4ecdc4;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.conn-domain {
    width: 100%;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conn-error {
    margin-left: auto;
    color: #ff6b6b;
}

/* Stats */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 12px;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Storage */
.admin-storage {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.storage-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.storage-info b {
    color: var(--text-primary);
}

.storage-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Admin buttons */
.admin-btn {
    padding: 10px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-btn:hover {
    filter: brightness(1.1);
}

.admin-btn.small {
    padding: 8px 12px;
    font-size: 0.8rem;
    background: var(--bg-base);
    color: var(--text-secondary);
}

.admin-btn.small:hover {
    background: var(--border);
    color: var(--text-primary);
}

.admin-btn.danger {
    background: #ff6b6b;
}

/* Errors */
.admin-errors {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    padding: 8px;
}

.no-errors {
    padding: 16px;
    text-align: center;
    color: #4ecdc4;
    font-size: 0.9rem;
}

.error-item {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.error-item:last-child {
    border-bottom: none;
}

.error-time {
    color: var(--text-muted);
    flex-shrink: 0;
}

.error-source {
    color: #ff6b6b;
    font-weight: 600;
    flex-shrink: 0;
}

.error-msg {
    color: var(--text-secondary);
    word-break: break-word;
}

/* System info */
.admin-sysinfo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.admin-sysinfo b {
    color: var(--text-muted);
    font-weight: 500;
}

/* Config */
.admin-config {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.config-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.config-toggle:hover {
    background: var(--border);
}

.config-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.config-toggle span {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Footer */
.admin-footer {
    padding: 12px 20px;
    background: var(--bg-base);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Header status clickable */
.header-status {
    cursor: pointer;
    user-select: none;
}

@media (max-width: 480px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Yalla Player Overlay - Embedded Stream Player */
.yalla-player-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.yalla-player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: rgba(0, 0, 0, 0.9);
    border-bottom: 1px solid var(--border);
    z-index: 10;
}

.yalla-player-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.yalla-player-title .live-badge {
    flex-shrink: 0;
}

.yalla-player-title .channel-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.yalla-player-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.yalla-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.yalla-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-hover);
}

.yalla-btn.yalla-close:hover {
    border-color: var(--error);
    color: var(--error);
}

.yalla-player-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.yalla-player-container .yalla-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: rgba(0, 0, 0, 0.8);
    z-index: 5;
    color: var(--text-secondary);
}

.yalla-player-container iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

.yalla-player-footer {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: rgba(0, 0, 0, 0.9);
    text-align: center;
    border-top: 1px solid var(--border);
}

.yalla-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Mobile adjustments for Yalla Player */
@media (max-width: 480px) {
    .yalla-player-header {
        padding: 10px 12px;
    }

    .yalla-player-title .channel-name {
        font-size: 0.9rem;
    }

    .yalla-btn {
        width: 36px;
        height: 36px;
    }

    .yalla-player-footer {
        padding: 10px 12px;
    }
}

/* ===== TMDB Integration Styles ===== */

/* Header con backdrop - gradiente più forte per leggibilità */
.detail-header.has-backdrop {
    background-size: cover;
    background-position: center top;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 16px;
    position: relative;
}

/* Overlay scuro per leggibilità testo */
.detail-header.has-backdrop::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.6) 50%,
        rgba(18, 18, 18, 0.95) 100%
    );
    border-radius: var(--radius);
    pointer-events: none;
    z-index: 0;
}

.detail-header.has-backdrop > * {
    position: relative;
    z-index: 1;
}

/* Text shadow per tutti i testi nell'header con backdrop */
.detail-header.has-backdrop .detail-title,
.detail-header.has-backdrop .detail-original,
.detail-header.has-backdrop .detail-plot {
    text-shadow:
        0 1px 3px rgba(0, 0, 0, 0.8),
        0 2px 8px rgba(0, 0, 0, 0.6);
}

.detail-header.has-backdrop .detail-plot {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: var(--radius-sm);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Ratings container */
.detail-ratings {
    display: flex;
    gap: 16px;
    margin: 12px 0;
    flex-wrap: wrap;
}

.rating-tmdb,
.rating-sc {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-elevated);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.rating-logo {
    font-weight: 700;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

.rating-tmdb .rating-logo {
    background: linear-gradient(135deg, #0d253f, #01b4e4);
    color: white;
}

.rating-sc .rating-logo {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
}

.rating-value {
    color: #fbbf24;
    font-weight: 600;
}

.rating-votes {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Certification badge */
.detail-tag.cert {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: white;
    font-weight: 600;
}

.detail-tag.quality {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
}

/* Cast con foto (TMDB) */
.tmdb-cast {
    margin: 20px 0;
}

.tmdb-cast h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.cast-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.cast-grid::-webkit-scrollbar {
    height: 4px;
}

.cast-grid::-webkit-scrollbar-track {
    background: var(--bg-elevated);
    border-radius: 2px;
}

.cast-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.cast-card {
    flex-shrink: 0;
    width: 100px;
    text-align: center;
    scroll-snap-align: start;
}

.cast-photo {
    width: 80px;
    height: 80px;
    margin: 0 auto 8px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cast-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cast-photo .no-photo {
    font-size: 2rem;
    color: var(--text-muted);
}

.cast-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cast-char {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Titoli simili */
.similar-section {
    margin: 24px 0;
}

.similar-section h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.similar-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.similar-grid::-webkit-scrollbar {
    height: 4px;
}

.similar-grid::-webkit-scrollbar-track {
    background: var(--bg-elevated);
    border-radius: 2px;
}

.similar-grid::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.similar-card {
    flex-shrink: 0;
    width: 110px;
    cursor: pointer;
    scroll-snap-align: start;
    transition: transform var(--transition);
}

.similar-card:hover {
    transform: scale(1.05);
}

.similar-card:active {
    transform: scale(0.98);
}

.similar-poster {
    width: 100%;
    aspect-ratio: 2/3;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.similar-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.similar-poster .no-poster {
    font-size: 2rem;
    color: var(--text-muted);
}

.similar-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

/* Mobile adjustments for TMDB elements */
@media (max-width: 480px) {
    .detail-header.has-backdrop {
        padding: 16px;
    }

    .detail-ratings {
        gap: 10px;
    }

    .rating-tmdb,
    .rating-sc {
        padding: 4px 8px;
        font-size: 0.85rem;
    }

    .cast-card {
        width: 85px;
    }

    .cast-photo {
        width: 65px;
        height: 65px;
    }

    .similar-card {
        width: 95px;
    }
}

/* ===== Fallback TMDB + JustWatch Styles ===== */

/* Notice banner per fallback */
.fallback-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(234, 179, 8, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.fallback-notice .notice-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.fallback-notice .notice-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.fallback-notice .notice-text strong {
    display: block;
    color: var(--warning);
    margin-bottom: 2px;
}

/* Card fallback */
.fallback-card {
    position: relative;
}

.fallback-card::after {
    content: 'INFO';
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 2px 6px;
    font-size: 0.6rem;
    font-weight: 700;
    background: var(--warning);
    color: #000;
    border-radius: 4px;
}

/* Header notice nella pagina dettaglio */
.fallback-header-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(234, 179, 8, 0.1));
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: var(--radius-sm);
    margin: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.fallback-header-notice .notice-icon {
    font-size: 1.2rem;
}

.fallback-header-notice strong {
    color: var(--warning);
}

/* Watch Providers Section */
.watch-providers-section {
    margin: 20px 16px;
    padding: 20px;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.watch-providers-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.watch-providers-section h3 .icon {
    font-size: 1.3rem;
}

/* Provider Group */
.provider-group {
    margin-bottom: 16px;
}

.provider-group:last-child {
    margin-bottom: 0;
}

.provider-group h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Provider List */
.provider-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Provider Item */
.provider-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    min-width: 80px;
}

.provider-item:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.provider-item img {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    object-fit: cover;
}

.provider-item span {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* JustWatch Link */
.justwatch-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #fcc21c, #f5a623);
    color: #000;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
}

.justwatch-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(252, 194, 28, 0.4);
}

.justwatch-link img {
    height: 18px;
    width: auto;
}

/* No Providers Message */
.no-providers {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.no-providers .icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
}

.no-providers p {
    margin-bottom: 8px;
}

.no-providers small {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Fallback Detail Actions - nessun pulsante play */
.fallback-detail-actions {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fallback-detail-actions .action-hint {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Mobile adjustments for Fallback */
@media (max-width: 480px) {
    .fallback-notice {
        padding: 12px;
    }

    .fallback-notice .notice-icon {
        font-size: 1.3rem;
    }

    .fallback-notice .notice-text {
        font-size: 0.85rem;
    }

    .watch-providers-section {
        margin: 16px 12px;
        padding: 16px;
    }

    .provider-item {
        padding: 8px;
        min-width: 70px;
    }

    .provider-item img {
        width: 40px;
        height: 40px;
    }

    .provider-item span {
        font-size: 0.65rem;
        max-width: 70px;
    }
}


