/* ===== Etkinlik Takvimi — temel stil katmanı =====
   Tüm renkler burada tanımlı token'lardan gelir. Açık tema :root'ta,
   koyu tema [data-theme="dark"] altında. Görünümlerde ham hex KULLANMA;
   yeni bir renk gerekiyorsa önce buraya token ekle. */

:root {
    color-scheme: light;

    /* Zeminler */
    --bg:            #f6f7fb;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;   /* mini satır / açık kart içi */
    --surface-3:     #f3f4f6;   /* hover gri */
    --surface-4:     #f1f5f9;   /* ayırıcı zemin */
    --tint-1:        #f5f7ff;   /* çok hafif indigo tint */

    /* Kenarlıklar */
    --border:        #e5e7eb;
    --border-soft:   #eef0f4;
    --border-strong: #d1d5db;

    /* Metin */
    --text:          #0f172a;
    --text-2:        #374151;
    --text-3:        #4b5563;
    --muted:         #6b7280;
    --muted-2:       #9ca3af;
    --faint:         #c4c9d4;
    --faint-2:       #cbd5e1;

    /* Vurgu (indigo) */
    --ac:            #6366f1;
    --ac-d:          #4f46e5;
    --ac-soft:       #eef2ff;
    --ac-ring:       #c7d2fe;
    --ac-text:       #4338ca;
    --ac-text-2:     #3730a3;

    /* Durumlar */
    --danger:        #dc2626;
    --danger-2:      #b91c1c;
    --danger-soft:   #fef2f2;
    --danger-border: #fecaca;
    --danger-border-2:#fca5a5;
    --ok:            #22c55e;
    --ok-2:          #16a34a;
    --ok-soft:       #f0fdf4;
    --ok-border:     #bbf7d0;
    --ok-text:       #166534;
    --warn-soft:     #fff7ed;
    --warn-border:   #fdba74;
    --warn-border-2: #fed7aa;
    --warn-text:     #9a3412;
    --warn-text-2:   #7c2d12;
    --warn-ac:       #f97316;
    --c-donem-border:#bfdbfe;
    --c-donem-text:  #1e40af;

    /* Özel gün / akademik etiket çiftleri (b = zemin, f = yazı) */
    --l-bg-b:        #e0f2fe;  --l-bg-f:      #0369a1;   /* belirli gün   */
    --l-hf-b:        #d1fae5;  --l-hf-f:      #065f46;   /* belirli hafta */
    --l-bayram-b:    #fee2e2;  --l-bayram-f:  #b91c1c;   /* milli bayram  */
    --l-onemli-b:    #ede9fe;  --l-onemli-f:  #5b21b6;   /* önemli gün    */
    --l-custom-b:    #ccfbf1;  --l-custom-f:  #0f766e;   /* özel gün      */
    --l-tatil-f:     #991b1b;                            /* zemin: --danger-border */
    --l-meslek-b:    #fef08a;  --l-meslek-f:  #854d0e;
    --l-uyum-f:      #14532d;                            /* zemin: --ok-border     */
    --l-karne-b:     #fde68a;  --l-karne-f:   #92400e;

    /* Koyu şerit başlık (öğretmen listesi kademe bandı) */
    --band:          #0f172a;
    --band-fg:       #ffffff;

    /* Takvim hücresi dönem zeminleri */
    --c-donem:       #eff6ff;
    --c-tatil:       #fff1f2;
    --c-meslek:      #fefce8;
    --c-karne:       #fffbeb;

    /* Gölge + geometri */
    --sh-1:  0 1px 3px rgba(16,24,40,.05);
    --sh-2:  0 2px 10px rgba(16,24,40,.06);
    --sh-3:  0 20px 40px rgba(16,24,40,.18);
    --sh-ac: 0 2px 8px rgba(99,102,241,.35);
    --radius: 10px;

    /* ── Ders programı çizelgesi ──────────────────────────────────────
       Grup bantları (sınıf düzeyi), hücre durumları ve gün başlıkları.
       Sınıf düzeyi sayısı kademeye göre değişir; g1..g6 sırayla dağıtılır. */
    --sch-g1:        #3b82f6;
    --sch-g2:        #10b981;
    --sch-g3:        #a855f7;
    --sch-g4:        #ef4444;
    --sch-g5:        #0891b2;
    --sch-g6:        #d97706;
    --sch-mixed:     #64748b;
    --sch-none:      #94a3b8;

    /* Hücre durumları: b = zemin, f = yazı, ac = sol kenar vurgusu */
    --sch-busy-b:    #f1f5f9;  --sch-busy-f:   #475569;
    --sch-etut-b:    #dcfce7;  --sch-etut-f:   #166534;
    --sch-other-b:   #dbeafe;  --sch-other-f:  #1e3a8a;  --sch-other-ac:  #2563eb;
    --sch-goz-b:     #ffedd5;  --sch-goz-f:    #9a3412;  --sch-goz-ac:    #ea580c;
    --sch-sub-b:     #ede9fe;  --sch-sub-f:    #5b21b6;  --sch-sub-ac:    #7c3aed;
    --sch-meet-b:    #fef9c3;  --sch-meet-f:   #713f12;  --sch-meet-ac:   #a16207;
    --sch-empty-b:   #ffffff;  --sch-empty-f:  #c4c9d4;
    --sch-hall:      #ca8a04;

    /* Gün başlıkları (Pazartesi → Cuma) */
    --sch-d1-b: #eff6ff;  --sch-d1-f: #1e40af;  --sch-d1-ac: #2563eb;
    --sch-d2-b: #f0fdf4;  --sch-d2-f: #166534;  --sch-d2-ac: #16a34a;
    --sch-d3-b: #fefce8;  --sch-d3-f: #854d0e;  --sch-d3-ac: #ca8a04;
    --sch-d4-b: #faf5ff;  --sch-d4-f: #6b21a8;  --sch-d4-ac: #9333ea;
    --sch-d5-b: #fff7ed;  --sch-d5-f: #9a3412;  --sch-d5-ac: #ea580c;

    /* Çizelge iskeleti */
    --sch-grid:      #e2e8f0;   /* hücre çizgisi       */
    --sch-grid-2:    #f1f5f9;   /* dikey ince çizgi    */
    --sch-edge:      #94a3b8;   /* gün sonu / sabit sütun ayırıcı */
    --sch-hi:        #fef3c7;   /* saat başlığı hover  */
}

[data-theme="dark"] {
    color-scheme: dark;

    --bg:            #0f1420;
    --surface:       #171d2b;
    --surface-2:     #1c2333;
    --surface-3:     #232b3d;
    --surface-4:     #212939;
    --tint-1:        #1e2438;

    --border:        #2b344a;
    --border-soft:   #242c3e;
    --border-strong: #3a445c;

    --text:          #e9edf5;
    --text-2:        #c9d2e2;
    --text-3:        #b3bdd0;
    --muted:         #96a1b8;
    --muted-2:       #8b96ab;
    --faint:         #5d6880;
    --faint-2:       #6b7690;

    --ac:            #818cf8;
    --ac-d:          #a5b4fc;
    --ac-soft:       #232a45;
    --ac-ring:       #4b56a0;
    --ac-text:       #a5b4fc;
    --ac-text-2:     #c7d2fe;

    --danger:        #f87171;
    --danger-2:      #fca5a5;
    --danger-soft:   #2b1a1e;
    --danger-border: #5d2b32;
    --danger-border-2:#7c3a42;
    --ok:            #4ade80;
    --ok-2:          #4ade80;
    --ok-soft:       #12251b;
    --ok-border:     #2e5c40;
    --ok-text:       #86efac;
    --warn-soft:     #2a2013;
    --warn-border:   #6b4a20;
    --warn-border-2: #6b4a20;
    --warn-text:     #fdba74;
    --warn-text-2:   #fed7aa;
    --warn-ac:       #fb923c;
    --c-donem-border:#2a3a5e;
    --c-donem-text:  #93c5fd;

    --l-bg-b:        #12303f;  --l-bg-f:      #7dd3fc;
    --l-hf-b:        #123024;  --l-hf-f:      #6ee7b7;
    --l-bayram-b:    #3a1d20;  --l-bayram-f:  #fca5a5;
    --l-onemli-b:    #282246;  --l-onemli-f:  #c4b5fd;
    --l-custom-b:    #10312c;  --l-custom-f:  #5eead4;
    --l-tatil-f:     #fca5a5;
    --l-meslek-b:    #3a3113;  --l-meslek-f:  #fde047;
    --l-uyum-f:      #86efac;
    --l-karne-b:     #3a2c12;  --l-karne-f:   #fcd34d;

    --band:          #2a3245;
    --band-fg:       #e9edf5;

    --c-donem:       #151d2e;
    --c-tatil:       #26181b;
    --c-meslek:      #242012;
    --c-karne:       #26200f;

    --sh-1:  0 1px 3px rgba(0,0,0,.35);
    --sh-2:  0 2px 10px rgba(0,0,0,.4);
    --sh-3:  0 20px 40px rgba(0,0,0,.55);
    --sh-ac: 0 2px 8px rgba(99,102,241,.45);

    /* Ders programı — koyu temada zeminler koyulaşır, yazılar açılır */
    --sch-g1:        #60a5fa;
    --sch-g2:        #34d399;
    --sch-g3:        #c084fc;
    --sch-g4:        #f87171;
    --sch-g5:        #22d3ee;
    --sch-g6:        #fbbf24;
    --sch-mixed:     #64748b;
    --sch-none:      #4b5563;

    --sch-busy-b:    #1e2739;  --sch-busy-f:   #c9d2e2;
    --sch-etut-b:    #123024;  --sch-etut-f:   #6ee7b7;
    --sch-other-b:   #14253f;  --sch-other-f:  #93c5fd;  --sch-other-ac:  #3b82f6;
    --sch-goz-b:     #33210f;  --sch-goz-f:    #fdba74;  --sch-goz-ac:    #f97316;
    --sch-sub-b:     #241e42;  --sch-sub-f:    #c4b5fd;  --sch-sub-ac:    #8b5cf6;
    --sch-meet-b:    #2b2610;  --sch-meet-f:   #fde68a;  --sch-meet-ac:   #ca8a04;
    --sch-empty-b:   #171d2b;  --sch-empty-f:  #4b566c;
    --sch-hall:      #eab308;

    --sch-d1-b: #16233c;  --sch-d1-f: #93c5fd;  --sch-d1-ac: #3b82f6;
    --sch-d2-b: #12281e;  --sch-d2-f: #6ee7b7;  --sch-d2-ac: #22c55e;
    --sch-d3-b: #2a2411;  --sch-d3-f: #fde047;  --sch-d3-ac: #eab308;
    --sch-d4-b: #231b3b;  --sch-d4-f: #c4b5fd;  --sch-d4-ac: #a855f7;
    --sch-d5-b: #2c1d12;  --sch-d5-f: #fdba74;  --sch-d5-ac: #f97316;

    --sch-grid:      #2b344a;
    --sch-grid-2:    #232b3d;
    --sch-edge:      #3a445c;
    --sch-hi:        #3a3113;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg); color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}
/* Tema geçişi — renk değişimi yumuşak olsun, düzen sıçramasın */
body, .card, .modal-box, input, select, textarea, .btn {
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

a { color: var(--ac); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--ac-soft); color: var(--ac-text); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
h1, h2, h3 { letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
hr { border: 0; border-top: 1px solid var(--border); }

/* Klavye odağı — her yerde görünür halka */
:focus-visible {
    outline: 2px solid var(--ac);
    outline-offset: 2px;
    border-radius: 6px;
}

/* ===== Üst çubuk ===== */
.topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 16px;
    padding: 11px 32px; background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--sh-1);
    margin-bottom: 16px; flex-wrap: wrap;
}
.topbar .brand a {
    display: inline-flex; align-items: center; gap: 11px;
    font-size: 17px; color: var(--text); font-weight: 650; letter-spacing: -.02em;
}
.topbar .brand a:hover { text-decoration: none; }
.topbar .brand strong { color: var(--ac); font-weight: 800; }

/* Okul logosu — koyu temada acilmis varyanti gosterilir */
.brand-logo { height: 34px; width: auto; display: block; }
.tema-koyu  { display: none; }
[data-theme="dark"] .tema-acik { display: none; }
[data-theme="dark"] .tema-koyu { display: block; }
.brand-sep  { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }
.brand-app  { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -.02em; }
.brand-app strong { color: var(--ac); font-weight: 800; }

.top-nav { display: flex; gap: 4px; }
.top-nav a {
    padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600;
    color: var(--text-3); transition: background .12s, color .12s;
}
.top-nav a:hover { background: var(--surface-3); text-decoration: none; }
.top-nav a.active { background: var(--ac-soft); color: var(--ac-text); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lvl-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
    border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff;
}
.lvl-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.85); }

.logout-btn, .theme-btn {
    border: 1px solid var(--border); background: var(--surface); border-radius: 9px;
    padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted);
    cursor: pointer; font-family: inherit;
}
.logout-btn:hover { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger-2); }
.theme-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0; font-size: 15px; line-height: 1;
}
.theme-btn:hover { background: var(--ac-soft); border-color: var(--ac-ring); color: var(--ac-text); }
.theme-btn .ico-dark  { display: none; }
[data-theme="dark"] .theme-btn .ico-light { display: none; }
[data-theme="dark"] .theme-btn .ico-dark  { display: inline; }

.app-container { max-width: 1600px; margin: 0 auto; padding: 0 32px 48px; }

/* ===== Ortak bileşenler ===== */
.page-header { display: flex; justify-content: space-between; align-items: center; gap: 12px;
               flex-wrap: wrap; margin: 0 0 14px; }
.page-header h1 { font-size: 24px; letter-spacing: -.025em; color: var(--text); margin: 0; }

/* Kademe sekmeleri (yönetim hesabı): Ders Programı ve Puantaj sayfalarında
   aynı görünüm — bu yüzden görünüm dosyalarında değil, burada. */
.sch-levels { display: flex; gap: 4px; }
.sch-lvl {
    padding: 6px 14px; border-radius: 9px; font-size: 13px; font-weight: 600;
    color: var(--text-3); border: 1px solid var(--border);
}
.sch-lvl:hover { background: var(--surface-3); text-decoration: none; }
.sch-lvl.active { background: var(--lvl-color); border-color: var(--lvl-color); color: #fff; }
.sch-lvl.active:hover { text-decoration: none; }

.card {
    display: block; background: var(--surface); padding: 16px;
    border: 1px solid var(--border-soft); border-radius: 14px;
    box-shadow: var(--sh-1); color: var(--text);
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; border: 1px solid var(--border-strong); background: var(--surface);
    border-radius: var(--radius); cursor: pointer; font: inherit; font-weight: 600;
    color: var(--text-2); text-decoration: none; line-height: 1.2;
    transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn-primary { background: var(--ac); border-color: var(--ac); color: #fff; box-shadow: var(--sh-ac); }
.btn-primary:hover { background: var(--ac-d); border-color: var(--ac-d); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-2); border-color: var(--danger-2); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-block { display: flex; width: 100%; }
.btn-small { padding: 3px 9px; font-size: 0.85em; }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }

/* Form öğeleri */
input, select, textarea, button { font-family: inherit; }
/* type niteliği olmayan input'lar da kapsansın (form-row'ların çoğunda yok) */
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="range"]):not([type="submit"]),
select, textarea {
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; font-size: 13px;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--ac-ring); box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--ac); }
input[type="color"] { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px; }
::placeholder { color: var(--muted-2); }

/* Tablo (yönetim / liste ekranları) */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface);
              border-radius: var(--radius); overflow: hidden; box-shadow: var(--sh-1); }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-soft); }
.data-table thead th { background: var(--surface-2); font-weight: 600; color: var(--muted);
                       font-size: 0.85em; text-transform: uppercase; letter-spacing: .03em; }
.data-table tr:hover td { background: var(--surface-2); }
.data-table .empty { text-align: center; color: var(--muted); padding: 32px; }
.data-table .num { text-align: right; }

.footer { text-align: center; color: var(--muted); padding: 24px; }

@media (max-width: 820px) {
    body { font-size: 14.5px; }
    .topbar { padding: 9px 14px; gap: 8px; margin-bottom: 12px; }
    .topbar .brand a { font-size: 15.5px; gap: 8px; }
    .brand-logo { height: 26px; }
    .brand-sep  { height: 18px; }
    .brand-app  { font-size: 14px; }
    .top-nav { order: 3; width: 100%; overflow-x: auto; gap: 2px; padding-bottom: 2px; }
    .top-nav a { padding: 7px 11px; white-space: nowrap; }
    .top-right { gap: 8px; }
    .lvl-badge { padding: 4px 9px; font-size: 11px; }
    .app-container { padding: 0 12px 40px; }
    .page-header h1 { font-size: 19px; }
    /* Dokunma hedefleri en az 40px */
    .btn { padding: 10px 14px; }
}

/* Dar telefonlarda uygulama adi gizlenir; logo + sayfa basligi zaten anlatiyor */
@media (max-width: 560px) {
    .brand-app, .brand-sep { display: none; }
}

@media print {
    .topbar, .no-print { display: none !important; }
    body { background: #fff; }
}

/* ── Görüntüleme hesabı (bkz. Auth::VIEWERS) ─────────────────────────────
   Yalnız görüntüleyen hesapta yazma düğmeleri gizlenir. Yasağın kendisi
   sunucuda (Router::dispatch); burası sayfayı sadeleştirmek içindir. */
body.izleyici .sadece-duzenleyen { display: none !important; }
.goz-badge { background: #475569; }
