/* Shared components (student site + admin) */

/* Icons */
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 24px; height: 24px; }
[dir="rtl"] .icon.flip { transform: scaleX(-1); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14.5px; white-space: nowrap;
  border: 1px solid transparent; transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-accent { background: var(--accent); color: #1b1300; }
.btn-accent:hover { filter: brightness(1.05); }
.btn-soft { background: var(--primary-soft); color: var(--primary-ink); }
.btn-soft:hover { background: var(--primary-soft-hover); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--primary-2); color: var(--primary-ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft-hover); }
.btn-success { background: #1e9e55; color: #fff; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px;
  color: var(--text-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 9px; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-2) 14%, transparent); }
.input::placeholder, .textarea::placeholder { color: var(--placeholder); }
.hint { font-size: 12.5px; color: var(--muted); }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.search-field { position: relative; }
.search-field .icon { position: absolute; inset-inline-start: 14px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.search-field .input { padding-inline-start: 44px; }

/* Cards & surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.pad { padding: 18px; }
.card.hover { transition: border-color .15s, box-shadow .2s, transform .2s var(--ease); }
.card.hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }

/* Chips, badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface);
  font-size: 13.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.badge.primary { background: var(--primary-soft); color: var(--primary-ink); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.info { background: var(--info-soft); color: var(--info); }

/* List rows */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px;
  border-bottom: 1px solid var(--border); text-align: start; width: 100%; transition: background .12s;
}
.list-item:last-child { border-bottom: 0; }
button.list-item:hover, a.list-item:hover { background: var(--hover); }
.list-item .li-body { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; line-height: 1.45; }
.list-item .li-sub { font-size: 13px; color: var(--muted); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ico-box {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary-ink);
}
.ico-box.accent { background: var(--accent-soft); color: #9a6400; }
.ico-box.success { background: var(--success-soft); color: var(--success); }
.ico-box.info { background: var(--info-soft); color: var(--info); }
.ico-box.danger { background: var(--danger-soft); color: var(--danger); }
.ico-box.violet { background: var(--violet-soft); color: var(--violet); }
.ico-box.rose { background: var(--rose-soft); color: var(--rose); }

/* Section header */
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section-head h2 { font-size: 18px; }
.section-head .link { margin-inline-start: auto; font-size: 13.5px; font-weight: 600; color: var(--primary-2); display: inline-flex; align-items: center; gap: 2px; }

/* Page header */
.page-head { padding: 22px 0 6px; }
.page-head .crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.page-head .crumbs a:hover { color: var(--primary-2); }
.page-head h1 { font-size: clamp(22px, 3.4vw, 28px); }
.page-head p { color: var(--muted); margin-top: 4px; }

/* Empty / loading */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .ico-box { margin: 0 auto 12px; width: 56px; height: 56px; border-radius: 16px; background: var(--surface-2); color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.skeleton { background: linear-gradient(90deg, var(--skeleton) 0%, var(--skeleton-hi) 50%, var(--skeleton) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Segmented */
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 2px; }
.segmented button { height: 36px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 10px 14px; background: var(--hover); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }

/* Modal / sheet */
.overlay {
  position: fixed; inset: 0; z-index: 90; background: rgba(10, 20, 36, .45); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 24px; } }
.dialog {
  width: 100%; max-width: 560px; max-height: 92dvh; display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  animation: rise .26s var(--ease);
}
@media (min-width: 640px) { .dialog { border-radius: 22px; } }
.dialog.wide { max-width: 860px; }
.dialog-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { font-size: 17px; flex: 1; }
.dialog-body { padding: 18px; overflow-y: auto; }
.dialog-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px 16px; border-top: 1px solid var(--border); }
@media (max-width: 639px) { .dialog-foot .btn { flex: 1; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* Toast */
.toasts { position: fixed; z-index: 120; inset-inline: 0; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 460px; padding: 12px 16px;
  background: var(--toast-bg); color: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: 14px; animation: rise .25s var(--ease);
}
.toast.success .icon { color: #6ee7a0; }
.toast.error .icon { color: #fca5a5; }

/* Tabs underline */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs button { position: relative; padding: 12px 14px; font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tabs button.active { color: var(--primary-ink); }
.tabs button.active::after { content: ""; position: absolute; inset-inline: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }

.divider { height: 1px; background: var(--border); margin: 14px 0; }
.kbd { font-size: 12px; padding: 1px 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; color: var(--muted); }

/* Dark mode tweaks */
:root[data-theme="dark"] .btn-primary:hover { background: #3c78dc; }
:root[data-theme="dark"] .ico-box.accent { color: var(--accent-ink); }
:root[data-theme="dark"] .tabs button.active::after { background: var(--primary-ink); }
:root[data-theme="dark"] .overlay { background: rgba(2, 6, 14, .62); }
:root[data-theme="dark"] .dialog { box-shadow: 0 0 0 1px var(--border), var(--shadow-lg); }
:root[data-theme="dark"] .toast { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), var(--shadow-lg); }
:root[data-theme="dark"] .chip.active { color: #fff; }
:root[data-theme="dark"] .btn-success { background: #178a49; }
