/* ============================================
   LIVETVWorld - Main Stylesheet
   ============================================ */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --secondary: #2c3e50;
    --accent: #3498db;
    --bg-dark: #0a0e17;
    --bg-card: #141b2b;
    --bg-card-hover: #1a2338;
    --text-primary: #ffffff;
    --text-secondary: #8899bb;
    --text-muted: #6a7b9a;
    --border-color: #1e2a3a;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent);
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.logo a {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-text {
    background: linear-gradient(135deg, var(--primary), #f39c12);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 5px;
}

.main-nav ul li a {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.main-nav ul li a:hover,
.main-nav ul li a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.main-nav ul li a.active {
    background: var(--primary);
    color: #fff;
}

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

.search-box {
    position: relative;
}

.search-box form {
    display: flex;
    align-items: center;
}

.search-box input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 8px 0 0 8px;
    padding: 8px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    width: 200px;
    transition: var(--transition);
    outline: none;
}

.search-box input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.12);
    width: 260px;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box button {
    background: var(--primary);
    border: none;
    border-radius: 0 8px 8px 0;
    color: #fff;
    padding: 8px 14px;
    cursor: pointer;
    transition: var(--transition);
}

.search-box button:hover {
    background: var(--primary-dark);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px;
}

/* Categories Dropdown */
.categories-dropdown {
    display: none;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 16px 0;
    max-height: 400px;
    overflow-y: auto;
}

.categories-dropdown.open {
    display: block;
}

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

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    transition: var(--transition);
    font-size: 0.85rem;
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.category-item .cat-icon {
    font-size: 1rem;
}

.category-item .cat-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* Ads */
.ad-container {
    padding: 10px 0;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
}

.ad-container img {
    max-width: 100%;
    height: auto;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    padding: 50px 0;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-card));
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.hero-content h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.hero-content p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.hero-content .highlight {
    color: var(--primary);
    font-weight: 700;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

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

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ============================================
   CHANNELS SECTION
   ============================================ */
.channels-section {
    padding: 30px 0;
    flex: 1;
}

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

.section-header h2 {
    font-size: 1.6rem;
    margin-bottom: 4px;
}

.section-header .section-actions {
    margin: 8px 0;
}

.section-header .channel-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.breadcrumb {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 6px 0;
}

.breadcrumb .separator {
    margin: 0 8px;
}

.breadcrumb a {
    color: var(--accent);
}

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

.channel-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid transparent;
}

.channel-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color);
    box-shadow: var(--shadow);
}

.channel-link {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    gap: 12px;
    height: 100%;
}

.channel-logo {
    flex-shrink: 0;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.logo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    border-radius: 50%;
}

.logo-placeholder.small {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
}

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

.channel-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-category {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
}

.channel-status {
    font-size: 0.7rem;
    display: inline-block;
    margin-top: 2px;
}

.channel-status.live {
    color: #2ecc71;
}

.channel-play {
    flex-shrink: 0;
    font-size: 1.8rem;
    color: var(--text-muted);
    transition: var(--transition);
    opacity: 0.5;
}

.channel-card:hover .channel-play {
    color: var(--primary);
    opacity: 1;
}

/* ============================================
   PLAYER PAGE
   ============================================ */
.player-section {
    padding: 20px 0;
}

.player-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

.video-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    padding: 20px;
}

.player-header {
    margin-bottom: 16px;
}

.player-header h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.player-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.player-meta .player-category {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.player-meta .player-status {
    font-size: 0.85rem;
}

.player-meta .player-status.live {
    color: #2ecc71;
}

.video-player {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/9;
}

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

.player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: #fff;
}

.player-loader i {
    font-size: 2.5rem;
    color: var(--accent);
}

.player-error i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.player-controls {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

/* Related Channels */
.related-channels {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
}

.related-channels h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

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

.related-channel-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    transition: var(--transition);
}

.related-channel-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.related-logo {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
}

.related-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.related-name {
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-status {
    font-size: 0.65rem;
}

.related-status.live {
    color: #2ecc71;
}

/* ============================================
   CATEGORIES SHOWCASE
   ============================================ */
.categories-showcase {
    padding: 30px 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

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

.category-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    transition: var(--transition);
    border: 1px solid transparent;
}

.category-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-color);
    transform: translateY(-2px);
}

.category-card-icon {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.category-card-name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

/* ============================================
   SEARCH PAGE
   ============================================ */
.search-section {
    padding: 30px 0;
    flex: 1;
}

.search-form-large form {
    display: flex;
    gap: 10px;
    margin: 16px 0;
    max-width: 600px;
}

.search-form-large input {
    flex: 1;
    padding: 12px 18px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.search-form-large input:focus {
    border-color: var(--accent);
}

.search-form-large button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.search-form-large button:hover {
    background: var(--primary-dark);
}

.search-results-info {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3.5rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state .btn {
    margin-top: 16px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: #fff;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}

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

/* ============================================
   PAGINATION
   ============================================ */
.pagination-wrapper {
    margin-top: 30px;
    text-align: center;
}

.pagination {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
}

.page-link {
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

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

.page-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-dots {
    padding: 8px 6px;
    color: var(--text-muted);
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 30px 0 16px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 10px;
    font-size: 1rem;
}

.footer-section p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 6px;
}

.footer-section ul li a {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-section ul li a:hover {
    color: var(--accent);
}

.footer-update {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.footer-bottom {
    text-align: center;
    padding-top: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
    }
    
    .main-nav {
        display: none;
        width: 100%;
        order: 3;
    }
    
    .main-nav.open {
        display: block;
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }
    
    .main-nav ul li a {
        display: block;
        padding: 10px 16px;
        border-radius: 0;
        border-bottom: 1px solid var(--border-color);
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .header-actions {
        flex: 1;
        justify-content: flex-end;
    }
    
    .search-box input {
        width: 140px;
    }
    
    .search-box input:focus {
        width: 180px;
    }
    
    .hero-content h1 {
        font-size: 2rem;
    }
    
    .hero-stats {
        gap: 24px;
    }
    
    .stat-number {
        font-size: 1.6rem;
    }
    
    .channels-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .player-controls {
        justify-content: center;
    }
    
    .related-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }
    
    .search-form-large form {
        flex-direction: column;
    }
    
    .search-form-large button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .channels-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    
    .channel-link {
        padding: 8px 10px;
        gap: 8px;
    }
    
    .channel-logo {
        width: 40px;
        height: 40px;
    }
    
    .channel-name {
        font-size: 0.75rem;
    }
    
    .channel-play {
        font-size: 1.2rem;
    }
    
    .hero-content h1 {
        font-size: 1.5rem;
    }
    
    .hero-content p {
        font-size: 1rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
    
    .showcase-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .video-container {
        padding: 10px;
    }
}