/* Ders İşleme Takip ve Arşiv Sistemi — uygulama katmanı.
   Bootstrap yalnızca temel (reboot, grid, form, table) olarak yüklenir;
   görünür tasarım bu dosyadaki değişkenlerden gelir. */

:root {
    --ink: #1c2733;
    --ink-soft: #4a5868;
    --ink-muted: #6f7c8a;
    --paper: #f4f6f8;
    --surface: #ffffff;
    --line: #dfe4ea;
    --line-strong: #c9d1da;
    --brand: #1f3a5f;
    --brand-deep: #152a45;
    --brand-soft: #e7eef7;
    --accent: #9b2335;
    --success: #1e6b45;
    --success-bg: #e5f3eb;
    --info: #1d5c8c;
    --info-bg: #e4f0f9;
    --warning: #8a5a00;
    --warning-bg: #fdf3dc;
    --danger: #a12a2a;
    --danger-bg: #fbe8e8;
    --exempt: #5b4a86;
    --exempt-bg: #eeeaf7;
    --makeup: #0f6a6a;
    --makeup-bg: #e1f3f2;
    --muted-bg: #eceff2;
    --radius: 6px;
    --sidebar-width: 236px;
    --font: "Segoe UI", "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
html, body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
}

a { color: var(--brand); }
a:hover { color: var(--brand-deep); }

/* --- Üst çubuk --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 58px;
    padding: 0.5rem 1.25rem;
    background: var(--brand);
    color: #fff;
    border-bottom: 3px solid var(--accent);
}
.brand { display: flex; flex-direction: column; color: #fff; text-decoration: none; line-height: 1.15; }
.brand:hover { color: #fff; }
.brand-unit { font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.8; }
.brand-name { font-weight: 600; font-size: 1rem; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 0.9rem; }
.user-block { display: flex; flex-direction: column; text-align: right; line-height: 1.15; }
.user-name { font-weight: 600; font-size: 0.9rem; }
.user-role { font-size: 0.72rem; opacity: 0.8; }
.sidebar-toggle {
    display: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: transparent;
    color: #fff;
    border-radius: var(--radius);
    padding: 0.2rem 0.6rem;
    font-size: 1.1rem;
}

/* --- Kabuk --- */
.shell { display: flex; align-items: stretch; min-height: calc(100vh - 58px); }
.sidebar {
    flex: 0 0 var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 1rem 0.75rem;
}
.nav-group + .nav-group { margin-top: 1rem; }
.nav-group-title {
    margin: 0 0 0.35rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
}
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-item {
    display: block;
    padding: 0.42rem 0.6rem;
    border-radius: var(--radius);
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.92rem;
}
.nav-item:hover { background: var(--brand-soft); color: var(--brand-deep); }
.nav-item.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.content { flex: 1 1 auto; min-width: 0; padding: 1.5rem 1.75rem 3rem; }

/* --- Sayfa başlığı ve paneller --- */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.75rem; margin-bottom: 1.25rem; }
.page-title { font-size: 1.45rem; font-weight: 650; margin: 0; color: var(--brand-deep); }
.page-subtitle { margin: 0.25rem 0 0; color: var(--ink-muted); }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.1rem;
}
.panel-title { font-size: 1.02rem; font-weight: 650; margin: 0 0 0.85rem; color: var(--brand-deep); }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.1rem; }
.panel-grid > .panel { margin-bottom: 0; }

/* --- Sayaç kartları --- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.85rem; margin-bottom: 1.25rem; }
.stat-card {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--line-strong);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--ink);
}
a.stat-card:hover { border-color: var(--line-strong); box-shadow: 0 1px 4px rgba(20, 40, 70, 0.08); color: var(--ink); }
.stat-value { font-size: 1.7rem; font-weight: 650; line-height: 1.1; }
.stat-label { font-size: 0.82rem; color: var(--ink-muted); }
.tone-border-success { border-left-color: var(--success); }
.tone-border-info { border-left-color: var(--info); }
.tone-border-warning { border-left-color: #d49b1c; }
.tone-border-danger { border-left-color: var(--danger); }
.tone-border-makeup { border-left-color: var(--makeup); }
.tone-border-muted { border-left-color: var(--line-strong); }

/* --- Durum rozetleri --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}
.tone-success { color: var(--success); background: var(--success-bg); border-color: #c4e3d1; }
.tone-info { color: var(--info); background: var(--info-bg); border-color: #c5dcee; }
.tone-warning { color: var(--warning); background: var(--warning-bg); border-color: #f1dca8; }
.tone-danger { color: var(--danger); background: var(--danger-bg); border-color: #f0c6c6; }
.tone-exempt { color: var(--exempt); background: var(--exempt-bg); border-color: #d9d0ee; }
.tone-makeup { color: var(--makeup); background: var(--makeup-bg); border-color: #bfe3e1; }
.tone-muted { color: var(--ink-muted); background: var(--muted-bg); border-color: var(--line); }

/* --- Tablolar --- */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { margin: 0; font-size: 0.9rem; }
.data-table th {
    background: #f7f9fb;
    color: var(--ink-soft);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border-bottom: 1px solid var(--line-strong);
}
.data-table td { vertical-align: middle; border-color: var(--line); }
.data-table tr:hover td { background: #fafbfd; }
.cell-muted { color: var(--ink-muted); font-size: 0.82rem; }
.cell-strong { font-weight: 600; }

/* --- Formlar --- */
.field { margin-bottom: 0.85rem; }
.form-label { font-size: 0.84rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 0.25rem; }
.form-control, .form-select { border-color: var(--line-strong); border-radius: var(--radius); font-size: 0.92rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 58, 95, 0.15); }
.form-text { display: block; color: var(--ink-muted); margin-top: 0.2rem; font-size: 0.78rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.inline-form { display: inline; margin: 0; }
.btn { border-radius: var(--radius); font-weight: 600; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 0.75rem; align-items: end; }

/* --- Flash --- */
.flash { padding: 0.7rem 0.9rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; font-size: 0.92rem; }
.flash-success { color: var(--success); background: var(--success-bg); border-color: #c4e3d1; }
.flash-error { color: var(--danger); background: var(--danger-bg); border-color: #f0c6c6; }
.flash-warning { color: var(--warning); background: var(--warning-bg); border-color: #f1dca8; }
.flash-info { color: var(--info); background: var(--info-bg); border-color: #c5dcee; }

/* --- Bu hafta / oturum listeleri --- */
.course-block { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 0.9rem; margin-bottom: 0.7rem; background: #fcfdfe; }
.course-block-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; align-items: baseline; margin-bottom: 0.4rem; }
.course-block-title { font-weight: 650; color: var(--brand-deep); }
.session-list { list-style: none; margin: 0; padding: 0; }
.session-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; padding: 0.35rem 0; border-top: 1px dashed var(--line); }
.session-item:first-child { border-top: 0; }
.session-when { min-width: 11rem; font-size: 0.9rem; color: var(--ink-soft); }
.session-link { margin-left: auto; font-size: 0.85rem; }
.week-table td:first-child { white-space: nowrap; font-weight: 600; }

.detail-list { display: grid; grid-template-columns: minmax(130px, max-content) 1fr; gap: 0.35rem 1rem; margin: 0; }
.detail-list dt { font-weight: 600; color: var(--ink-muted); font-size: 0.85rem; }
.detail-list dd { margin: 0; }
.meta-line { color: var(--ink-muted); font-size: 0.85rem; margin: 0.25rem 0; }
.empty-state { color: var(--ink-muted); font-style: italic; margin: 0.25rem 0; }

.doc-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.doc-slot { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.85rem 1rem; background: #fcfdfe; }
.doc-slot h3 { font-size: 0.95rem; font-weight: 650; margin: 0 0 0.5rem; }
.pdf-frame { width: 100%; height: 640px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; }
.attendance-box { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; padding: 0.75rem 1rem; background: var(--brand-soft); border-radius: var(--radius); margin-bottom: 0.9rem; font-size: 1rem; }
.attendance-box strong { color: var(--brand-deep); }
.note-box { padding: 0.7rem 0.9rem; border-left: 4px solid var(--warning); background: var(--warning-bg); border-radius: var(--radius); margin-bottom: 0.9rem; white-space: pre-wrap; }
.note-box.danger { border-left-color: var(--danger); background: var(--danger-bg); }

/* --- Denetim kaydı --- */
.audit-list { border-top: 1px solid var(--line); }
.audit-event { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(190px, 0.8fr); gap: 0.35rem 1.25rem; padding: 0.9rem 0.15rem; border-bottom: 1px solid var(--line); }
.audit-main strong { display: block; color: var(--brand-deep); font-size: 0.95rem; }
.audit-actor { margin: 0.18rem 0 0; color: var(--ink-soft); font-size: 0.86rem; }
.audit-context { display: flex; flex-wrap: wrap; align-items: center; align-content: start; gap: 0.45rem 0.65rem; }
.audit-time { color: var(--ink-muted); font-size: 0.82rem; white-space: nowrap; }
.audit-meta { grid-column: 1 / -1; }
.audit-details { color: var(--ink-muted); font-size: 0.84rem; }
.audit-details code { display: block; margin-top: 0.4rem; overflow-wrap: anywhere; white-space: pre-wrap; }

/* --- Konuk sayfaları --- */
.guest-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.guest-card { width: 100%; max-width: 440px; box-sizing: border-box; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--radius); padding: 1.6rem 1.6rem 1.4rem; box-shadow: 0 6px 24px rgba(20, 40, 70, 0.07); }
.guest-brand { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--line); }
.guest-logo { width: 56px; height: 56px; flex-shrink: 0; object-fit: contain; }
.guest-brand-text { min-width: 0; }
.guest-unit { margin: 0; font-size: 0.78rem; color: var(--ink-muted); }
.guest-app { margin: 0.25rem 0 0; font-weight: 650; color: var(--brand-deep); }
.guest-title { font-size: 1.25rem; font-weight: 650; margin: 0 0 1rem; }
.guest-note { width: 100%; max-width: 440px; box-sizing: border-box; margin-top: 1rem; font-size: 0.8rem; color: var(--ink-muted); text-align: center; }
.small-link { font-size: 0.88rem; }
.refusal-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.refusal-card { max-width: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }

/* --- Duyarlı yerleşim --- */
@media (max-width: 991.98px) {
    .sidebar-toggle { display: inline-block; }
    .sidebar {
        position: fixed;
        top: 58px;
        bottom: 0;
        left: 0;
        z-index: 25;
        width: var(--sidebar-width);
        transform: translateX(-105%);
        transition: transform 0.18s ease;
        overflow-y: auto;
        box-shadow: 4px 0 18px rgba(20, 40, 70, 0.12);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .content { padding: 1.1rem 1rem 2.5rem; }
    .user-block { display: none; }
    .pdf-frame { height: 460px; }
}

@media (max-width: 575.98px) {
    .topbar { gap: 0.55rem; padding: 0.5rem 0.75rem; }
    .brand { min-width: 0; }
    .brand-unit { display: none; }
    .brand-name { font-size: 0.88rem; overflow-wrap: anywhere; }
    .topbar-user { gap: 0.45rem; }
    .content { padding: 0.85rem 0.75rem 2rem; }
    .page-title { font-size: 1.2rem; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1 1 auto; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; }
    .panel { padding: 0.9rem; }
    .panel-grid, .doc-slots { grid-template-columns: minmax(0, 1fr); }
    .form-control, .form-select { min-height: 42px; font-size: 16px; }
    textarea.form-control { min-height: 96px; }
    .btn, .sidebar-toggle { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; }
    .button-row > .btn, .button-row > .inline-form { flex: 1 1 auto; }
    .button-row > .inline-form .btn { width: 100%; }
    .table-wrap { margin-right: -0.15rem; padding-bottom: 0.2rem; }
    .data-table { min-width: 600px; }
    .session-item { align-items: flex-start; padding: 0.55rem 0; }
    .session-when { flex: 1 1 100%; }
    .session-link { margin-left: 0; padding: 0.45rem 0.15rem; font-size: 0.95rem; }
    .detail-list { gap: 0.15rem; }
    .guest-page { justify-content: flex-start; padding-top: 1rem; }
    .guest-card { padding: 1.15rem 1rem; }
    .guest-logo { width: 46px; height: 46px; }
    .audit-event { display: block; padding: 0.85rem 0; }
    .audit-context { margin-top: 0.45rem; }
    .audit-meta { margin-top: 0.4rem; }
    .detail-list { grid-template-columns: 1fr; }
}

@media print {
    .topbar, .sidebar, .page-actions, form { display: none !important; }
    .content { padding: 0; }
    .panel { border: 0; }
}
