/* ========================================
   PROFESSIONAL LIVE TV APP - STYLESHEET
   ======================================== */

/* Root Variables */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #f39c12;
    --danger-color: #e74c3c;
    --success-color: #27ae60;
    --dark-bg: #1a1a2e;
    --light-bg: #16213e;
    --card-bg: #0f3460;
    --text-light: #ffffff;
    --text-gray: #bdc3c7;
    --border-color: #2a2a4e;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--light-bg) 100%);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* ========================================
   NAVBAR STYLES
   ======================================== */

.navbar {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.navbar-brand .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.navbar-brand .logo i {
    font-size: 28px;
    color: var(--accent-color);
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-links a {
    color: var(--text-gray);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
    border: 1px solid var(--primary-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 12px;
    color: var(--text-gray);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 24px;
    cursor: pointer;
}

/* ========================================
   MAIN CONTAINER
   ======================================== */

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ========================================
   HERO SECTION WITH PLAYER
   ======================================== */

.hero-section {
    margin-bottom: 40px;
}

.player-wrapper {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    background: rgba(15, 52, 96, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.video-container {
    position: relative;
    background: #000;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.video-container video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.player-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    opacity: 1;
    transition: var(--transition);
}

.player-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay-content {
    text-align: center;
}

.overlay-content i {
    font-size: 80px;
    color: var(--primary-color);
    margin-bottom: 20px;
    opacity: 0.7;
}

.overlay-content p {
    font-size: 16px;
    color: var(--text-gray);
}

/* ========================================
   PLAYER INFO PANEL
   ======================================== */

.player-info-panel {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: linear-gradient(180deg, rgba(102, 126, 234, 0.1) 0%, transparent 100%);
}

.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.channel-display h2 {
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--text-light);
}

.channel-subtitle {
    color: var(--text-gray);
    font-size: 12px;
}

.player-badges {
    display: flex;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-hd {
    background: rgba(39, 174, 96, 0.2);
    color: var(--success-color);
}

.badge-live {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger-color);
    animation: badge-blink 1s infinite;
}

@keyframes badge-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.live-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--danger-color);
    animation: pulse 1s infinite;
}

/* ========================================
   PLAYER CONTROLS
   ======================================== */

.player-controls-bar {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    flex-wrap: wrap;
}

.control-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-light);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.control-btn:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.control-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.control-spacer {
    flex: 1;
}

.stream-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    font-size: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.info-label {
    color: var(--text-gray);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.info-value {
    color: var(--primary-color);
    word-break: break-all;
    flex: 1;
    text-align: right;
}

/* ========================================
   SEARCH SECTION
   ======================================== */

.search-section {
    margin-bottom: 40px;
}

.search-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-bar-group {
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(15, 52, 96, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: var(--transition);
}

.search-input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
}

.search-input-wrapper i {
    color: var(--text-gray);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-light);
    outline: none;
    font-size: 14px;
}

.search-input::placeholder {
    color: var(--text-gray);
}

.clear-search-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
}

.clear-search-btn:hover {
    color: var(--primary-color);
}

.search-stats {
    display: flex;
    gap: 10px;
}

.channel-count {
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--primary-color);
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-gray);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ========================================
   CHANNELS GRID
   ======================================== */

.channels-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 28px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2 i {
    color: var(--accent-color);
}

.info-badge {
    padding: 8px 16px;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 600;
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.channel-item {
    position: relative;
    padding: 15px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, transparent 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.channel-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: var(--transition);
    z-index: -1;
}

.channel-item:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.channel-item:hover::before {
    opacity: 0.1;
}

.channel-item.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-color: var(--accent-color);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.channel-item-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.channel-item-logo {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    overflow: hidden;
}

.channel-item-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.channel-item-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-light);
    text-align: center;
    word-break: break-word;
}

.channel-item.active .channel-item-name {
    color: white;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   STATUS SECTION
   ======================================== */

.status-section {
    margin-bottom: 40px;
}

.cache-status {
    padding: 20px;
    background: rgba(15, 52, 96, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.status-item i {
    font-size: 24px;
    color: var(--primary-color);
}

.status-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-label {
    font-size: 12px;
    color: var(--text-gray);
    text-transform: uppercase;
}

.status-value {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 600;
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    background: rgba(26, 26, 46, 0.95);
    border-top: 1px solid var(--border-color);
    padding: 40px 20px 20px;
    margin-top: 60px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.footer-section h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.footer-section p {
    color: var(--text-gray);
    font-size: 14px;
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-section a {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-gray);
    font-size: 13px;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
    .player-wrapper {
        grid-template-columns: 1fr;
    }

    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    /* Navbar */
    .nav-links {
        display: none;
    }

    .menu-toggle {
        display: block;
    }

    .navbar-container {
        padding: 0 15px;
    }

    /* Main content */
    .main-container {
        padding: 15px;
    }

    /* Hero section */
    .hero-section {
        margin-bottom: 30px;
    }

    /* Search */
    .search-bar-group {
        flex-direction: column;
    }

    .search-stats {
        width: 100%;
    }

    .channel-count {
        width: 100%;
        text-align: center;
    }

    .filter-buttons {
        justify-content: space-between;
    }

    .filter-btn {
        flex: 1;
        min-width: auto;
    }

    /* Channels grid */
    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }

    .channel-item {
        padding: 12px;
    }

    .channel-item-logo {
        height: 100px;
        font-size: 32px;
    }

    .channel-item-name {
        font-size: 12px;
    }

    /* Player info */
    .player-info-panel {
        padding: 15px;
        gap: 15px;
    }

    .channel-header {
        flex-direction: column;
    }

    .player-badges {
        width: 100%;
        justify-content: flex-start;
    }

    .section-header h2 {
        font-size: 22px;
    }

    /* Status */
    .cache-status {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

@media (max-width: 480px) {
    /* Navbar */
    .navbar-brand .logo span {
        display: none;
    }

    .navbar-brand .logo {
        gap: 0;
    }

    /* Hero section */
    .video-container {
        aspect-ratio: auto;
        height: 200px;
    }

    .player-info-panel {
        padding: 12px;
    }

    .channel-display h2 {
        font-size: 18px;
    }

    .channel-subtitle {
        display: none;
    }

    /* Search */
    .search-input-wrapper {
        padding: 10px 12px;
    }

    .search-input {
        font-size: 13px;
    }

    /* Player controls */
    .player-controls-bar {
        padding: 10px;
        gap: 8px;
    }

    .control-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    /* Channels */
    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .channel-item {
        padding: 10px;
    }

    .channel-item-logo {
        height: 80px;
        font-size: 28px;
    }

    /* Section header */
    .section-header h2 {
        font-size: 18px;
    }

    .info-badge {
        font-size: 11px;
    }

    /* Stream info */
    .stream-info {
        font-size: 11px;
    }

    .info-row {
        flex-direction: column;
        gap: 4px;
    }

    .info-label {
        min-width: auto;
    }

    .info-value {
        text-align: left;
    }

    /* Status bar */
    .cache-status {
        padding: 15px;
    }

    .status-item i {
        font-size: 20px;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden {
    display: none !important;
}

.error {
    color: var(--danger-color);
}

.success {
    color: var(--success-color);
}


/* ========================================
   MOBILE RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    /* Channels grid */
    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 12px;
    }

    .channel-item {
        padding: 10px;
    }

    .channel-item-logo {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }

    .channel-item-name {
        font-size: 11px;
    }

    /* Category tabs */
    .category-tabs {
        gap: 8px;
        padding-bottom: 12px;
    }

    .category-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .section-header h2 {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .channel-item-logo {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .channel-item-name {
        font-size: 10px;
    }

    .category-title {
        font-size: 16px;
    }
}
