/* DESIGN SYSTEM & TOKENS */
:root {
    --bg-dark: #07050f;
    --bg-medium: #0f0d1e;
    --accent: #8b5cf6;
    --accent-glow: #ec4899;
    --text-white: #ffffff;
    --text-muted: #a5a1b8;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-hover: rgba(255, 255, 255, 0.12);
    --font-stack: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: var(--font-stack);
    overflow-x: hidden;
    min-height: 100vh;
    background-image: radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.1) 0%, transparent 40%);
    background-attachment: fixed;
}

/* APP CONTAINER */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    padding-bottom: 24px;
}

/* TOP BAR */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(7, 5, 15, 0.6);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    font-size: 24px;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent), var(--accent-glow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-title {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 1px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* SCREENS LAYOUT */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    animation: fadeIn 0.4s ease;
}

.hidden {
    display: none !important;
}

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

/* GLASS CARD */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 20px;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

/* LOGIN CARD */
.login-card {
    width: 100%;
    max-width: 400px;
    margin: auto;
    text-align: center;
    border-radius: 24px;
    padding: 28px;
}

.login-card h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* INPUTS & FIELDS */
.input-group {
    display: flex;
    flex-direction: column;
    text-align: left;
    margin-bottom: 14px;
    width: 100%;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.input-group input, .input-group select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 12px;
    color: var(--text-white);
    font-family: var(--font-stack);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.input-group input:focus, .input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.select-group select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}

/* BUTTONS */
button {
    font-family: var(--font-stack);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
}

button:active {
    transform: scale(0.97);
}

.primary-btn {
    background: var(--accent);
    color: var(--text-white);
    font-weight: 700;
    font-size: 15px;
    width: 100%;
    padding: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.primary-btn:hover {
    background: #7c4dff;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.icon-btn-text {
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn-text:hover {
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.05);
}

.icon-btn-text.logout:hover {
    color: #ef4444;
}

.icon-btn {
    background: transparent;
    color: var(--text-white);
    font-size: 16px;
    padding: 10px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

/* HOME BANNER */
.promo-banner {
    background: linear-gradient(135deg, var(--accent), var(--accent-glow));
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 22px;
    margin-bottom: 24px;
    border: none;
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.25);
}

.banner-content h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.banner-content p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
}

.banner-btn {
    background: var(--text-white);
    color: var(--bg-dark);
    font-weight: 700;
    font-size: 13px;
    padding: 12px 18px;
    white-space: nowrap;
}

.banner-btn:hover {
    background: #e2e8f0;
}

/* CATEGORY MAIN CARDS */
.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.category-main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.main-cat-card {
    height: 100px;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

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

.main-cat-card.live { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.main-cat-card.movies { background: linear-gradient(135deg, #059669, #10b981); }
.main-cat-card.series { background: linear-gradient(135deg, #d97706, #f59e0b); }
.main-cat-card.epg { background: linear-gradient(135deg, #7c3aed, #db2777); }

.main-cat-card i {
    font-size: 28px;
}

.main-cat-card h4 {
    font-size: 15px;
    font-weight: 700;
}

.main-cat-card p {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
}

/* SETTINGS & PROFILE GRID */
.settings-profile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 10px;
}

@media(min-width: 600px) {
    .settings-profile-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.settings-profile-grid h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-white);
}

.profile-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-info-row span {
    color: var(--text-muted);
}

.status-active {
    color: #10b981;
}

/* NAV HEADERS */
.nav-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.nav-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.back-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* CATEGORIES LIST VIEW */
.filter-search-container {
    margin-bottom: 16px;
}

.filter-search-container input {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px;
    color: var(--text-white);
    width: 100%;
    font-family: var(--font-stack);
    font-size: 14px;
    outline: none;
}

.filter-search-container input:focus {
    border-color: var(--accent);
}

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

.category-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.category-row:hover {
    background: var(--glass-hover);
}

.category-row-name {
    font-size: 14px;
    font-weight: 500;
    flex-grow: 1;
}

.category-row-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hide-cat-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    padding: 6px;
}

.hide-cat-btn:hover {
    color: #ef4444;
}

/* SPORTS FILTER BAR */
.sports-filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 10px;
    margin-bottom: 12px;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.sports-filter-bar::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome/Safari */
}

.sports-filter-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sports-filter-btn:hover, .sports-filter-btn.active {
    background: var(--accent);
    color: var(--text-white);
    border-color: var(--accent);
}

.sports-ai-verify-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-glow));
    color: var(--text-white);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* MEDIA GRID ITEMS */
.media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

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

.grid-item {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.grid-item:hover {
    transform: translateY(-4px);
}

.grid-item-card {
    aspect-ratio: 0.7;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-item-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-item-card .placeholder-icon {
    font-size: 28px;
    color: rgba(255, 255, 255, 0.2);
}

.grid-item-card .rating-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(7, 5, 15, 0.85);
    border-radius: 6px;
    padding: 2px 5px;
    font-size: 9px;
    font-weight: 700;
    color: #f59e0b;
}

.grid-item-title {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 2px;
}

/* LIVE CHANNEL SPECIAL ROW */
.media-grid.live-grid {
    grid-template-columns: repeat(2, 1fr);
}

.live-item-card {
    aspect-ratio: auto;
    height: 80px;
    padding: 10px;
    flex-direction: row;
    gap: 12px;
    align-items: center;
    justify-content: flex-start;
}

.live-logo-box {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.live-logo-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.live-logo-box span {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-muted);
}

/* SERIES DETAILS HEADER */
.series-header-info {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.series-cover-box {
    width: 100px;
    aspect-ratio: 0.7;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
}

.series-cover-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.series-text-info h2 {
    font-size: 20px;
    font-weight: 700;
}

/* TAB ROW FOR SEASONS */
.tabs-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
    scrollbar-width: none;
}

.tabs-row::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    border-bottom: 2px solid transparent;
    border-radius: 0;
}

.tab-btn.active {
    color: var(--text-white);
    border-bottom-color: var(--accent);
}

/* EPISODES & MATCHES LIST */
.episodes-list, .ai-results-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.episode-card, .ai-match-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s ease;
}

.episode-card:hover, .ai-match-card:hover {
    background: var(--glass-hover);
}

.episode-info, .ai-match-info {
    flex: 1;
}

.episode-info h5, .ai-match-header {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
}

.episode-info p {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

.play-circle-box {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-white);
    margin-left: 12px;
}

/* AI SEARCH UI */
.ai-search-box {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.ai-search-box input {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px;
    color: var(--text-white);
    font-family: var(--font-stack);
    font-size: 14px;
    outline: none;
    flex-grow: 1;
}

.ai-search-box input:focus {
    border-color: var(--accent);
}

.ai-search-box button {
    width: auto;
    padding: 0 20px;
}

.ai-match-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.confidence-badge {
    background: rgba(139, 92, 246, 0.2);
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 10px;
    color: #c084fc;
    font-weight: 700;
}

.ai-match-reason {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* LOADER / SPINNER */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    gap: 16px;
    flex-grow: 1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.05);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* VIDEO PLAYER SCREEN */
.player-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--glass-border);
}

.player-container video {
    width: 100%;
    height: 100%;
}

.player-header-overlay {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

#player-stream-title {
    font-size: 15px;
    font-weight: 600;
}

.player-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 5, 15, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 20px;
}

.player-error i {
    font-size: 36px;
    color: #ef4444;
}

.player-error p {
    font-size: 13px;
    color: var(--text-white);
    text-align: center;
}

/* MODAL FOR HIDDEN CATEGORIES */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 5, 15, 0.75);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    width: 100%;
    max-width: 450px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
}

.hidden-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.hidden-item-row span {
    font-size: 13px;
}

.unhide-btn {
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc;
    font-size: 11px;
    padding: 6px 12px;
    font-weight: 600;
}

.unhide-btn:hover {
    background: var(--accent);
    color: var(--text-white);
}

/* EPG GUIDE STYLING */
.epg-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.epg-item.live {
    cursor: pointer;
    border-left: 4px solid var(--accent);
}

.epg-item.live:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: var(--glass-hover);
}

.epg-item-logo {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.epg-item-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.epg-item-logo i {
    font-size: 20px;
    color: var(--text-muted);
}

.epg-item-info {
    flex: 1;
    min-width: 0; /* for text truncate */
}

.epg-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.epg-channel-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
}

.epg-live-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    padding: 2px 6px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.epg-time-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 6px;
}

.epg-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-white);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.epg-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.epg-time-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.epg-progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.epg-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-glow));
    border-radius: 2px;
}

.epg-time-text {
    font-size: 10px;
    color: var(--text-muted);
}

.epg-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.epg-item.live:hover .epg-play-btn {
    opacity: 1;
}

.epg-section-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 18px 0 8px 0;
}

.epg-ai-verify-btn {
    font-size: 10px;
    font-weight: 700;
    background: rgba(139, 92, 246, 0.15);
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 2px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto; /* Push to the right in flex header */
    transition: all 0.2s ease;
}

.epg-ai-verify-btn:hover {
    background: var(--accent);
    color: var(--text-white);
    box-shadow: 0 0 8px var(--accent-glow);
}
