/* --- 1. DEĞİŞKENLER & RENK PALETİ --- */
:root {
    /* LIGHT MODE */
    --bg-color: #FDFCF8;
    --card-bg: #FFFFFF;
    --text-main: #1A1A1A;
    --text-muted: #666666;
    --border-color: rgba(0, 0, 0, 0.08);

    --primary: #B03A2E;
    --primary-light: #FADBD8;
    --accent-gradient: linear-gradient(135deg, #B03A2E 0%, #E74C3C 100%);

    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 15px 30px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 25px 50px rgba(0, 0, 0, 0.08);

    --radius-lg: 30px;
    /* Oval Köşeler */
    --radius-md: 20px;
    --radius-sm: 12px;

    --header-bg: rgba(253, 252, 248, 0.95);
    --sidebar-bg: #FFFFFF;
}

/* DARK MODE */
body.dark-mode {
    --bg-color: #121212;
    --card-bg: #1E1E1E;
    --text-main: #E0E0E0;
    --text-muted: #A0A0A0;
    --border-color: rgba(255, 255, 255, 0.1);

    --primary: #FF6B6B;
    --primary-light: rgba(255, 107, 107, 0.15);
    --accent-gradient: linear-gradient(135deg, #C0392B 0%, #FF6B6B 100%);

    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 20px -3px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 40px -5px rgba(0, 0, 0, 0.5);

    --header-bg: rgba(18, 18, 18, 0.95);
    --sidebar-bg: #1E1E1E;
}

/* --- 2. GENEL AYARLAR --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    /* Yatay taşmayı önle */
    transition: background-color 0.3s, color 0.3s;
}

h1,
h2,
h3,
h4 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Animasyon */
.reveal {
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Butonlar */
.btn,
.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--accent-gradient);
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: 0.3s;
}

.btn:hover,
.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Form Elemanları */
input,
select,
textarea {
    width: 100%;
    padding: 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-group {
    margin-bottom: 20px;
}

.form-alert {
    padding: 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-alert.error {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

/* --- 3. HEADER (Education - DÜZELTİLMİŞ) --- */
.edu-header {
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Yükseklik verip dikeyde tam ortalayalım */
    min-height: 50px;
}

.logo {
    font-size: 1.8rem;
    /* Logo biraz daha belirgin olsun */
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo span {
    color: var(--primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    /* Elemanlar arasına ferah boşluk */
}

/* Kullanıcı Rozeti */
.user-badge {
    background: var(--bg-color);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.user-badge i {
    color: var(--primary);
}

/* Tema Butonu */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    /* Çerçeve ekleyelim, daha düzenli dursun */
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-main);
    font-size: 1.1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.theme-toggle-btn:hover {
    background: var(--bg-color);
    color: var(--primary);
    border-color: var(--primary-light);
    transform: rotate(15deg);
}

/* Çıkış Butonu */
.btn-logout {
    padding: 10px 24px;
    font-size: 0.95rem;
    background: var(--primary);
    /* Kırmızı ton */
    color: white;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
    box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: white;
}

/* Mobilde Rozeti Gizle */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .header-right {
        gap: 10px;
    }

    .logo {
        font-size: 1.5rem;
    }

    .btn-logout span {
        display: none;
    }

    /* Sadece ikon kalsın mobilde */
    .btn-logout {
        padding: 10px;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        justify-content: center;
    }
}

/* --- 4. LOGIN PAGE --- */
.login-wrapper {
    width: 100%;
    max-width: 480px;
    padding: 20px;
    margin: auto;
}

.login-card {
    background: var(--card-bg);
    padding: 50px 40px;
    border-radius: var(--radius-lg);
    /* Oval */
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    text-align: center;
}

.l-icon {
    width: 80px;
    height: 80px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 25px;
}

.key-input {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 1.2rem;
}

/* --- 5. EDUCATION PAGE (LİSTE) --- */
.section-header {
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 10px;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding-bottom: 60px;
}

.course-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: 0.4s;
    display: flex;
    flex-direction: column;
}

.course-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.c-thumb {
    height: 200px;
    overflow: hidden;
    position: relative;
    background: var(--border-color);
    display: block;
}

.c-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.5s;
}

.course-card:hover .c-thumb img {
    transform: scale(1.05);
}

.c-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    opacity: 0;
    backdrop-filter: blur(5px);
    transition: 0.3s;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.course-card:hover .c-play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.c-body {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.c-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.3;
}

.c-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 25px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.start-btn {
    text-align: center;
    background: var(--primary);
    color: white;
    padding: 12px;
    border-radius: 50px;
    font-weight: 600;
    transition: 0.3s;
    display: block;
    margin-top: auto;
}

.start-btn:hover {
    background: var(--accent-gradient);
    transform: translateY(-2px);
}

/* --- 6. WATCH PAGE (PLAYER & SIDEBAR) --- */
.player-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    /* Sol Menü - Sağ Video */
    height: 100vh;
    overflow: hidden;
    /* Tüm sayfa kaymasın */
}

/* Sol Sidebar (Ders Listesi) */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 10;
}

.sidebar-header {
    padding: 20px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 5;
}

.back-home {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

.course-title {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.3;
}

.lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.lesson-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    transition: 0.2s;
}

.lesson-item a:hover {
    background: var(--bg-color);
    color: var(--primary);
}

.lesson-item.active a {
    background: var(--primary-light);
    color: var(--primary);
    border-left: 4px solid var(--primary);
    font-weight: 600;
}

.l-number {
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Sağ Video Alanı */
.video-area {
    background: #000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    position: relative;
}

.video-wrapper {
    width: 100%;
    background: #000;
    position: sticky;
    top: 0;
    z-index: 20;
    /* Video üstte sabit kalsın */
}

video {
    width: 100%;
    display: block;
    max-height: 80vh;
}

.video-info {
    padding: 40px;
    background: var(--bg-color);
    flex: 1;
    min-height: 300px;
}

.v-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--text-main);
}

.v-desc {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 800px;
}

/* --- 7. RESPONSIVE (MOBİL) --- */
@media (max-width: 992px) {

    /* Genel */
    .hide-mobile {
        display: none !important;
    }

    /* Login */
    .login-card {
        padding: 30px 20px;
    }

    /* Player Layout (Mobilde Alt Alta) */
    .player-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        overflow: auto;
    }

    /* Video En Üste */
    .video-area {
        order: 1;
        overflow: visible;
    }

    .video-wrapper {
        position: relative;
    }

    /* Mobilde yapışmasın */
    .video-info {
        padding: 20px;
    }

    .v-title {
        font-size: 1.5rem;
    }

    /* Ders Listesi Alta */
    .sidebar {
        order: 2;
        height: auto;
        border-right: none;
        border-top: 1px solid var(--border-color);
        max-height: none;
        /* Listeyi tamamen göster */
    }
}

/* --- KAYNAK DOSYASI İNDİR BUTONU (watch.php) --- */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-color);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    /* Oval köşe */
    border: 1px solid var(--border-color);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    margin-top: 15px;
    box-shadow: var(--shadow-sm);
    width: fit-content;
}

.btn-download i {
    color: var(--primary);
    font-size: 1.1rem;
}

.btn-download:hover {
    background: var(--card-bg);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Dark Mode Uyumlu */
body.dark-mode .btn-download {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .btn-download:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
}