/* =============================================================== */
/* Modern & Minimalist IPTV Web Player (v2 - Refined Modals)       */
/* Design Focus: Typography, Color & Clarity                       */
/* =============================================================== */

/* --- 1. Global Styles & New Color Palette --- */
:root {
    --bg-dark: #111827;       /* Main background color - Dark Slate Blue */
    --surface-color: #1F2937;  /* Card and Modal background - Lighter Slate */
    --border-color: #374151;  /* Borders for cards and elements */
    --accent-color: #14b8a6;   /* Main accent color - Teal */
    --accent-hover: #10a392;   /* A slightly darker teal for hover effects */
    --accent-gradient: linear-gradient(90deg, #14b8a6, #a855f7); /* Teal to Purple Gradient */
    
    --text-primary: #F9FAFB;   /* For headings and primary text */
    --text-secondary: #9CA3AF; /* For less important text like dates, details */
    
    --live-red: #f44336;
    --scheduled-yellow: #ffc107;
    --ended-gray: #6c757d;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-dark);
    min-height: 100vh;
    padding: 24px;

    /* ge-added: Set a minimum width and allow horizontal scrolling if needed */
    min-width: 320px;
    overflow-x: auto;
}

/* --- 2. Main Layout --- */
.main-container {
    max-width: 960px;
    margin: 0 auto;
}

/* ge-changed: Updated Header Styling */
.app-header {
    text-align: center; /* Center the h1 */
    margin-bottom: 40px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.app-header h1 {
    font-size: 1.8em;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--text-primary);
}


/* --- ge-added: NEW Menu Button & Dropdown Styles --- */
.menu-container {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 100;
}

#menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

#menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#menu-btn svg {
    fill: var(--text-secondary);
    width: 24px;
    height: 24px;
}
#menu-btn:hover svg {
    fill: var(--text-primary);
}


.dropdown-menu {
    display: none; /* Hidden by default */
    position: absolute;
    top: 120%; /* Position below the button */
    left: 0;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    padding: 8px;
    width: 150px; /* Set a width for the dropdown */
}

.dropdown-menu.visible {
    display: block; /* Show when 'visible' class is added */
}

#about-btn {
    width: 100%;
    padding: 10px 12px;
    font-size: 1em;
    font-weight: 600;
    text-align: left;
    color: var(--text-primary);
    background-color: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#about-btn:hover {
    background-color: var(--accent-color);
}
/* --- End of NEW Styles --- */

#channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

/* --- 3. Redesigned Solid Color Card --- */
.channel-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: border-color 0.3s ease, transform 0.3s ease;
}

.channel-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.85em;
    font-weight: 600;
}

.match-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 700;
    color: #fff;
}

.status-live { background-color: var(--live-red); }
.status-scheduled { background-color: var(--scheduled-yellow); color: #111; }
.status-ended { background-color: var(--ended-gray); }
.status-movie, .status-music { background-color: #6366f1; /* Indigo */ }

.match-details {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.teams {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 1.25em;
    font-weight: 700;
    color: var(--text-primary);
}

.match-time {
    font-size: 1.5em;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
    color: var(--text-primary);
}

.match-time span {
    display: block;
    font-size: 0.6em;
    font-weight: 400;
    color: var(--text-secondary);
}

.card-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.match-date {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text-secondary);
}

.watch-button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.watch-button:hover {
    background-color: var(--accent-hover);
}

/* --- 4. Category Filter Styles --- */
.category-filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-bottom: 40px;
}

.category-filters-container button {
    padding: 10px 24px;
    font-size: 1em;
    font-weight: 600;
    color: var(--text-secondary);
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-filters-container button:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.category-filters-container button.active {
    color: var(--bg-dark);
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}


/* --- 5. Modal Styles (Colorful Redesign) --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
    background-image: radial-gradient(ellipse at center, #1c233c, #0b0f1a);
    backdrop-filter: blur(4px);
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    position: relative;
    padding: 0;
    text-align: left;
    width: 90%;
    max-width: 480px;
    border-radius: 16px;
    overflow: hidden;
    transform: scale(0.95) translateY(15px);
    transition: transform 0.3s ease-in-out;
    background: linear-gradient(135deg, #6d28d9, #be185d, #d97706);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    color: #ffffff;
}

.modal-overlay.visible .modal-content {
    transform: scale(1) translateY(0);
}

.modal-content h2 {
    font-size: 1.5rem;
    padding: 30px 30px 0 30px;
    margin-bottom: 20px;
    text-align: center;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.modal-content .about-text {
    padding: 0 30px;
}
.modal-content .about-text p {
    margin-bottom: 15px;
    font-size: 0.95em;
    line-height: 1.8;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.modal-content .disclaimer {
    background-color: rgba(0, 0, 0, 0.25);
    border-left: 4px solid #facc15;
    padding: 12px 15px;
    margin: 20px 0;
    border-radius: 4px;
    font-size: 0.9em;
    color: #ffffff;
}

.dev-credit-wrapper {
    background-color: rgba(0, 0, 0, 0.2);
    margin-top: 30px;
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.dev-credit-wrapper .dev-credit {
    font-size: 0.9em;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
    margin-bottom: 8px;
}

.dev-credit-wrapper .developer-name {
    font-size: 1.8em;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
}

.dev-credit-wrapper .copyright {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0;
}

#close-modal-btn, #close-server-modal-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
    background: transparent;
    border: none;
    width: 30px;
    height: 30px;
    font-size: 20px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
}

#close-modal-btn:hover, #close-server-modal-btn:hover {
    color: #ffffff;
    transform: scale(1.1);
}

/* --- 6. Server Selection Modal (Simplified for consistency) --- */
#server-modal .modal-content {
    padding: 30px;
}
.server-list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.server-list-container button {
    display: block;
    width: 100%;
    padding: 16px;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--bg-dark);
    background-color: var(--accent-color);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.server-list-container button:hover {
    background-color: var(--accent-hover);
}


/* --- 7. Player Active State (Unchanged) --- */
.player-wrapper { display: none; }
body.player-active .playlist-wrapper { display: none; }
body.player-active .main-container { max-width: 100%; padding: 0; }
body.player-active .player-wrapper {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #000;
    z-index: 1000;
}
#video-player { width: 100%; height: 100%; }
#close-player-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1001;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    font-size: 20px;
    line-height: 38px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}
#close-player-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}
/* --- All previous CSS code remains unchanged --- */
/* ... */

/* --- 8. ge-added: Loading Spinner Styles --- */

/* The full-screen overlay for the loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-dark); /* Same as body background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

/* The actual spinning circle */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color); /* The faint circle */
    border-top: 4px solid var(--accent-color); /* The spinning part */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Initially hide the main content */
.main-container {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* When body has 'loading-done' class, hide loader and show content */
body.loading-done .loader-overlay {
    opacity: 0;
    pointer-events: none; /* Make it unclickable when hidden */
}

body.loading-done .main-container {
    visibility: visible;
    opacity: 1;
}
/* --- All previous CSS code remains unchanged --- */
/* ... */

/* ge-added: New status style for finished matches */
.status-finished { 
    background-color: var(--ended-gray); 
}