/* Komponentlar (Figma: 🎨 Dizayn tizimi → Komponentlar) */

/* Icon */
.icon { width: 24px; height: 24px; flex-shrink: 0; }
.icon-14 { width: 14px; height: 14px; }
.icon-16 { width: 16px; height: 16px; }
.icon-18 { width: 18px; height: 18px; }
.icon-20 { width: 20px; height: 20px; }
.icon-22 { width: 22px; height: 22px; }

/* Button — Type: primary | secondary | ghost | danger; Size: M (default) | S */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--radius-lg); border: 0;
  font-size: 14px; line-height: 20px; font-weight: 700; white-space: nowrap;
  cursor: pointer; transition: background-color .15s, filter .15s;
}
.btn .icon { width: 18px; height: 18px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; }

.btn-primary   { background: var(--primary-600); color: var(--ink-white); }
.btn-primary:hover { background: var(--primary-700); }
.btn-secondary { background: var(--ink-white); color: var(--ink-900); border: 1px solid var(--ink-line); }
.btn-secondary:hover { background: var(--ink-bg); }
.btn-ghost     { background: var(--primary-50); color: var(--primary-700); }
.btn-ghost:hover { background: var(--primary-100); }
.btn-danger    { background: var(--red-100); color: var(--red-600); }
.btn-danger:hover { filter: brightness(.97); }

.btn-sm {
  padding: 9px 12px; border-radius: var(--radius-md);
  font-size: 12px; line-height: 16px; letter-spacing: .2px;
}
.btn-sm .icon { width: 16px; height: 16px; }
.btn-block { width: 100%; }

/* Badge — Tone: green | amber | red | blue | gray | dark */
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
}
.badge-green { background: var(--green-100);   color: var(--green-700); }
.badge-amber { background: var(--gold-100);   color: var(--gold-600); }
.badge-red   { background: var(--red-100);    color: var(--red-600); }
.badge-blue  { background: var(--blue-100);   color: var(--blue-600); }
.badge-gray  { background: var(--ink-bg);     color: var(--ink-500); }
.badge-dark  { background: var(--primary-700); color: var(--ink-white); }

/* NavItem — chap menyu elementi */
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: var(--radius-lg);
  color: var(--ink-700); font-size: 14px; line-height: 20px; font-weight: 500;
}
.nav-item .icon { width: 20px; height: 20px; }
.nav-item__label { flex: 1; min-width: 0; }
.nav-item__count {
  padding: 2px 7px; border-radius: var(--radius-pill); background: var(--red-600); color: var(--ink-white);
  font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .2px;
}
.nav-item:hover { background: var(--primary-50); }
.nav-item.is-active { background: var(--primary-600); color: var(--ink-white); font-weight: 700; }
.nav-item.is-active .nav-item__count { background: var(--ink-white); color: var(--primary-700); }

/* Input / Select */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .2px; color: var(--ink-700); }
.field__control {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  background: var(--ink-white); border: 1.5px solid var(--ink-line); border-radius: var(--radius-lg);
  transition: border-color .15s;
}
.field__control:focus-within { border-color: var(--primary-500); }
.field__control .icon { width: 18px; height: 18px; color: var(--ink-400); }
.field__control input,
.field__control select {
  flex: 1; min-width: 0; border: 0; outline: 0; padding: 0; background: transparent;
  font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink-900);
}
.field__control input::placeholder { color: var(--ink-400); }
.field__control select { appearance: none; cursor: pointer; }
.field__control select:invalid { color: var(--ink-400); }
.field__error { font-size: 12px; line-height: 16px; color: var(--red-600); }
.field.has-error .field__control { border-color: var(--red-500); }

/* Avatar — S 32 | M 40 | L 72 */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%; overflow: hidden;
  background: var(--primary-100); color: var(--primary-700);
  font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .2px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-m { width: 40px; height: 40px; font-size: 14px; line-height: 20px; letter-spacing: 0; }
.avatar-l { width: 72px; height: 72px; font-size: 22px; line-height: 30px; letter-spacing: -.3px; }

/* BambookChip — M | L */
.bambook-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px;
  border-radius: var(--radius-pill); background: var(--gold-100); color: var(--gold-600);
  font-size: 14px; line-height: 20px; font-weight: 700; white-space: nowrap;
}
.bambook-chip img { width: 22px; height: 22px; }
.bambook-chip-l { padding: 8px 16px 8px 10px; font-size: 18px; line-height: 26px; letter-spacing: -.2px; }
.bambook-chip-l img { width: 28px; height: 28px; }

/* LangSwitch */
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-md); background: var(--ink-bg); }
.lang-switch__item {
  padding: 6px 9px; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer;
  font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .2px; color: var(--ink-400);
}
.lang-switch__item.is-active { background: var(--ink-white); color: var(--ink-900); box-shadow: var(--shadow-card); }

/* StatCard — Tone: primary (default) | gold | red | blue */
.stat-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px;
  background: var(--ink-white); border: 1px solid var(--ink-line); border-radius: var(--radius-xl);
}
.stat-card__icon {
  display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: var(--radius-lg); background: var(--primary-100); color: var(--primary-600);
}
.stat-card__icon .icon { width: 20px; height: 20px; }
.stat-card__label { color: var(--ink-500); }
.stat-card__value { font-size: 32px; line-height: 40px; font-weight: 800; letter-spacing: -.5px; color: var(--ink-900); }
.stat-card__hint { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-500); }
.stat-card--gold .stat-card__icon { background: var(--gold-100); color: var(--gold-600); }
.stat-card--gold .stat-card__hint { color: var(--gold-600); }
.stat-card--red  .stat-card__icon { background: var(--red-100);  color: var(--red-600); }
.stat-card--red  .stat-card__hint { color: var(--red-600); }
.stat-card--blue .stat-card__icon { background: var(--blue-100); color: var(--blue-600); }
.stat-card--blue .stat-card__hint { color: var(--blue-600); }

/* Tabs (segmented) */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--radius-lg); background: var(--ink-bg); }
.tab {
  padding: 8px 14px; border: 0; border-radius: var(--radius-md); background: transparent; cursor: pointer;
  font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink-500); white-space: nowrap;
}
.tab.is-active { background: var(--ink-white); color: var(--ink-900); font-weight: 700; filter: drop-shadow(0 4px 8px rgba(18, 33, 26, 0.06)); }
.tabs-fill { display: flex; }
.tabs-fill .tab { flex: 1; text-align: center; }

/* AttendanceMark — keldi | kelmadi | kechikdi | sababli | bosh */
.att-mark {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: var(--radius-sm); font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .2px;
}
.att-mark .icon { width: 16px; height: 16px; }
.att-mark--keldi    { background: var(--green-100);   color: var(--green-600); }
.att-mark--kelmadi  { background: var(--red-100);    color: var(--red-600); }
.att-mark--kechikdi { background: var(--gold-100);   color: var(--gold-600); }
.att-mark--sababli  { background: var(--blue-100);   color: var(--blue-600); }
.att-mark--bosh     { border: 1.5px dashed var(--ink-line); }

/* TabBar (mobil pastki menyu) */
.tabbar-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; padding: 6px 0;
  font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-400);
}
.tabbar-item .icon { width: 24px; height: 24px; }
.tabbar-item.is-active { color: var(--primary-600); font-weight: 700; letter-spacing: .2px; }

/* Logo */
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo__mark { width: 40px; height: 40px; }
.logo__words { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.logo__wordmark { width: 120px; height: auto; }
.logo__tagline {
  font-size: 7.5px; line-height: normal; font-weight: 500; letter-spacing: 2.99px; color: var(--brand-brown);
  white-space: nowrap;
}
.logo--inverse .logo__tagline { color: var(--primary-200); }

/* Progress — HSK darajalar, vazifa tekshirish */
.progress { position: relative; display: block; height: 8px; border-radius: 4px; overflow: hidden; background: var(--ink-bg); }
.progress__fill { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--primary-600); }
.progress--thin { height: 6px; border-radius: 3px; }

/* Meter — progress + foiz. Tone: green | gold | red */
.meter { display: flex; align-items: center; gap: 8px; color: var(--ink-700); }
.meter .progress { flex: 1; min-width: 0; }
.meter--green .progress { background: var(--green-100); }
.meter--green .progress__fill { background: var(--green-600); }
.meter--gold .progress { background: var(--gold-100); }
.meter--gold .progress__fill { background: var(--gold-500); }
.meter--red .progress { background: var(--red-100); }
.meter--red .progress__fill { background: var(--red-500); }

/* DataTable */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }
.data-table th {
  padding: 10px 14px; background: var(--ink-bg); white-space: nowrap;
  font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .2px; text-transform: uppercase; color: var(--ink-500);
}
.data-table th:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.data-table th:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--ink-line); white-space: nowrap; }
.data-table .col-80 { width: 80px; }
.data-table .col-90 { width: 90px; }
.data-table .col-140 { width: 140px; }
.data-table .col-200 { width: 200px; }

/* Person — avatar + ism */
.person { display: inline-flex; align-items: center; gap: 10px; }

/* Dropdown — <details> asosida, JS'siz */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown__menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 200px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--ink-white); border: 1px solid var(--ink-line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.dropdown__menu--right { left: auto; right: 0; }
.dropdown__title { padding: 6px 10px 4px; font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-400); }
.dropdown__item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; cursor: pointer; text-align: left; white-space: nowrap;
  font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink-900);
}
.dropdown__item:hover { background: var(--ink-bg); }
.dropdown__item.is-active { background: var(--primary-50); color: var(--primary-700); font-weight: 700; }
.dropdown__item--danger { color: var(--red-600); }
.btn.is-on { border-color: var(--primary-500); color: var(--primary-700); }

/* LevelChip — HSK darajasi belgisi */
.level-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.level-chip {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-pill);
  background: var(--primary-600); color: var(--ink-white);
  font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
}

/* LevelPick — tanlanadigan daraja (checkbox) */
.level-picker { margin: 0; padding: 0; border: 0; min-width: 0; }
.level-picker__options { display: flex; flex-wrap: wrap; gap: 8px; }
.level-pick {
  position: relative; display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px;
  border: 1px solid var(--ink-line); border-radius: var(--radius-pill); background: var(--ink-white); cursor: pointer;
  font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-500); white-space: nowrap;
}
.level-pick input { position: absolute; opacity: 0; pointer-events: none; }
.level-pick .icon { display: none; }
.level-pick:has(input:checked) { background: var(--primary-600); border-color: var(--primary-600); color: var(--ink-white); font-weight: 700; }
.level-pick:has(input:checked) .icon { display: block; }
.level-pick:has(input:focus-visible) { outline: 2px solid var(--primary-500); outline-offset: 2px; }

.d-block { display: block; }
.data-table .col-40 { width: 40px; }
.data-table .col-60 { width: 60px; }
.data-table .col-100 { width: 100px; }
.data-table .col-120 { width: 120px; }
.data-table .col-180 { width: 180px; }
.text-right { text-align: right; }
.icon.flip { transform: scaleX(-1); }
.tab.is-soon { opacity: .5; cursor: default; }
.dropdown__menu--scroll { max-height: 320px; overflow-y: auto; }

/* Calendar — sana tanlash */
.calendar { padding: 12px 16px 14px; border: 1px solid var(--ink-line); border-radius: var(--radius-lg); }
.calendar__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.calendar__nav {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-700); cursor: pointer;
}
.calendar__nav:hover:not(:disabled) { background: var(--ink-bg); }
.calendar__nav:disabled { color: var(--ink-300); cursor: default; }
.calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px 6px; justify-items: center; }
.calendar__weekdays { margin-bottom: 6px; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-500); }
.calendar__day {
  width: 44px; height: 40px; border: 0; border-radius: var(--radius-md); background: none; cursor: pointer;
  font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink-900);
}
.calendar__day:hover:not(:disabled) { background: var(--primary-50); }
.calendar__day:disabled { color: var(--ink-300); cursor: default; }
.calendar__day.is-selected { background: var(--primary-600); color: var(--ink-white); font-weight: 700; }

/* Breadcrumbs */
.breadcrumbs { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.breadcrumbs a { color: inherit; }
.breadcrumbs a:hover { color: var(--primary-700); }
.breadcrumbs .icon { color: var(--ink-400); }
.person__link { color: inherit; }
.person__link:hover { color: var(--primary-700); text-decoration: underline; }

/* Bar chart — davomat dinamikasi */
.bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 14px; align-items: end; }
.bar { display: flex; flex-direction: column; align-items: stretch; gap: 6px; text-align: center; }
.bar__value { font-size: 12px; line-height: 16px; font-weight: 700; color: var(--ink-700); }
.bar__fill { display: block; border-radius: 4px 4px 0 0; background: var(--primary-100); }
.bar.is-current .bar__fill { background: var(--primary-600); }
.bar.is-current .bar__value { color: var(--primary-600); }
.bar.is-empty .bar__fill { background: var(--ink-bg); }
.bar.is-empty .bar__value { color: var(--ink-400); }
.bar__label { font-size: 12px; line-height: 16px; font-weight: 500; color: var(--ink-500); }

/* Grade — baho kvadrati */
.grade {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: var(--radius-sm); font-size: 14px; line-height: 20px; font-weight: 700;
}
.grade--green { background: var(--green-100); color: var(--green-700); }
.grade--gold { background: var(--gold-100); color: var(--gold-600); }
.grade--red { background: var(--red-100); color: var(--red-600); }
.grade--gray { background: var(--ink-bg); color: var(--ink-500); }

.coin-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 5px; border-radius: var(--radius-pill);
  background: var(--gold-100); color: var(--gold-600); font-size: 12px; line-height: 16px; font-weight: 700;
}
a.level-pick { text-decoration: none; }
.level-pick.is-on { background: var(--primary-600); border-color: var(--primary-600); color: var(--ink-white); font-weight: 700; }
.data-table .col-60 { width: 60px; }

/* CourseMeter — kurs jarayoni: qizil, tugaganda oltin */
.course-meter { display: flex; align-items: center; gap: 10px; color: var(--ink-700); }
.course-meter .progress { flex: 1; min-width: 0; background: var(--primary-100); }
.course-meter .progress__fill { background: var(--primary-600); }
.course-meter.is-finished .progress { background: var(--gold-100); }
.course-meter.is-finished .progress__fill { background: var(--gold-500); }
.btn.is-disabled { opacity: .5; cursor: default; }
.coin-chip--l { padding: 6px 12px 6px 6px; font-size: 14px; line-height: 20px; }
.stat-card .stat-card__hint.text-green { color: var(--green-600); }

/* Switch — "Ustozga / Hammaga" */
.switch { display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--ink-500); font-size: 12px; line-height: 16px; font-weight: 500; }
.switch:disabled { opacity: .5; cursor: default; }
.switch__track { position: relative; width: 40px; height: 24px; flex-shrink: 0; border-radius: 12px; background: var(--ink-line); transition: background-color .15s; }
.switch__track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink-white); box-shadow: 0 1px 2px rgba(0,0,0,.15); transition: transform .15s; }
.switch.is-on .switch__track, .switch-input:checked + .switch .switch__track { background: var(--primary-600); }
.switch.is-on .switch__track::after, .switch-input:checked + .switch .switch__track::after { transform: translateX(16px); }
.switch-input { position: absolute; opacity: 0; pointer-events: none; }
.switch-input:focus-visible + .switch .switch__track { outline: 2px solid var(--primary-500); outline-offset: 2px; }
.field__control.is-disabled { opacity: .5; }

/* SlotChip — darsdagi material turi soni */
.slot-chip {
  display: inline-flex; align-items: center; gap: 4px; min-width: 40px; justify-content: center; padding: 4px 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 12px; line-height: 16px; font-weight: 700;
}
.slot-chip--pdf, .slot-chip--presentation { background: var(--red-100); color: var(--red-600); }
.slot-chip--audio { background: var(--gold-100); color: var(--gold-600); }
.slot-chip--video { background: var(--blue-100); color: var(--blue-600); }
.slot-chip--empty { background: none; border: 1px dashed var(--ink-line); color: var(--ink-300); cursor: pointer; }
.slot-chip--empty:hover { border-color: var(--primary-500); color: var(--primary-600); }
.level-pick--radio:has(input:checked) .icon { display: none; }
.progress[hidden] { display: none; }
