/* ==========================================================================
   Tamkeen — visual refresh (loaded after styles.css)
   Calm teal/navy brand, warm amber accent, soft surfaces, one clear top bar.
   ========================================================================== */

:root {
  --primary: #0f5b78;
  --primary-light: #1f7fa3;
  --primary-dark: #0b3d52;
  --teal: #2bb3a3;
  --accent: #f2a93b;
  --accent-light: #f8c977;
  --success: #1f9d6b;
  --warning: #d9822b;
  --danger: #c8443f;
  --bg: #f3f6fa;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-muted: #5b6b7c;
  --border: #e1e8f0;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 52, 72, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 52, 72, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
  --focus-ring: 0 0 0 3px rgba(43, 179, 163, 0.35);
  --tk-surface-2: #f7f9fc;
  --tk-teal-soft: #e5f6f3;
  --tk-primary-soft: #e7f1f6;
}

html { scroll-behavior: smooth; }
body {
  background:
    radial-gradient(1200px 400px at 100% -120px, rgba(43, 179, 163, 0.10), transparent 60%),
    radial-gradient(900px 380px at -10% -160px, rgba(15, 91, 120, 0.10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
body:has(.tk-topbar) { padding: 0 !important; }
::selection { background: rgba(43, 179, 163, 0.25); }

/* -------------------------------------------------------------- top bar */
.tk-topbar {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center; gap: 18px;
  padding: 10px clamp(16px, 3vw, 48px);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(225, 232, 240, 0.9);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 6px 24px rgba(15, 52, 72, 0.05);
}
.tk-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.tk-brand__mark svg { width: 38px; height: 38px; display: block; filter: drop-shadow(0 4px 10px rgba(15, 91, 120, 0.25)); }
.tk-brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.tk-brand__text strong { font-size: 1.12rem; font-weight: 800; color: var(--primary-dark); }
.tk-brand__text small { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }

.tk-nav { display: flex; gap: 4px; margin-inline-start: 10px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tk-nav::-webkit-scrollbar { display: none; }
.tk-nav a {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 8px 14px; border-radius: 10px; text-decoration: none;
  color: var(--text-muted); font-weight: 600; font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
}
.tk-nav a svg { width: 18px; height: 18px; }
.tk-nav a:hover { background: var(--tk-surface-2); color: var(--primary-dark); }
.tk-nav a[aria-current="page"] { background: var(--tk-teal-soft); color: #0b6a5f; }
.tk-nav a:focus-visible { outline: none; box-shadow: var(--focus-ring); }
html[data-tk-role="staff"] .tk-nav a[data-for="management"],
html[data-tk-role="management"] .tk-nav a[data-for="staff"] { display: none; }

.tk-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tk-context {
  font-size: 0.8rem; color: var(--text-muted); background: var(--tk-surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 5px 12px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tk-context:empty { display: none; }
.tk-context strong { color: var(--primary-dark); }
.tk-iconbtn {
  position: relative; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; color: var(--primary-dark); display: grid; place-items: center; cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
}
.tk-iconbtn svg { width: 20px; height: 20px; }
.tk-iconbtn:hover { background: var(--tk-surface-2); }
.tk-iconbtn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tk-iconbtn .notif-badge { position: absolute; top: -5px; inset-inline-end: -5px; }

.tk-user { position: relative; }
.tk-user__btn {
  display: flex; align-items: center; gap: 9px; font-family: inherit; cursor: pointer;
  border: 1px solid var(--border); background: #fff; border-radius: 14px; padding: 4px 6px 4px 10px; color: var(--text);
}
.tk-user__btn:hover { background: var(--tk-surface-2); }
.tk-user__btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tk-user__avatar {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 0.85rem;
  color: #fff; background: linear-gradient(135deg, var(--teal), var(--primary));
}
.tk-user__meta { display: flex; flex-direction: column; text-align: start; line-height: 1.2; max-width: 170px; }
.tk-user__meta strong { font-size: 0.84rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tk-user__meta small { font-size: 0.7rem; color: var(--text-muted); }
.tk-user__chev { width: 16px; height: 16px; color: var(--text-muted); }
.tk-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 230px; background: #fff;
  border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 210;
  animation: tk-pop 0.14s ease-out;
}
@keyframes tk-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tk-menu a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; text-decoration: none;
  color: var(--text); font-size: 0.88rem; font-weight: 500;
}
.tk-menu a svg { width: 18px; height: 18px; color: var(--text-muted); }
.tk-menu a:hover, .tk-menu a:focus-visible { background: var(--tk-surface-2); outline: none; }
.tk-menu a.is-danger { color: var(--danger); }
.tk-menu a.is-danger svg { color: var(--danger); }
.tk-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }
.tk-menu__line { font-size: 0.78rem; color: var(--text-muted); padding: 8px 10px 6px; }
.tk-menu__line:empty { display: none; }

/* -------------------------------------------------------------- page layout */
/* Full-width workspace: content spans the window with comfortable side gutters. */
main.page-wrap, main.sx-wrap { max-width: none; width: 100%; padding: 26px clamp(16px, 3vw, 48px) 56px; margin: 0; }
.tk-pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.tk-pagehead h1 { font-size: 1.6rem; font-weight: 800; color: var(--primary-dark); line-height: 1.25; }
.tk-pagehead p { color: var(--text-muted); font-size: 0.93rem; margin-top: 4px; max-width: 46rem; }
.tk-pagehead__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* -------------------------------------------------------------- buttons */
.btn {
  border-radius: 11px; font-weight: 700; font-size: 0.9rem; padding: 10px 18px; letter-spacing: 0;
  transition: transform 0.12s ease, box-shadow var(--transition), background var(--transition), border-color var(--transition);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--primary-light), var(--primary)); color: #fff; border: 1px solid transparent; box-shadow: 0 6px 16px rgba(15, 91, 120, 0.22); }
.btn-primary:hover { background: linear-gradient(135deg, #2390b8, var(--primary-light)); box-shadow: 0 8px 22px rgba(15, 91, 120, 0.28); }
.btn-accent { background: linear-gradient(135deg, #f7bd59, var(--accent)); color: #3b2504; border: 1px solid transparent; box-shadow: 0 6px 16px rgba(242, 169, 59, 0.28); }
.btn-accent:hover { background: linear-gradient(135deg, #f9c86f, #f4b14a); }
.btn-ghost { background: #fff; color: var(--primary-dark); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--tk-surface-2); border-color: #cfdbe7; color: var(--primary-dark); }
.btn-danger { border-radius: 11px; }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.65; cursor: progress; }

/* -------------------------------------------------------------- hero (teacher dashboard) */
.dashboard-hero {
  border-radius: 22px; min-height: 0; margin-bottom: 22px;
  background:
    radial-gradient(500px 220px at 8% 120%, rgba(242, 169, 59, 0.28), transparent 60%),
    radial-gradient(600px 260px at 100% -20%, rgba(43, 179, 163, 0.45), transparent 60%),
    linear-gradient(135deg, #0b3d52 0%, #0f5b78 55%, #13708f 100%);
  box-shadow: 0 18px 40px rgba(11, 61, 82, 0.22);
}
.dashboard-hero::after { display: none; }
.dashboard-hero__inner { padding: 26px 30px; }
.dashboard-hero__title { font-size: clamp(1.35rem, 2.4vw, 1.75rem); }
.dashboard-hero__highlights { display: none; }
.dashboard-hero__icon-ring { transform: scale(0.82); }

/* -------------------------------------------------------------- stats */
.stats-grid { gap: 14px; margin-bottom: 22px; }
.stat-card {
  position: relative; text-align: start; padding: 16px 18px 16px; border-radius: 16px;
  border: 1px solid var(--border); border-top: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden;
}
.stat-card::before { content: ""; position: absolute; inset-inline-start: 0; inset-block: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--sc, var(--primary)); }
html[dir="rtl"] .stat-card::before { border-radius: 4px 0 0 4px; }
.stats-grid .stat-card { border-top-color: var(--border) !important; }
.stat-card.total { --sc: var(--primary); }
.stat-card.new { --sc: #d9822b; }
.stat-card.progress { --sc: var(--accent); }
.stat-card.done { --sc: var(--success); }
.stat-card.teachers { --sc: #6b56c9; }
.stat-number { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-bottom: 2px; }
.stat-card.progress .stat-number { color: #b9781a; }
.stat-label { font-size: 0.8rem; font-weight: 600; }

/* -------------------------------------------------------------- toolbar & cards */
.toolbar { margin-bottom: 14px; }
.toolbar-title { font-size: 1.15rem; font-weight: 800; }
.filters-card, .table-card, .admin-settings-card, .staffing-dashboard-card {
  border-radius: 16px !important; border: 1px solid var(--border) !important; box-shadow: var(--shadow) !important; background: #fff !important;
}
.filters-card { padding: 14px 16px; }
.filters-row { gap: 10px; }
.filter-group label { font-size: 0.74rem; font-weight: 700; color: var(--text-muted); letter-spacing: 0; }
.filter-group input, .filter-group select {
  border-radius: 10px !important; border: 1.5px solid var(--border) !important; background: var(--tk-surface-2) !important; min-height: 40px;
}
.filter-group input:focus, .filter-group select:focus { background: #fff !important; border-color: var(--teal) !important; box-shadow: var(--focus-ring) !important; outline: none; }

/* -------------------------------------------------------------- admin tabs → segmented control */
.admin-main-tabs {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px; margin-bottom: 18px;
  background: #fff; border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow);
}
.admin-main-tab-btn {
  flex: 0 1 auto; min-height: 40px; padding: 8px 18px; border: 0; border-radius: 10px; background: transparent;
  color: var(--text-muted); font-weight: 700; font-size: 0.9rem; font-family: inherit;
}
.admin-main-tab-btn:hover { background: var(--tk-surface-2); border: 0; }
.admin-main-tab-btn.active { background: var(--primary); color: #fff; border: 0; box-shadow: 0 4px 12px rgba(15, 91, 120, 0.25); }
.admin-main-tab-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* -------------------------------------------------------------- table */
.table-card { overflow: hidden; }
.table-card table th {
  background: var(--tk-surface-2) !important; color: var(--text-muted) !important; font-size: 0.76rem !important; font-weight: 700 !important;
  border-bottom: 1px solid var(--border) !important; padding: 12px 14px !important;
}
.table-card table td { padding: 12px 14px !important; border-bottom: 1px solid #edf1f6 !important; }
.table-card table tbody tr { transition: background var(--transition); }
.table-card table tbody tr:hover { background: #f6fafc !important; }

/* -------------------------------------------------------------- badges */
.badge { border-radius: 999px; font-weight: 700; font-size: 0.74rem; padding: 4px 10px; }
.badge-new { background: #fff3e6; color: #a2560f; }
.badge-progress { background: #fff7e0; color: #8a5a00; }
.badge-done { background: #e4f6ee; color: #136b48; }

/* -------------------------------------------------------------- forms */
.form-group label { font-weight: 700; font-size: 0.84rem; color: #334155; }
.form-group input, .form-group select, .form-group textarea {
  border-radius: 11px; border: 1.5px solid var(--border); background: var(--tk-surface-2); transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.form-group input:focus-visible, .form-group select:focus-visible, .form-group textarea:focus-visible {
  background: #fff; border-color: var(--teal); box-shadow: var(--focus-ring); outline: none;
}

/* -------------------------------------------------------------- modal */
.modal-overlay { background: rgba(11, 37, 52, 0.45); backdrop-filter: blur(6px); }
.modal-box { border-radius: 20px; border: 1px solid rgba(255,255,255,0.6); box-shadow: 0 30px 80px rgba(11, 37, 52, 0.3); }
.modal-header { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1.08rem; font-weight: 800; }
.modal-close { border-radius: 10px; }

/* -------------------------------------------------------------- toast */
.toast {
  border-radius: 14px; box-shadow: 0 12px 32px rgba(11, 37, 52, 0.28);
  white-space: normal; max-width: min(560px, calc(100vw - 32px)); text-align: center; line-height: 1.5;
}

/* -------------------------------------------------------------- admin auth splash (replaces the legacy PIN flash) */
.tk-splash { min-height: calc(100vh - 80px); display: grid; place-items: center; }
.tk-splash__box { text-align: center; color: var(--text-muted); }
/* Avoid a loading-screen flash when the session check completes quickly. */
.tk-session-check { visibility: hidden; animation: tk-session-check-reveal 0s 300ms forwards; }
@keyframes tk-session-check-reveal { to { visibility: visible; } }
.tk-spinner {
  width: 38px; height: 38px; border-radius: 50%; margin: 0 auto 12px;
  border: 3px solid var(--tk-teal-soft); border-top-color: var(--teal); animation: tk-spin 0.8s linear infinite;
}
@keyframes tk-spin { to { transform: rotate(360deg); } }

/* legacy gradient header (about page) — calmer */
.site-header { background: linear-gradient(135deg, #0b3d52, #0f5b78 60%, #13708f); border-radius: 16px; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .tk-brand__text small { display: none; }
  .tk-user__meta { display: none; }
  .tk-context { display: none; }
}
@media (max-width: 680px) {
  .tk-topbar { flex-wrap: wrap; gap: 10px; padding: 8px 14px; }
  .tk-nav { order: 3; flex-basis: 100%; margin: 0; }
  .tk-nav a { padding: 7px 11px; font-size: 0.84rem; }
  .tk-actions { margin-inline-start: auto; }
  .page-wrap, .sx-wrap { padding: 18px 14px 48px; }
  .admin-main-tabs { display: flex; }
  .dashboard-hero__visual { display: none; }
  .dashboard-hero, .dashboard-hero__inner, .dashboard-hero__layout, .dashboard-hero__text { min-height: 0 !important; height: auto !important; }
  .dashboard-hero__inner { padding: 20px 18px; }
  .dashboard-hero__text { text-align: start; flex: 0 0 auto !important; }
  .dashboard-hero__lead { margin-bottom: 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .admin-main-tab-btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  .tk-menu, .tk-spinner { animation: none; }
}
@media print {
  .tk-topbar { display: none !important; }
}
