/* =====================================================
   Kurumsal Video Eğitim Sistemi - Ana Stil
   Modern SaaS / LMS panel tasarımı
   ===================================================== */
:root {
    --cv-primary: #4f46e5;
    --cv-primary-dark: #4338ca;
    --cv-primary-light: #eef2ff;
    --cv-dark: #0f172a;
    --cv-sidebar: #111827;
    --cv-sidebar-active: #1f2937;
    --cv-bg: #f1f5f9;
    --cv-card: #ffffff;
    --cv-border: #e2e8f0;
    --cv-text: #0f172a;
    --cv-muted: #64748b;
    --cv-success: #16a34a;
    --cv-warning: #d97706;
    --cv-danger: #dc2626;
    --cv-radius: 14px;
    --cv-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
}

* { scrollbar-width: thin; }
body { font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif; background: var(--cv-bg); color: var(--cv-text); }

/* Satır içi SVG ikonlar */
.vi { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex-shrink: 0; }

/* -----------------------------------------------------
   Giriş / Kurulum ekranları
   ----------------------------------------------------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(1200px 600px at 10% -10%, #6366f1 0%, transparent 60%),
                radial-gradient(1000px 500px at 110% 110%, #0ea5e9 0%, transparent 55%),
                var(--cv-dark);
    padding: 24px;
}
.auth-wrap { width: 100%; max-width: 520px; }
.auth-card {
    background: var(--cv-card);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 24px 64px -24px rgba(0, 0, 0, .5);
}
.auth-card.wide { max-width: 640px; }
.auth-logo { text-align: center; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, var(--cv-primary), #7c3aed);
    color: #fff; font-size: 22px;
    box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .8);
}
.brand-mark.lg { width: 64px; height: 64px; font-size: 34px; border-radius: 18px; }
.brand-mark .vi { width: 1.2em; height: 1.2em; }

/* -----------------------------------------------------
   Panel iskeleti
   ----------------------------------------------------- */
.panel-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 264px; flex-shrink: 0;
    background: var(--cv-sidebar);
    color: #e2e8f0;
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    z-index: 1040;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.06);
    font-weight: 700; font-size: .95rem; color: #fff;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 2px;
    color: #94a3b8; border-radius: 10px;
    text-decoration: none; font-size: .9rem; font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: var(--cv-sidebar-active); color: #fff; }
.nav-item.active .vi { color: #818cf8; }
.nav-section {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
    color: #475569; padding: 14px 12px 6px; font-weight: 700;
}
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.06); }
.avatar-sm {
    width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
}
.avatar-fallback {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-weight: 700; font-size: .9rem;
}
.avatar-lg { width: 84px; height: 84px; font-size: 2rem; }
.panel-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.panel-topbar {
    display: flex; align-items: center; gap: 12px;
    background: var(--cv-card);
    padding: 12px 24px;
    border-bottom: 1px solid var(--cv-border);
    position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 700; font-size: 1rem; }
.topbar-icon { color: var(--cv-muted); font-size: 1.2rem; position: relative; }
.topbar-icon:hover { color: var(--cv-primary); }
.dot-badge {
    position: absolute; top: 2px; right: 0;
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--cv-danger); border: 2px solid #fff;
}
.panel-content { padding: 24px; flex: 1; }
.btn-icon { border: none; background: transparent; color: var(--cv-text); }

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed; left: -280px; transition: left .25s ease;
        box-shadow: 0 0 40px rgba(0,0,0,.4);
    }
    .sidebar.show { left: 0; }
}

/* -----------------------------------------------------
   İstatistik kartları
   ----------------------------------------------------- */
.stat-card {
    background: var(--cv-card); border-radius: var(--cv-radius);
    padding: 18px; box-shadow: var(--cv-shadow); height: 100%;
}
.stat-icon { font-size: 1.5rem; margin-bottom: 8px; }
.stat-icon-sm { font-size: 1.3rem; }
.stat-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--cv-muted); font-size: .82rem; font-weight: 600; }
.stat-sub { color: #94a3b8; font-size: .75rem; margin-top: 2px; }
.rank {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 8px;
    background: var(--cv-primary-light); color: var(--cv-primary);
    font-weight: 700; font-size: .8rem;
}

/* Günlük izlenme grafiği */
.daily-chart {
    display: grid; grid-template-columns: repeat(14, 1fr);
    gap: 6px; align-items: end; height: 160px;
}
.daily-col { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.daily-bar {
    width: 100%; max-width: 26px;
    background: linear-gradient(180deg, #818cf8, var(--cv-primary));
    border-radius: 6px 6px 2px 2px; min-height: 4px;
}
.daily-val { font-size: .62rem; color: var(--cv-muted); margin-top: 2px; }
.daily-label { font-size: .62rem; color: #94a3b8; }

/* -----------------------------------------------------
   Tablolar / filtreler
   ----------------------------------------------------- */
.filter-bar { background: var(--cv-card); border-radius: var(--cv-radius); padding: 14px; box-shadow: var(--cv-shadow); }
.table > :not(caption) > * > * { padding: .8rem .75rem; }
.thumb-sm { width: 46px; height: 34px; border-radius: 6px; object-fit: cover; }
.thumb-md { width: 92px; height: 60px; border-radius: 8px; object-fit: cover; }
.drag-handle { cursor: grab; color: #94a3b8; }
.sortable-list tr.drag-over td { border-top: 2px solid var(--cv-primary) !important; }
.sortable-list tr.dragging { opacity: .5; }

/* -----------------------------------------------------
   Yetki ağacı
   ----------------------------------------------------- */
.tree-container { font-size: .9rem; }
.tree-node { }
.tree-row {
    display: flex; align-items: center;
    padding: 6px 8px; border-radius: 8px;
}
.tree-row:hover { background: #f8fafc; }
.tree-level-0 { font-size: .95rem; }
.tree-level-1 { margin-left: 22px; }
.tree-level-2 { margin-left: 44px; }
.tree-level-3 { margin-left: 66px; font-size: .85rem; color: #475569; }
.tree-label { display: flex; align-items: center; gap: 8px; cursor: pointer; margin: 0; }
.tree-label .form-check-input { margin: 0; width: 1.05em; height: 1.05em; }

/* Rol yetki matrisi */
.perm-module { border-bottom: 1px dashed var(--cv-border); padding-bottom: 10px; }
.perm-module:last-of-type { border-bottom: none; }

/* -----------------------------------------------------
   Kurs kartları (kullanıcı)
   ----------------------------------------------------- */
.course-card {
    background: var(--cv-card); border-radius: var(--cv-radius);
    overflow: hidden; box-shadow: var(--cv-shadow);
    height: 100%; display: flex; flex-direction: column;
    transition: transform .15s, box-shadow .15s;
}
.course-card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px -12px rgba(15,23,42,.25); }
.course-cover { position: relative; height: 140px; background: linear-gradient(135deg, #e0e7ff, #ede9fe); }
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-cover-fallback {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    color: #a5b4fc; font-size: 3rem;
}
.course-badge { position: absolute; top: 10px; left: 10px; }
.course-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.course-body .btn { margin-top: auto; }

.continue-banner {
    background: linear-gradient(120deg, var(--cv-primary), #7c3aed 70%, #a855f7);
    color: #fff; border-radius: 18px; padding: 26px 30px;
    box-shadow: 0 16px 40px -16px rgba(79, 70, 229, .6);
}

/* -----------------------------------------------------
   Oynatıcı sayfası
   ----------------------------------------------------- */
.player-layout { display: flex; gap: 20px; align-items: flex-start; }
.playlist-panel {
    width: 320px; flex-shrink: 0;
    background: var(--cv-card); border-radius: var(--cv-radius);
    box-shadow: var(--cv-shadow);
    position: sticky; top: 80px; max-height: calc(100vh - 100px);
    display: flex; flex-direction: column;
}
.playlist-header { padding: 16px; border-bottom: 1px solid var(--cv-border); }
.playlist-body { overflow-y: auto; padding: 10px; flex: 1; }
.playlist-section { margin-bottom: 12px; }
.playlist-section-title {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
    color: var(--cv-muted); font-weight: 700; padding: 6px 10px;
}
.playlist-item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 10px; border-radius: 10px;
    color: var(--cv-text); text-decoration: none; font-size: .88rem;
}
.playlist-item:hover { background: #f8fafc; }
.playlist-item.active { background: var(--cv-primary-light); color: var(--cv-primary); font-weight: 600; }
.playlist-item.done .playlist-title { color: var(--cv-muted); }
.playlist-item.locked { color: #94a3b8; cursor: not-allowed; }
.playlist-title { flex: 1; min-width: 0; }
.playlist-duration { font-size: .72rem; color: #94a3b8; }

.player-main { flex: 1; min-width: 0; }
.player-shell {
    position: relative; background: #000;
    border-radius: var(--cv-radius); overflow: hidden;
    aspect-ratio: 16 / 9; box-shadow: 0 20px 50px -20px rgba(0,0,0,.5);
}
.player-video { width: 100%; height: 100%; display: block; background: #000; }
.player-frame { width: 100%; height: 100%; border: 0; display: block; }
#embedHost { width: 100%; height: 100%; }
#embedHost iframe { width: 100%; height: 100%; border: 0; display: block; }
.player-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.4); z-index: 5;
}
.player-info { background: var(--cv-card); border-radius: var(--cv-radius); padding: 20px; margin-top: 16px; box-shadow: var(--cv-shadow); }
.player-desc { white-space: normal; }

@media (max-width: 991.98px) {
    .player-layout { flex-direction: column-reverse; }
    .playlist-panel { width: 100%; position: static; max-height: none; }
}

/* -----------------------------------------------------
   Sertifika
   ----------------------------------------------------- */
.cert-body { background: #e2e8f0; }
.certificate-wrap { max-width: 1000px; margin: 40px auto; padding: 20px; }
.certificate { background: #fff; box-shadow: 0 24px 60px -20px rgba(15,23,42,.35); }
.cert-border {
    border: 3px solid var(--cv-primary);
    margin: 14px; position: relative;
    outline: 1px solid #c7d2fe; outline-offset: -10px;
}
.cert-inner { padding: 48px 56px; text-align: center; }
.cert-brand { font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--cv-primary); font-size: .85rem; }
.cert-title { font-size: 2.4rem; font-weight: 800; margin: 14px 0 4px; color: var(--cv-text); letter-spacing: .04em; }
.cert-line { width: 90px; height: 4px; background: linear-gradient(90deg, var(--cv-primary), #a855f7); margin: 14px auto 24px; border-radius: 2px; }
.cert-sub { color: var(--cv-muted); }
.cert-name { font-size: 2rem; font-weight: 800; color: var(--cv-primary-dark); margin: 8px 0 12px; }
.cert-course { font-size: 1.4rem; font-weight: 700; margin: 10px 0 26px; color: var(--cv-text); }
.cert-meta { display: flex; justify-content: center; gap: 60px; margin-top: 26px; text-align: center; }
.cert-meta-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--cv-muted); margin-bottom: 4px; }
.cert-meta-value { font-weight: 700; }
.cert-qr svg { width: 74px; height: 74px; }
@media print {
    body { background: #fff; }
    .no-print { display: none !important; }
    .certificate-wrap { margin: 0; max-width: none; padding: 0; }
    .certificate { box-shadow: none; }
}
@media (max-width: 720px) {
    .cert-inner { padding: 30px 20px; }
    .cert-title { font-size: 1.6rem; }
    .cert-name { font-size: 1.4rem; }
    .cert-meta { flex-direction: column; gap: 16px; }
}

/* -----------------------------------------------------
   Yardımcılar
   ----------------------------------------------------- */
.note-content { white-space: normal; }
.upload-box .progress-bar { font-weight: 700; }
.form-text { font-size: .78rem; }
.alert { border-radius: 12px; }
.card { border: none; border-radius: var(--cv-radius) !important; }
.card-header { border-bottom: 1px solid var(--cv-border); border-radius: var(--cv-radius) var(--cv-radius) 0 0 !important; }
.btn-primary { --bs-btn-bg: var(--cv-primary); --bs-btn-border-color: var(--cv-primary); --bs-btn-hover-bg: var(--cv-primary-dark); --bs-btn-hover-border-color: var(--cv-primary-dark); }
.btn-outline-primary { --bs-btn-color: var(--cv-primary); --bs-btn-border-color: var(--cv-primary); --bs-btn-hover-bg: var(--cv-primary); --bs-btn-hover-border-color: var(--cv-primary); }
.page-link { color: var(--cv-primary); }
.page-item.active .page-link { background: var(--cv-primary); border-color: var(--cv-primary); }
.modal-content { border-radius: var(--cv-radius); border: none; }

/* -----------------------------------------------------
   v1.2: Rozet kartları, yıldız puanlama, soru-cevap, sınav
   ----------------------------------------------------- */
.badge-card {
    background: #fff; border: 1px solid var(--cv-border); border-radius: 14px;
    padding: 16px; text-align: center; height: 100%;
    filter: grayscale(1); opacity: .55; transition: all .2s;
}
.badge-card.earned {
    filter: none; opacity: 1;
    border-color: #f1c40f;
    box-shadow: 0 6px 18px -8px rgba(241, 196, 15, .55);
}
.badge-card .badge-icon { display: inline-flex; width: 44px; height: 44px; align-items: center; justify-content: center; border-radius: 50%; background: rgba(241, 196, 15, .15); color: #b8860b; margin-bottom: 8px; }
.badge-card .badge-icon .vi { width: 24px; height: 24px; }

.star-rating { display: inline-flex; gap: 2px; }
.star-btn { background: none; border: none; padding: 0 2px; cursor: pointer; color: #d1d5db; transition: transform .1s, color .1s; }
.star-btn .vi { width: 26px; height: 26px; }
.star-btn:hover { transform: scale(1.15); }
.star-btn.active { color: #f5b301; }
.star-btn.active .vi { fill: #f5b301; }

.qa-answer-staff { border-left: 3px solid var(--cv-primary); }
.question-row textarea { font-size: .9rem; }

.rank {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--cv-primary); color: #fff; font-weight: 700; font-size: .8rem;
    flex-shrink: 0;
}
.list-group-item .rank:first-child { margin-right: .25rem; }

#timerBar { position: sticky; top: 8px; z-index: 10; }

.stat-card a { text-decoration: none; color: inherit; display: block; }


/* ---- v1.3: Video indirme bölümü (yalnız izinli videolarda JS ile görünür) ---- */
.download-section {
    display: inline-flex; align-items: center; gap: .25rem;
    padding: .25rem .5rem; border: 1px dashed rgba(25, 135, 84, .45);
    border-radius: .5rem; background: rgba(25, 135, 84, .06);
}

/* ---- v1.4: Dinamik oynatıcı filigranı (kullanıcı damgası) ---- */
#wmLayer {
    position: absolute; z-index: 40; pointer-events: none;
    max-width: 80%; user-select: none; -webkit-user-select: none;
    font-size: .78rem; font-weight: 600; letter-spacing: .2px;
    color: rgba(255, 255, 255, .5); text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
    padding: 4px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wm-tl { top: 10px; left: 12px; }
.wm-tr { top: 10px; right: 12px; }
.wm-bl { bottom: 56px; left: 12px; }  /* alt offset: yerel kontrollerin üstünde kalır */
.wm-br { bottom: 56px; right: 12px; }

/* ==========================================================
   Ekran Kaydı / Çıktı Koruması (#v1.4.2)
   ========================================================== */
.protect-overlay {
    position: absolute; inset: 0; z-index: 50;
    background: rgba(2, 6, 23, .95);
    display: flex; align-items: center; justify-content: center;
    text-align: center; color: #e2e8f0;
}
.protect-box { padding: 24px; max-width: 440px; }
.protect-icon { color: #f59e0b; margin-bottom: 10px; }
.protect-icon svg { width: 56px; height: 56px; }
.protect-title {
    font-size: 1.7rem; font-weight: 800; letter-spacing: .1em;
    color: #f59e0b; text-transform: uppercase;
}
.protect-sub { margin-top: 10px; font-size: .9rem; color: #94a3b8; line-height: 1.5; }

/* Yazdırma engeli: oynatıcı sayfası çıktıda tamamen gizlenir, yalnızca uyarı basılır */
.print-warning { display: none; }
@media print {
    body * { visibility: hidden !important; }
    .print-warning, .print-warning * { visibility: visible !important; }
    .print-warning {
        display: flex !important; position: fixed; inset: 0;
        align-items: center; justify-content: center; text-align: center;
        font-size: 26pt; font-weight: 800; color: #dc2626;
        border: 6px solid #dc2626; padding: 32px; line-height: 1.4;
    }
}
