@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  color-scheme: light;
}
html.dark {
  color-scheme: dark;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  scrollbar-width: thin;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.35);
  border-radius: 999px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* --- Kartochkalar --- */
.card {
  border-radius: 1rem;
  border: 1px solid rgb(226 232 240);
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
html.dark .card {
  border-color: rgb(30 41 59);
  background: rgb(15 23 42);
}

/* --- Sidebar --- */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  border-radius: 0.75rem;
  padding: 0.62rem 0.8rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgb(71 85 105);
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover {
  background: rgb(241 245 249);
  color: rgb(30 41 59);
}
html.dark .nav-link {
  color: rgb(148 163 184);
}
html.dark .nav-link:hover {
  background: rgb(30 41 59);
  color: rgb(241 245 249);
}
.nav-link.active {
  background: rgb(238 242 255);
  color: rgb(67 56 202);
  font-weight: 600;
}
html.dark .nav-link.active {
  background: rgba(99, 102, 241, 0.16);
  color: rgb(165 180 252);
}
.nav-link .badge {
  margin-left: auto;
  border-radius: 999px;
  background: rgb(239 68 68);
  padding: 0 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1.15rem;
  color: #fff;
}

/* --- Formlar --- */
.form-grid > * + * {
  margin-top: 0.9rem;
}

/* Checkbox guruhlari (dars kunlari) */
ul#id_lesson_days {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
ul#id_lesson_days li label {
  display: inline-flex;
  cursor: pointer;
}
ul#id_lesson_days input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
ul#id_lesson_days li span {
  border-radius: 999px;
  border: 1px solid rgb(226 232 240);
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  color: rgb(71 85 105);
  background: #fff;
}
html.dark ul#id_lesson_days li span {
  border-color: rgb(51 65 85);
  background: rgb(15 23 42);
  color: rgb(148 163 184);
}
ul#id_lesson_days input:checked + span {
  border-color: rgb(99 102 241);
  background: rgb(238 242 255);
  color: rgb(67 56 202);
  font-weight: 600;
}
html.dark ul#id_lesson_days input:checked + span {
  border-color: rgb(99 102 241);
  background: rgba(99, 102, 241, 0.2);
  color: rgb(165 180 252);
}

/* --- Toast --- */
.toast {
  animation: toast-in 0.25s ease-out;
}
.toast.leaving {
  animation: toast-out 0.2s ease-in forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

/* --- Chat --- */
.chat-bubble {
  max-width: min(80%, 34rem);
  border-radius: 1rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
}
.chat-mine {
  background: rgb(79 70 229);
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}
.chat-theirs {
  background: rgb(241 245 249);
  color: rgb(30 41 59);
  border-bottom-left-radius: 0.3rem;
}
html.dark .chat-theirs {
  background: rgb(30 41 59);
  color: rgb(226 232 240);
}
.chat-date {
  align-self: center;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.12);
  padding: 0.15rem 0.7rem;
  font-size: 0.7rem;
  color: rgb(100 116 139);
}

/* --- Progress --- */
.progress {
  height: 0.5rem;
  border-radius: 999px;
  background: rgb(226 232 240);
  overflow: hidden;
}
html.dark .progress {
  background: rgb(30 41 59);
}
.progress > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: rgb(79 70 229);
}

/* --- Jadval --- */
.table-wrap {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgb(100 116 139);
  background: rgb(248 250 252);
  white-space: nowrap;
}
html.dark .data-table th {
  background: rgba(30, 41, 59, 0.6);
  color: rgb(148 163 184);
}
.data-table td {
  padding: 0.8rem 1rem;
  border-top: 1px solid rgb(241 245 249);
  vertical-align: middle;
}
html.dark .data-table td {
  border-color: rgb(30 41 59);
}
.data-table tbody tr:hover {
  background: rgba(248, 250, 252, 0.8);
}
html.dark .data-table tbody tr:hover {
  background: rgba(30, 41, 59, 0.35);
}

/* --- Media --- */
.video-frame {
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 0.9rem;
  background: #000;
  overflow: hidden;
}
.video-frame iframe,
.video-frame video {
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- Skeleton --- */
.skeleton {
  border-radius: 0.75rem;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.12), rgba(148, 163, 184, 0.25), rgba(148, 163, 184, 0.12));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media print {
  .no-print {
    display: none !important;
  }
}

/* Django UstozAI and integrations screens */
.btn-primary,.btn-secondary { display:inline-flex; align-items:center; justify-content:center; gap:.45rem; border-radius:.75rem; padding:.65rem 1rem; font-size:.875rem; font-weight:600; transition:background-color .15s ease,color .15s ease; cursor:pointer; }
.btn-primary { background:#4f46e5; color:#fff; }
.btn-primary:hover { background:#4338ca; }
.btn-secondary { border:1px solid #cbd5e1; background:#fff; color:#334155; }
.btn-secondary:hover { background:#f8fafc; }
html.dark .btn-secondary { border-color:#334155; background:#0f172a; color:#e2e8f0; }
html.dark .btn-secondary:hover { background:#1e293b; }
.form-control,form input:not([type=checkbox]):not([type=radio]):not([type=hidden]),form textarea,form select { width:100%; border:1px solid #cbd5e1; border-radius:.75rem; padding:.65rem .8rem; background:#fff; color:#0f172a; }
html.dark .form-control,html.dark form input:not([type=checkbox]):not([type=radio]):not([type=hidden]),html.dark form textarea,html.dark form select { border-color:#334155; background:#0f172a; color:#f1f5f9; }
form p { margin-bottom:1rem; }
form p label { display:block; margin-bottom:.35rem; font-size:.875rem; font-weight:600; }
form ul.errorlist { color:#e11d48; font-size:.8rem; }
.form-row > label { display:block; margin-bottom:.35rem; font-size:.875rem; font-weight:600; }
.question-builder input[type=radio] { width:auto !important; }
