/* ============================================================
   Eğitim Platformu — Ana Stil Dosyası
   ============================================================ */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.15);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--slate-100);
  color: var(--slate-800);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-user-select: none;
  user-select: none;
}

input,
textarea {
  -webkit-user-select: text;
  user-select: text;
}

img,
video {
  -webkit-user-drag: none;
  user-drag: none;
}

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

button {
  font-family: inherit;
}

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--slate-700);
  border: 1px solid var(--slate-300);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--slate-50);
}

.btn-danger {
  background: #fef2f2;
  color: var(--red);
  border: 1px solid #fecaca;
}

.btn-danger:hover:not(:disabled) {
  background: #fee2e2;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

/* ---------- Form elemanları ---------- */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--slate-300);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--slate-800);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.field .hint {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- Giriş sayfası ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--slate-900) 0%, #312e81 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  text-align: center;
}

.login-logo .logo-badge {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.login-logo h1 {
  font-size: 21px;
  font-weight: 700;
  color: var(--slate-900);
}

.login-logo p {
  font-size: 13.5px;
  color: var(--slate-500);
}

.login-note {
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--slate-500);
  text-align: center;
}

/* ---------- Uyarı kutuları ---------- */
.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 16px;
  display: none;
}

.alert.show {
  display: block;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

/* ---------- Üst bar (öğrenci) ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--slate-900);
}

.brand .logo-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}

.user-chip .name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate-800);
}

.user-chip .meta {
  font-size: 12px;
  color: var(--slate-500);
}

/* ---------- Sayfa düzeni ---------- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-head h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--slate-900);
}

.page-head p {
  color: var(--slate-500);
  font-size: 14px;
  margin-top: 4px;
}

/* ---------- Kurs kartları ---------- */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.course-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s, transform 0.15s;
  cursor: pointer;
  border: 1px solid var(--slate-200);
}

.course-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.course-card .cover {
  height: 120px;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: rgba(255, 255, 255, 0.9);
}

.course-card .body {
  padding: 18px 20px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.course-card h3 {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--slate-900);
}

.course-card .desc {
  font-size: 13.5px;
  color: var(--slate-500);
  flex: 1;
}

.course-card .foot {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
}

/* ---------- Boş durum ---------- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--slate-500);
}

.empty-state .icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.empty-state h3 {
  color: var(--slate-700);
  font-size: 17px;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 14px;
}

/* ---------- Ders (kurs) sayfası ---------- */
.course-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .course-layout {
    grid-template-columns: 1fr;
  }
}

.player-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--slate-200);
}

.video-shell {
  position: relative;
  background: #000;
  aspect-ratio: 16 / 9;
}

.video-shell iframe,
.video-shell video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--slate-400);
  font-size: 14px;
}

.video-placeholder .icon {
  font-size: 42px;
}

/* Dinamik filigran */
.watermark {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.35);
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: top 1.2s ease, left 1.2s ease;
  white-space: nowrap;
}

.lesson-info {
  padding: 20px 24px 24px;
}

.lesson-info h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--slate-900);
  margin-bottom: 6px;
}

.lesson-info .desc {
  font-size: 14px;
  color: var(--slate-600);
  white-space: pre-line;
}

/* Ders dosyaları */
.files-box {
  margin-top: 20px;
  border-top: 1px solid var(--slate-200);
  padding-top: 16px;
}

.files-box h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
  margin-bottom: 10px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--slate-50);
}

.file-row .ficon {
  font-size: 20px;
}

.file-row .fmeta {
  flex: 1;
  min-width: 0;
}

.file-row .fname {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row .fsize {
  font-size: 12px;
  color: var(--slate-500);
}

/* Ders listesi (sağ panel) */
.lesson-list-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--slate-200);
  overflow: hidden;
}

.lesson-list-card .head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-200);
  font-weight: 700;
  font-size: 15px;
  color: var(--slate-900);
}

.lesson-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 20px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--slate-100);
  cursor: pointer;
  transition: background 0.12s;
}

.lesson-item:hover {
  background: var(--slate-50);
}

.lesson-item.active {
  background: var(--primary-light);
}

.lesson-item .num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--slate-100);
  color: var(--slate-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  flex-shrink: 0;
}

.lesson-item.active .num {
  background: var(--primary);
  color: #fff;
}

.lesson-item .lmeta {
  min-width: 0;
}

.lesson-item .ltitle {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-item .lsub {
  font-size: 12px;
  color: var(--slate-500);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate-500);
  margin-bottom: 14px;
}

.back-link:hover {
  color: var(--primary);
}

/* ---------- Admin düzeni ---------- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--slate-900);
  color: var(--slate-300);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.sidebar .brand {
  color: #fff;
  padding: 20px;
  border-bottom: 1px solid var(--slate-800);
}

.sidebar nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--slate-300);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover {
  background: var(--slate-800);
  color: #fff;
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
}

.sidebar .foot {
  padding: 16px;
  border-top: 1px solid var(--slate-800);
  font-size: 13px;
}

.sidebar .foot .email {
  color: var(--slate-400);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 10px;
}

.admin-main {
  flex: 1;
  padding: 32px;
  min-width: 0;
}

@media (max-width: 800px) {
  .admin-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
  }
  .sidebar nav {
    flex-direction: row;
    overflow-x: auto;
  }
}

/* ---------- Tablolar ---------- */
.card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  padding: 12px 16px;
  background: var(--slate-50);
  color: var(--slate-500);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-green {
  background: #dcfce7;
  color: #15803d;
}

.badge-red {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-amber {
  background: #fef3c7;
  color: #b45309;
}

.badge-slate {
  background: var(--slate-100);
  color: var(--slate-600);
}

.badge-indigo {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ---------- Modallar ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  z-index: 100;
  overflow-y: auto;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--slate-200);
}

.modal-head h3 {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--slate-900);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--slate-400);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover {
  color: var(--slate-700);
}

.modal-body {
  padding: 24px;
}

.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Kurs atama onay kutuları */
.checkbox-list {
  border: 1px solid var(--slate-300);
  border-radius: 10px;
  max-height: 180px;
  overflow-y: auto;
  padding: 6px;
}

.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--slate-700);
  cursor: pointer;
  margin: 0;
}

.checkbox-list label:hover {
  background: var(--slate-50);
}

.checkbox-list input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* ---------- Yükleme çubuğu ---------- */
.progress {
  height: 8px;
  border-radius: 999px;
  background: var(--slate-200);
  overflow: hidden;
  margin-top: 10px;
}

.progress .bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.2s;
}

/* ---------- Toast ---------- */
#toast-host {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--slate-900);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  max-width: 360px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: var(--green);
}

.toast-error {
  background: var(--red);
}

/* ---------- Yükleniyor ---------- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px;
  color: var(--slate-500);
  font-size: 14px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Admin bölüm başlıkları */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 21px;
  font-weight: 700;
  color: var(--slate-900);
}

.section-head p {
  font-size: 13.5px;
  color: var(--slate-500);
  margin-top: 2px;
}

/* Ders yönetimi listesi (admin) */
.lesson-admin-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--slate-100);
}

.lesson-admin-row:last-child {
  border-bottom: none;
}

.lesson-admin-row .lmeta {
  flex: 1;
  min-width: 0;
}

.lesson-admin-row .ltitle {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--slate-800);
}

.lesson-admin-row .lsub {
  font-size: 12.5px;
  color: var(--slate-500);
  margin-top: 2px;
}

/* Küçük yardımcılar */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.text-muted { color: var(--slate-500); font-size: 13px; }
.hidden { display: none !important; }
