/* ==========================================================
   components.css — повторяющиеся "кирпичики" интерфейса:
   карточки, кнопки, вкладки, полоски прогресса, меню и т.д.
   ========================================================== */

/* ---------- Карточка ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px 16px;
}

.card + .card,
.card + .row-2,
.row-2 + .card,
.section + .section {
  margin-top: 12px;
}

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

.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 18px 4px 8px;
}

.muted {
  color: var(--text-muted);
}

.small {
  font-size: 12.5px;
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 700;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: transform 0.12s ease, filter 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn:hover {
  filter: brightness(1.08);
}

.btn-primary {
  color: var(--accent-text);
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.btn-block {
  width: 100%;
}

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

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ---------- Верхняя панель подэкрана (стрелка назад + заголовок) ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.topbar h1 {
  font-size: 20px;
  line-height: 1.2;
}

.topbar .sub {
  font-size: 12.5px;
  color: var(--text-muted);
}

.topbar .grow {
  flex: 1;
  min-width: 0;
}

/* ---------- Аватарки ---------- */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  border: 2px solid var(--accent);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 14%;
}

.avatar.student {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-text);
  font-weight: 800;
  font-size: 18px;
}

.avatar.small {
  width: 36px;
  height: 36px;
}

.avatar.large {
  width: 72px;
  height: 72px;
  font-size: 26px;
}

/* ---------- Полоска прогресса ---------- */
.bar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.5s ease;
}

.bar.good > span {
  background: var(--good);
}

.bar.warn > span {
  background: var(--warn);
}

.bar.bad > span {
  background: var(--bad);
}

/* ---------- Кольцо прогресса (SVG) ---------- */
.ring {
  position: relative;
  width: 84px;
  height: 84px;
  flex-shrink: 0;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring .ring-bg {
  fill: none;
  stroke: var(--surface-2);
  stroke-width: 9;
}

.ring .ring-fg {
  fill: none;
  stroke: var(--good);
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}

.ring .ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 18px;
}

/* ---------- Вкладки-переключатели ---------- */
.tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 14px;
}

.tab {
  flex: 1;
  padding: 8px 6px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-text);
}

/* ---------- Бейджи и чипы ---------- */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-muted);
}

.badge.good {
  background: var(--good-bg);
  color: var(--good);
}

.badge.warn {
  background: rgba(255, 181, 71, 0.16);
  color: var(--warn);
}

.badge.accent {
  background: rgba(107, 124, 255, 0.18);
  color: var(--accent);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 12px;
  border-radius: 99px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
}

.chip:hover {
  border-color: var(--accent);
}

/* ---------- Переключатель (toggle) ---------- */
.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle.on::after {
  transform: translateX(20px);
  background: #fff;
}

/* ---------- Реплика Романа (картинка + облачко) ---------- */
.roman-say {
  display: flex;
  align-items: center;
  gap: 12px;
}

.roman-say .roman-img {
  width: 64px;
  height: 84px;
  flex-shrink: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.roman-say .roman-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 10%;
}

.roman-say .quote {
  font-weight: 600;
  line-height: 1.35;
}

/* ---------- Нижнее меню ---------- */
.nav {
  display: flex;
  justify-content: space-around;
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 12px;
}

.nav-item.active {
  color: var(--accent);
}

/* ---------- Всплывающее окно ---------- */
.modal-back {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.5);
  animation: screen-in 0.2s ease;
}

.modal {
  width: 100%;
  max-height: 85%;
  overflow-y: auto;
  padding: 20px 18px 24px;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
}

.modal h2 {
  margin-bottom: 6px;
}

/* ---------- Всплывающая подсказка (toast) ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 10px 16px;
  border-radius: 99px;
  background: var(--text);
  color: var(--surface);
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: screen-in 0.2s ease;
  max-width: 90%;
  text-align: center;
}
