/**
 * IPTV Player - Main Styles
 * تصميم مشغل IPTV الرئيسي
 */

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

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --background: #0f0f23;
    --surface: #1a1a2e;
    --surface-light: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --border-color: #2a2a4a;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    direction: rtl;
    overflow-x: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    grid-template-rows: auto 1fr;
    height: 100vh;
    gap: 0;
}

/* قسم المشغل */
.player-section {
    grid-column: 1;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    background: var(--surface);
}

.video-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 80px);
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#videoPlayer {
    width: 100%;
    height: 100%;
    max-height: 100%;
}

.player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.overlay-content {
    text-align: center;
    color: var(--text-primary);
}

.overlay-content i {
    font-size: 80px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.overlay-content h2 {
    font-size: 28px;
    margin-bottom: 10px;
}

.overlay-content p {
    font-size: 18px;
    color: var(--text-secondary);
}

.player-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--surface-light);
    border-top: 1px solid var(--border-color);
    height: 80px;
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.channel-info .channel-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--surface);
}

.channel-info h2 {
    font-size: 20px;
    margin-bottom: 5px;
}

.channel-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

.player-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 45px;
    height: 45px;
    border: none;
    background: var(--primary-color);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

.control-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* قسم القنوات */
.channels-section {
    grid-column: 2;
    grid-row: 1 / -1;
    background: var(--surface-light);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.channels-header {
    padding: 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
}

.channels-header h2 {
    font-size: 24px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 40px 12px 15px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* تبويبات التصنيفات */
.categories-tabs {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    overflow-x: auto;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--surface);
}

.categories-tabs::-webkit-scrollbar {
    height: 4px;
}

.categories-tabs::-webkit-scrollbar-track {
    background: var(--surface);
}

.categories-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.category-tab {
    padding: 10px 20px;
    background: var(--surface-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-tab:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

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

/* قائمة القنوات */
.channels-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.channel-item:hover {
    background: var(--surface-light);
    border-color: var(--primary-color);
    transform: translateX(-5px);
}

.channel-item.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.channel-item-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--surface-light);
    flex-shrink: 0;
}

.channel-item-logo.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-secondary);
}

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

.channel-item-info h3 {
    font-size: 16px;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-item-info small {
    font-size: 12px;
    color: var(--text-secondary);
}

/* حالات التحميل والخطأ */
.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    text-align: center;
}

.loading-state i,
.empty-state i {
    font-size: 60px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* التجاوب */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .player-section {
        grid-column: 1;
        grid-row: 1;
    }

    .channels-section {
        grid-column: 1;
        grid-row: 2;
        height: 50vh;
        border-right: none;
        border-top: 1px solid var(--border-color);
    }

    .video-container {
        height: 50vh;
    }
}

@media (max-width: 768px) {
    .player-info {
        flex-direction: column;
        gap: 10px;
        height: auto;
        padding: 10px;
    }

    .channel-info {
        width: 100%;
    }

    .player-controls {
        width: 100%;
        justify-content: center;
    }

    .categories-tabs {
        padding: 10px;
    }

    .category-tab {
        padding: 8px 15px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .channels-header h2 {
        font-size: 20px;
    }

    .channel-item {
        padding: 10px;
    }

    .channel-item-logo {
        width: 40px;
        height: 40px;
    }

    .channel-item-info h3 {
        font-size: 14px;
    }
}

/* تحسينات للطباعة */
@media print {
    .player-section,
    .player-controls {
        display: none;
    }
}
