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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--card-bg);
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.btn-back {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn-back:hover {
    background: var(--primary-hover);
}

.breadcrumb-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Server Selection */
.server-selection {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.server-selection h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.server-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.server-card {
    background: var(--background);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.server-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.server-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.server-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.server-info {
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 5px;
}

.server-categories {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Category View */
.category-view {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.category-view h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.category-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.category-card {
    background: var(--background);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.category-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.category-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.category-count {
    font-size: 0.95rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Channel View */
.channel-view {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.channel-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
}

.channel-header h2 span {
    color: var(--primary-color);
}

.channel-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input {
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    min-width: 250px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn-secondary:hover {
    background: #475569;
}

.channel-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.channel-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.channel-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateX(3px);
}

.channel-logo {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 15px;
    border: 1px solid var(--border-color);
}

.channel-logo-placeholder {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    border-radius: 8px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 1.5rem;
}

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

/* Common Elements */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #fecaca;
}

.no-results {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: 40px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .channel-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .channel-controls {
        width: 100%;
        flex-direction: column;
    }

    .search-input {
        width: 100%;
        min-width: auto;
    }

    .btn-secondary {
        width: 100%;
    }

    .server-list,
    .category-list {
        grid-template-columns: 1fr;
    }

    .channel-list-grid {
        grid-template-columns: 1fr;
    }

    .breadcrumb {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .btn-back {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .header {
        padding: 25px 15px;
    }

    .server-selection,
    .category-view,
    .channel-view {
        padding: 20px;
    }
}

/* Mode Selection */
.mode-selection {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.mode-selection h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.mode-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.mode-card {
    background: var(--background);
    padding: 30px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.mode-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.mode-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.mode-name {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.mode-info {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* VOD Type Selection */
.vod-type-selection {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.vod-type-selection h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.vod-type-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.vod-type-card {
    background: var(--background);
    padding: 30px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.vod-type-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.vod-type-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
}

.vod-type-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.vod-type-info {
    font-size: 0.95rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Movies View */
.movie-categories-view, .movies-view {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.movie-categories-view h2, .movies-view h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.movies-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.movies-header h2 span {
    color: var(--primary-color);
}

.movies-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.movies-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.movie-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.movie-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.movie-poster, .movie-poster-placeholder {
    width: 100%;
    height: 240px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 12px;
}

.movie-poster-placeholder {
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
}

.movie-name {
    text-align: center;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.3;
}

/* Series View */
.series-list-view {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.series-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.series-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
}

.series-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.series-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.series-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.series-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateX(3px);
}

.series-poster, .series-poster-placeholder {
    width: 80px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-right: 15px;
}

.series-poster-placeholder {
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
}

.series-info {
    flex: 1;
}

.series-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.series-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Seasons View */
.seasons-view {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.seasons-view h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.seasons-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.season-card {
    background: var(--background);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.season-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.season-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.season-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.season-count {
    font-size: 0.95rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* Episodes View */
.episodes-view {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.episodes-header h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5rem;
}

.episodes-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.episode-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
}

.episode-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateX(3px);
}

.episode-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin-right: 15px;
}

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

/* Responsive adjustments for VOD */
@media (max-width: 768px) {
    .mode-list, .vod-type-list {
        grid-template-columns: 1fr;
    }

    .movies-list-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .series-list-grid, .seasons-list {
        grid-template-columns: 1fr;
    }

    .episodes-list-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-spinner {
    text-align: center;
    background: var(--background);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Disable pointer events on body when loading */
body.loading {
    overflow: hidden;
}

body.loading .container {
    pointer-events: none;
    user-select: none;
}

/* Global Search Section */
.global-search {
    background: var(--background);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 2px solid var(--border-color);
}

.global-search h2 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.search-subtitle {
    color: var(--text-secondary);
    margin: 0 0 20px 0;
    font-size: 0.95rem;
}

.search-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-tab {
    flex: 1;
    padding: 12px 20px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
}

.search-tab:hover {
    border-color: var(--primary-color);
    color: var(--text-primary);
}

.search-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.search-input-container {
    display: flex;
    gap: 10px;
}

.global-search-input {
    flex: 1;
    padding: 15px 20px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.global-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--background);
}

.global-search-input::placeholder {
    color: var(--text-secondary);
}

.btn-search {
    padding: 15px 30px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.btn-clear {
    padding: 15px 20px;
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.btn-clear:hover {
    border-color: #ef4444;
    color: #ef4444;
}

/* Search Results */
.search-results-view {
    margin-bottom: 30px;
}

.search-results-header {
    background: var(--background);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
    border: 2px solid var(--primary-color);
}

.search-results-header h2 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.search-stats {
    color: var(--text-secondary);
    margin: 0;
    font-size: 1rem;
}

.search-stats span {
    color: var(--primary-color);
    font-weight: 600;
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.server-results-card {
    background: var(--background);
    padding: 25px;
    border-radius: 15px;
    border: 2px solid var(--border-color);
}

.server-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.server-results-name {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.server-results-count {
    background: var(--primary-color);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

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

.result-item {
    background: var(--card-bg);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

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

.result-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.result-item-category {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.result-item-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 8px;
}

.no-search-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-search-results .icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.no-search-results h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Responsive adjustments for search */
@media (max-width: 768px) {
    .search-tabs {
        flex-direction: column;
    }

    .search-input-container {
        flex-direction: column;
    }

    .btn-search, .btn-clear {
        width: 100%;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }
}
