/* ==========================================================================
   Meka Öğrenci Takip Sistemi — Açık (light) Material tema (Stitch tasarımı)
   ========================================================================== */
:root {
  --bg: #f7f9fb;              /* background / surface */
  --surface-lowest: #ffffff; /* kartlar */
  --surface-low: #f2f4f6;
  --surface-container: #eceef0;
  --surface-high: #e6e8ea;
  --surface-variant: #e0e3e5;
  --surface-bright: #f7f9fb;

  --ink: #191c1e;            /* on-background / on-surface */
  --muted: #444653;          /* on-surface-variant */
  --faint: #757684;          /* outline */
  --line: #c4c5d5;           /* outline-variant */

  --brand: #00288e;          /* primary (koyu mavi) */
  --on-brand: #ffffff;
  --brand-dark: #001f6f;
  --brand-container: #d0e1fb; /* secondary-container (aktif menü) */
  --on-brand-container: #173bab;
  --brand-soft: #eef2ff;

  --secondary-container: #d0e1fb;
  --on-secondary-container: #173bab;

  --green: #00695c;          /* tertiary-ish teal (başarı) */
  --green-soft: #cdeee8;
  --red: #ba1a1a;            /* error */
  --red-soft: #ffdad6;
  --yellow: #9a6b00;         /* amber (bekliyor) */
  --yellow-soft: #ffe7b3;

  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --radius: 0.75rem;
  --sidebar-w: 280px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3, h4 { font-family: 'Inter', sans-serif; }

button { font-family: inherit; cursor: pointer; }
a { color: var(--brand); text-decoration: none; }

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal; font-style: normal;
  font-size: 20px; line-height: 1;
  display: inline-block; vertical-align: middle;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}
.mi { font-size: 20px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-high); border-radius: 999px; }

/* ---------- Giriş ekranı ---------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1100px 560px at 15% -10%, #dbe6ff 0%, transparent 60%),
    radial-gradient(900px 480px at 100% 100%, #d6f1ec 0%, transparent 55%),
    var(--bg);
  padding: 20px;
}
.auth-card {
  background: var(--surface-lowest); width: 100%; max-width: 420px;
  border: 1px solid var(--line); border-radius: 1rem; padding: 34px 30px; box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 4px; font-size: 26px; color: var(--brand); font-weight: 700; }
.auth-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tabs button { flex: 1; padding: 10px; border: 1px solid var(--line); background: var(--surface-lowest); border-radius: 10px; color: var(--muted); font-weight: 600; }
.auth-tabs button.active { background: var(--secondary-container); color: var(--on-secondary-container); border-color: var(--brand); }

/* ---------- Form ---------- */
label { display: block; font-size: 12px; font-weight: 600; margin: 12px 0 6px; color: var(--muted); letter-spacing: .02em; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; background: var(--surface-lowest); color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-container); border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: var(--on-brand); font-weight: 600; font-size: 14px;
  transition: filter .15s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--surface-lowest); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-high); }
.btn.small { padding: 7px 11px; font-size: 13px; }
.btn.danger { background: var(--red); color: #fff; }
.btn.success { background: var(--green); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn .material-symbols-outlined { font-size: 18px; }

/* ---------- İskelet ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--surface-lowest); color: var(--muted);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line);
}
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 8px 8px 4px; }
.sidebar .brand .logo-ic {
  width: 40px; height: 40px; border-radius: 999px; background: var(--secondary-container);
  color: var(--on-secondary-container); display: grid; place-items: center; flex-shrink: 0;
}
.sidebar .brand .logo-ic .material-symbols-outlined { font-size: 24px; }
.sidebar .logo { font-size: 18px; font-weight: 700; color: var(--brand); }
.sidebar .logo-sub { font-size: 12px; color: var(--muted); }
.sidebar .cta { margin: 14px 4px 18px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 13.5px; border: none; background: transparent; width: 100%; text-align: left;
  transition: background .15s ease, color .15s ease;
}
.nav-item .material-symbols-outlined { font-size: 22px; }
.nav-item:hover { background: var(--surface-high); color: var(--ink); }
.nav-item.active { background: var(--secondary-container); color: var(--on-secondary-container); font-weight: 700; }
.sidebar .spacer { flex: 1; }
.sidebar .foot { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }
.sidebar .user-box { border-top: 1px solid var(--line); padding: 12px 8px 0; margin-top: 6px; font-size: 13px; color: var(--muted); }
.sidebar .user-box b { color: var(--ink); display: block; }

.content { flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 64px; position: sticky; top: 0; z-index: 40; background: var(--surface-lowest);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 16px;
}
.topbar .search {
  display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 14px; min-width: 220px; max-width: 360px; flex: 1;
}
.topbar .search input { border: none; background: transparent; padding: 0; }
.topbar .search input:focus { outline: none; }
.topbar .search .material-symbols-outlined { color: var(--faint); }
.topbar .t-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { border: none; background: transparent; color: var(--muted); width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; }
.icon-btn:hover { background: var(--surface-high); color: var(--brand); }
.avatar-sm { width: 34px; height: 34px; border-radius: 999px; background: var(--secondary-container); color: var(--on-secondary-container); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

.main { flex: 1; padding: 26px 28px; max-width: 1280px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 28px; letter-spacing: -.02em; font-weight: 700; }
.page-head .crumbs { color: var(--muted); font-size: 13px; margin-top: 4px; }
.page-head .crumbs a { cursor: pointer; }

/* ---------- Kart / grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.card {
  background: var(--surface-lowest); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card.click { cursor: pointer; transition: transform .08s ease, box-shadow .12s ease, border-color .12s; }
.card.click:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand); }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .meta { color: var(--muted); font-size: 13px; }
.card .avatar {
  width: 44px; height: 44px; border-radius: 12px; background: var(--secondary-container); color: var(--on-secondary-container);
  display: grid; place-items: center; font-weight: 700; font-size: 18px; margin-bottom: 10px;
}
.card-actions { display: flex; gap: 8px; margin-top: 14px; }

.empty { text-align: center; color: var(--muted); padding: 50px 20px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-lowest); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.section-title { font-size: 14px; font-weight: 700; margin: 24px 0 12px; color: var(--ink); letter-spacing: .02em; }

/* ---------- Tablo ---------- */
table { width: 100%; border-collapse: collapse; background: var(--surface-lowest); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: var(--surface-low); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.assigned { background: var(--secondary-container); color: var(--on-secondary-container); }
.badge.done { background: var(--green-soft); color: var(--green); }
.badge.not_done { background: var(--red-soft); color: var(--red); }

/* ---------- Program oluşturucu ---------- */
.builder { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .builder { grid-template-columns: 1fr; } }

.picker-list { display: flex; flex-direction: column; gap: 8px; }
.picker-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-lowest); }
.picker-item.click { cursor: pointer; }
.picker-item.click:hover { border-color: var(--brand); background: var(--surface-low); }
.picker-item .chev { color: var(--faint); }

.topic-block { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; background: var(--surface-lowest); }
.topic-block .topic-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; background: var(--surface-low); font-weight: 700; cursor: pointer; }
.topic-block .topic-head.prev { background: var(--yellow-soft); }
.topic-block .tests { padding: 8px 14px 14px; display: flex; flex-wrap: wrap; gap: 8px; }

.chk { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; cursor: pointer; user-select: none; background: var(--surface-lowest); }
.chk input { width: auto; margin: 0; }
.chk.prev { background: var(--yellow-soft); border-color: var(--yellow); }
.chk.st-assigned { background: var(--yellow-soft); border-color: var(--yellow); color: var(--yellow); }
.chk.st-done { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.chk.st-not_done { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.chk.selected { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin: 6px 0 14px; flex-wrap: wrap; }
.legend .dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 5px; vertical-align: middle; }

.cart { position: sticky; top: 84px; }
.cart .cart-body { max-height: 55vh; overflow: auto; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.cart-item { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 8px 10px; background: var(--surface-low); border-radius: 8px; }
.cart-item .x { color: var(--red); cursor: pointer; font-weight: 700; }
.cart-count { background: var(--brand); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }

.week-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.day-col { background: var(--surface-lowest); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.day-col h4 { margin: 0 0 8px; font-size: 14px; display: flex; justify-content: space-between; }
.day-col .cnt { color: var(--muted); font-weight: 500; }
.day-task { font-size: 12.5px; padding: 8px; border-radius: 8px; background: var(--surface-low); margin-bottom: 6px; border-left: 3px solid var(--brand); }
.day-task .s { color: var(--muted); display: block; }
.day-col.weekend { background: var(--brand-soft); border-color: var(--brand-container); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(30px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 999; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: grid; place-items: center; z-index: 500; padding: 20px; }
.modal { background: var(--surface-lowest); border: 1px solid var(--line); border-radius: 1rem; padding: 24px; width: 100%; max-width: 460px; box-shadow: var(--shadow); max-height: 88vh; overflow: auto; }
.modal h3 { margin: 0 0 14px; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.pill-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.pill-tabs button { padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-lowest); font-weight: 600; color: var(--muted); }
.pill-tabs button.active { background: var(--secondary-container); color: var(--on-secondary-container); border-color: var(--brand); }

.hint { background: var(--brand-soft); border: 1px solid var(--brand-container); color: var(--on-brand-container); padding: 12px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; }
.spin { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: sp 0.7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.center-load { display: grid; place-items: center; padding: 60px; }

/* ---------- Grafikler ---------- */
.chart-card { background: var(--surface-lowest); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

@media (max-width: 820px) {
  .sidebar { width: 84px; }
  .sidebar .logo, .sidebar .logo-sub, .nav-item span:not(.material-symbols-outlined), .sidebar .cta .label, .sidebar .user-box { display: none; }
  .sidebar .brand { justify-content: center; }
  .nav-item { justify-content: center; }
  .topbar .search { min-width: 0; }
}
