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

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --bg-dark: #0f172a;
    --bg-light: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 280px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 24px 16px;
}

.sidebar-header {
    margin-bottom: 32px;
    text-align: center;
}

.app-logo {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.categories-nav {
    flex: 1;
    margin-bottom: 24px;
}

.category-section {
    margin-bottom: 28px;
}

.category-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding: 0 8px;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 8px;
}

.category-btn {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.category-btn:hover {
    background: var(--bg-light);
    color: var(--primary);
}

.category-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.reset-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-light);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
}

.reset-btn:hover {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
}

/* ===== COURSES GRID ===== */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 24px;
    animation: fadeIn 0.5s ease;
}

.course-card {
    background: linear-gradient(135deg, var(--bg-light) 0%, #f1f5f9 100%);
    border-radius: 12px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.course-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

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

.course-category {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.course-progress {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.course-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.course-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    transition: width 0.3s ease;
}

.course-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== COURSE VIEW ===== */
.course-view {
    animation: fadeIn 0.5s ease;
}

.course-header {
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.back-btn {
    padding: 10px 16px;
    background: var(--bg-light);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

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

.course-title {
    font-size: 28px;
    font-weight: 700;
    flex: 1;
    min-width: 300px;
}

.progress-bar {
    flex: 1;
    min-width: 200px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--primary) 100%);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 100px;
    text-align: right;
}

/* ===== PLAYER CONTAINER ===== */
.player-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    flex: 1;
}

.video-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.video-wrapper {
    flex: 1;
    min-height: 400px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #000;
}

.video-wrapper iframe {
    display: block;
}

.video-info {
    background: var(--bg-light);
    padding: 16px;
    border-radius: 8px;
}

.video-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.video-info p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ===== PLAYLIST SECTION ===== */
.playlist-section {
    display: flex;
    flex-direction: column;
    background: var(--bg-light);
    border-radius: 12px;
    padding: 16px;
    min-height: 0;
    border: 2px solid var(--border);
}

.playlist-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.lessons-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

.lessons-list li {
    margin-bottom: 12px;
}

.lesson-btn {
    width: 100%;
    padding: 12px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.lesson-btn:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.lesson-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border-color: var(--primary);
}

.lesson-btn.locked {
    opacity: 0.6;
    cursor: not-allowed;
    color: var(--text-secondary);
}

.lesson-btn.locked:hover {
    border-color: var(--border);
    background: var(--bg-card);
}

.lesson-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1400px) {
    .player-container {
        grid-template-columns: 1fr;
    }

    .playlist-section {
        max-height: 300px;
    }
}

@media (max-width: 1024px) {
    .app-container {
        gap: 12px;
        padding: 12px;
    }

    .sidebar {
        width: 240px;
        padding: 16px 12px;
    }

    .main-content {
        padding: 24px;
    }

    .course-title {
        font-size: 24px;
    }

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

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    .sidebar {
        width: 100%;
        border-radius: 0;
        max-height: 120px;
        padding: 12px 16px;
    }

    .sidebar-footer {
        display: none;
    }

    .categories-nav {
        display: flex;
        gap: 16px;
        margin: 0;
    }

    .category-section {
        margin: 0;
    }

    .category-title {
        display: none;
    }

    .category-list {
        display: flex;
        gap: 8px;
    }

    .category-btn {
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    .main-content {
        border-radius: 0;
        padding: 16px;
        overflow-y: auto;
    }

    .course-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .back-btn {
        width: 100%;
    }

    .course-title {
        font-size: 20px;
    }

    .progress-bar,
    .progress-text {
        width: 100%;
    }

    .progress-text {
        text-align: left;
    }

    .player-container {
        gap: 12px;
    }

    .video-wrapper {
        min-height: 250px;
    }

    .courses-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }

    .course-card {
        padding: 16px;
    }

    .course-icon {
        font-size: 36px;
        margin-bottom: 8px;
    }

    .course-name {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .sidebar {
        max-height: 100px;
        padding: 8px 12px;
    }

    .app-logo {
        font-size: 20px;
    }

    .category-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .main-content {
        padding: 12px;
    }

    .course-title {
        font-size: 18px;
    }

    .courses-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .course-card {
        padding: 12px;
    }

    .course-icon {
        font-size: 28px;
        margin-bottom: 6px;
    }

    .course-name {
        font-size: 12px;
    }
}

/* ===== RTL SUPPORT ===== */
html[dir="rtl"] .sidebar,
html[dir="rtl"] .main-content {
    text-align: right;
}

html[dir="rtl"] .category-btn,
html[dir="rtl"] .lesson-btn {
    text-align: right;
    flex-direction: row-reverse;
}

html[dir="rtl"] .course-header {
    flex-direction: row-reverse;
}

html[dir="rtl"] .progress-text {
    text-align: left;
}

html[dir="rtl"] .video-info {
    text-align: right;
}

html[dir="rtl"] .lesson-icon {
    margin-left: auto;
    margin-right: 0;
}
