/* Sınıf Kontrol Çizelgesi Custom Stylesheet */

:root {
    --primary-navy: #183b63;
    --primary-hover: #122d4c;
    --secondary-blue: #2a6f97;
    --accent-gold: #f6c23e;
    --bg-light-gray: #f8fafc;
    --border-color: #e2e8f0;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #334155;
    background-color: #f1f5f9;
}

.fs-7 { font-size: 0.85rem; }
.fs-8 { font-size: 0.75rem; }
.fs-9 { font-size: 0.68rem; }
.btn-xs { padding: 0.2rem 0.45rem; font-size: 0.75rem; line-height: 1.2; border-radius: 0.25rem; }
.shadow-xs { box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06) !important; }
.shadow-inner { box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.06) !important; }
.border-dashed { border-style: dashed !important; }

/* Half-step Spacing Utilities (.5 scale) */
.p-0\.5  { padding: 0.125rem !important; }
.px-0\.5 { padding-left: 0.125rem !important; padding-right: 0.125rem !important; }
.py-0\.5 { padding-top: 0.125rem !important; padding-bottom: 0.125rem !important; }
.pt-0\.5 { padding-top: 0.125rem !important; }
.pb-0\.5 { padding-bottom: 0.125rem !important; }
.ps-0\.5 { padding-left: 0.125rem !important; }
.pe-0\.5 { padding-right: 0.125rem !important; }

.p-1\.5  { padding: 0.375rem !important; }
.px-1\.5 { padding-left: 0.375rem !important; padding-right: 0.375rem !important; }
.py-1\.5 { padding-top: 0.375rem !important; padding-bottom: 0.375rem !important; }
.pt-1\.5 { padding-top: 0.375rem !important; }
.pb-1\.5 { padding-bottom: 0.375rem !important; }
.ps-1\.5 { padding-left: 0.375rem !important; }
.pe-1\.5 { padding-right: 0.375rem !important; }

.p-2\.5  { padding: 0.75rem !important; }
.px-2\.5 { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
.py-2\.5 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.pt-2\.5 { padding-top: 0.75rem !important; }
.pb-2\.5 { padding-bottom: 0.75rem !important; }
.ps-2\.5 { padding-left: 0.75rem !important; }
.pe-2\.5 { padding-right: 0.75rem !important; }

.p-3\.5  { padding: 1.25rem !important; }
.px-3\.5 { padding-left: 1.25rem !important; padding-right: 1.25rem !important; }
.py-3\.5 { padding-top: 1.25rem !important; padding-bottom: 1.25rem !important; }

.m-0\.5  { margin: 0.125rem !important; }
.mt-0\.5 { margin-top: 0.125rem !important; }
.mb-0\.5 { margin-bottom: 0.125rem !important; }
.ms-0\.5 { margin-left: 0.125rem !important; }
.me-0\.5 { margin-right: 0.125rem !important; }

.m-1\.5  { margin: 0.375rem !important; }
.mt-1\.5 { margin-top: 0.375rem !important; }
.mb-1\.5 { margin-bottom: 0.375rem !important; }
.ms-1\.5 { margin-left: 0.375rem !important; }
.me-1\.5 { margin-right: 0.375rem !important; }

.m-2\.5  { margin: 0.75rem !important; }
.mt-2\.5 { margin-top: 0.75rem !important; }
.mb-2\.5 { margin-bottom: 0.75rem !important; }
.ms-2\.5 { margin-left: 0.75rem !important; }
.me-2\.5 { margin-right: 0.75rem !important; }

.gap-0\.5 { gap: 0.125rem !important; }
.gap-1\.5 { gap: 0.375rem !important; }
.gap-2\.5 { gap: 0.75rem !important; }

.bg-primary {
    background-color: var(--primary-navy) !important;
}

.bg-navy-dark {
    background-color: #0d233a !important;
}

.text-navy {
    color: var(--primary-navy) !important;
}

.btn-primary {
    background-color: var(--primary-navy);
    border-color: var(--primary-navy);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
}

.card {
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
}

.card-header {
    border-bottom: 1px solid var(--border-color);
    background-color: #ffffff;
    font-weight: 600;
}

/* Weekly Matrix Table */
.matrix-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}

.matrix-table thead th {
    background-color: #1e3a5f;
    color: #ffffff;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    padding: 10px 8px;
    border: 1px solid #2b4c77;
    font-size: 0.85rem;
}

.matrix-table tbody tr {
    transition: all 0.15s ease-in-out;
}

.matrix-table tbody tr:hover {
    background-color: #f1f7fd !important;
    cursor: pointer;
}

.matrix-table tbody tr.future-lesson-row {
    background-color: #fafbfc;
}

.matrix-table tbody tr.future-lesson-row:hover {
    background-color: #f3f4f6 !important;
}

.matrix-table tbody tr.active-lesson-row {
    background-color: #dbeafe !important;
    outline: 2px solid #2563eb;
    position: relative;
    z-index: 2;
}

.matrix-table tbody tr.active-lesson-row td {
    background-color: #dbeafe !important;
}

.cursor-pointer {
    cursor: pointer !important;
}

.incident-name-clickable {
    cursor: pointer;
    transition: color 0.15s ease-in-out;
}

.incident-name-clickable:hover .student-name-title {
    color: #1d4ed8 !important;
    text-decoration: underline;
}

/* ============================================================ */
/* Weekly Split Two-Pane Layout (Independent Left & Right Panels) */
/* ============================================================ */
@media (min-width: 992px) {
    .weekly-left-panel {
        height: calc(100vh - 190px);
        min-height: 480px;
        overflow-y: auto;
        overflow-x: auto;
        overscroll-behavior: contain;
        padding-right: 4px;
    }

    .weekly-left-panel .table-responsive {
        overflow: visible !important;
    }

    /* Sticky table headers when scrolling down in the left matrix table */
    .weekly-left-panel .matrix-table thead th {
        position: sticky;
        top: 0;
        z-index: 10;
        background-color: #1e3a5f !important;
        color: #ffffff;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    }

    .weekly-side-panel {
        position: sticky;
        top: 16px;
        height: calc(100vh - 135px);
        min-height: 480px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        overscroll-behavior: contain;
        z-index: 100;
        width: 100%;
        margin-left: auto;
        background-color: #ffffff;
        transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                    margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                    box-shadow 0.3s ease;
    }

    /* Side Panel Grid Layout: Dar modda tek sütun */
    .side-panel-grid-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .side-panel-col-left,
    .side-panel-col-right {
        min-width: 0;
    }

    .side-panel-col-left {
        border-bottom: 1px dashed #e2e8f0;
        padding-bottom: 8px;
    }

    /* Flyout / Overlay Genişleme: Fare üzerine gelince, kilitlenince veya form içine odaklanınca */
    .weekly-side-panel:hover,
    .weekly-side-panel.is-expanded,
    .weekly-side-panel:focus-within {
        width: min(650px, 54vw);
        margin-left: calc(100% - min(650px, 54vw));
        z-index: 1050;
        box-shadow: -10px 14px 34px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(37, 99, 235, 0.3) !important;
    }

    /* Genişleyince Otomatik 2 Sütunlu Grid Düzenine Geçiş */
    .weekly-side-panel:hover .side-panel-grid-container,
    .weekly-side-panel.is-expanded .side-panel-grid-container,
    .weekly-side-panel:focus-within .side-panel-grid-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        align-items: start;
    }

    .weekly-side-panel:hover .side-panel-col-left,
    .weekly-side-panel.is-expanded .side-panel-col-left,
    .weekly-side-panel:focus-within .side-panel-col-left {
        border-bottom: none;
        padding-bottom: 0;
        border-right: 1px solid #e2e8f0;
        padding-right: 14px;
    }

    .weekly-side-panel:hover #panelExistingList,
    .weekly-side-panel.is-expanded #panelExistingList,
    .weekly-side-panel:focus-within #panelExistingList {
        max-height: 180px;
    }

    .weekly-side-panel .card-header {
        flex-shrink: 0;
        z-index: 11;
    }

    .btn-panel-toggle {
        background-color: rgba(255, 255, 255, 0.16) !important;
        color: #ffffff !important;
        border: 1px solid rgba(255, 255, 255, 0.35) !important;
        padding: 2px 8px !important;
        border-radius: 4px !important;
        font-size: 0.75rem !important;
        line-height: 1.3 !important;
        cursor: pointer;
        text-decoration: none;
        transition: background-color 0.18s ease, border-color 0.18s ease;
    }

    .btn-panel-toggle:hover {
        background-color: rgba(255, 255, 255, 0.28) !important;
        color: #ffffff !important;
        border-color: rgba(255, 255, 255, 0.6) !important;
    }

    .btn-panel-toggle:focus,
    .btn-panel-toggle:active {
        background-color: rgba(255, 255, 255, 0.35) !important;
        color: #ffffff !important;
        box-shadow: none !important;
        outline: none !important;
    }

    .btn-panel-toggle * {
        color: inherit !important;
    }

    .weekly-side-panel .card-body {
        overflow-y: auto;
        overscroll-behavior: contain;
        flex: 1 1 auto;
    }
}

@media print {
    .weekly-left-panel,
    .weekly-side-panel,
    .weekly-side-panel .card-body {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

.matrix-table td {
    padding: 8px 10px;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
    border-right: 1px solid #e9ecef;
    font-size: 0.85rem;
}

.matrix-table .day-group-header {
    background-color: #e6eef7 !important;
    font-weight: 700;
    color: #183b63;
    border-top: 2px solid #b8d2eb !important;
}

.day-badge-col {
    background-color: #f8fafc;
    font-weight: 600;
    text-align: center;
    border-left: 1px solid #e2e8f0;
}

/* Behavior Badges */
.badge-late {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.badge-dress {
    background-color: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
}

.badge-disorder {
    background-color: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #e9d5ff;
}

.badge-discipline {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Olumlu Davranış Rozetleri */
.badge-sports {
    background-color: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-cultural {
    background-color: #ccfbf1;
    color: #0f766e;
    border: 1px solid #99f6e4;
}

.badge-virtue {
    background-color: #fef9c3;
    color: #a16207;
    border: 1px solid #fef08a;
}

.empty-cell-text {
    color: #94a3b8;
    font-style: italic;
    font-size: 0.8rem;
}

/* Student search & multiselect list */
.student-selector-box {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    padding: 6px;
}

.student-selector-item {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.student-selector-item:hover {
    background-color: #f1f5f9;
}

/* Custom Teacher Autocomplete Suggestions Dropdown */
.custom-teacher-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1060;
    max-height: 250px;
    overflow-y: auto;
    background-color: #f8fbff;
    border: 2px solid #2563eb;
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.25), 0 8px 10px -6px rgba(37, 99, 235, 0.15);
}

.custom-teacher-dropdown-header {
    background: linear-gradient(135deg, #183b63, #2563eb);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 6px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-teacher-dropdown-item {
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e3a5f;
    cursor: pointer;
    border-bottom: 1px solid #e0edfd;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8fbff;
    transition: all 0.15s ease-in-out;
}

.custom-teacher-dropdown-item:last-child {
    border-bottom: none;
}

.custom-teacher-dropdown-item:hover,
.custom-teacher-dropdown-item.active {
    background-color: #2563eb !important;
    color: #ffffff !important;
    padding-left: 16px;
}

.custom-teacher-dropdown-item:hover .teacher-icon,
.custom-teacher-dropdown-item.active .teacher-icon {
    color: #ffffff !important;
}

.custom-teacher-dropdown-empty {
    padding: 12px;
    font-size: 0.82rem;
    color: #64748b;
    text-align: center;
    font-style: italic;
    background-color: #f8fbff;
}

/* Custom Action Types Autocomplete Suggestions Dropdown (Farklı Renk Paleti: Mor / Violet) */
.custom-action-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1060;
    max-height: 250px;
    overflow-y: auto;
    background-color: #faf5ff;
    border: 2px solid #7c3aed;
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.25), 0 8px 10px -6px rgba(124, 58, 237, 0.15);
}

.custom-action-dropdown-header {
    background: linear-gradient(135deg, #4c1d95, #7c3aed);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 6px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.custom-action-dropdown-item {
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #3b0764;
    cursor: pointer;
    border-bottom: 1px solid #f3e8ff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #faf5ff;
    transition: all 0.15s ease-in-out;
}

.custom-action-dropdown-item:last-child {
    border-bottom: none;
}

.custom-action-dropdown-item .action-icon {
    color: #7c3aed;
    transition: color 0.15s ease-in-out;
}

.custom-action-dropdown-item:hover,
.custom-action-dropdown-item.active {
    background-color: #7c3aed !important;
    color: #ffffff !important;
    padding-left: 16px;
}

.custom-action-dropdown-item:hover .action-icon,
.custom-action-dropdown-item.active .action-icon {
    color: #ffffff !important;
}

.custom-action-dropdown-empty {
    padding: 12px;
    font-size: 0.82rem;
    color: #7e22ce;
    text-align: center;
    font-style: italic;
    background-color: #faf5ff;
}

.action-input-highlight:focus {
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 0.25rem rgba(124, 58, 237, 0.2) !important;
}

/* Management Page Colorful Navigation Tabs */
.manage-tab-students {
    color: #1d4ed8 !important;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}
.manage-tab-students:hover {
    color: #1e40af !important;
    background-color: #eff6ff !important;
}
.manage-tab-students.active {
    color: #1d4ed8 !important;
    border-top: 3px solid #1d4ed8 !important;
    border-bottom-color: transparent !important;
    background-color: #ffffff !important;
    font-weight: 700 !important;
}

.manage-tab-teachers {
    color: #059669 !important;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}
.manage-tab-teachers:hover {
    color: #047857 !important;
    background-color: #ecfdf5 !important;
}
.manage-tab-teachers.active {
    color: #059669 !important;
    border-top: 3px solid #059669 !important;
    border-bottom-color: transparent !important;
    background-color: #ffffff !important;
    font-weight: 700 !important;
}

.manage-tab-classes {
    color: #7c3aed !important;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}
.manage-tab-classes:hover {
    color: #6d28d9 !important;
    background-color: #f5f3ff !important;
}
.manage-tab-classes.active {
    color: #7c3aed !important;
    border-top: 3px solid #7c3aed !important;
    border-bottom-color: transparent !important;
    background-color: #ffffff !important;
    font-weight: 700 !important;
}

.badge-students-active {
    background-color: #1d4ed8 !important;
    color: #ffffff !important;
}
.badge-students-inactive {
    background-color: #dbeafe !important;
    color: #1d4ed8 !important;
    border: 1px solid #bfdbfe !important;
}

.badge-teachers-active {
    background-color: #059669 !important;
    color: #ffffff !important;
}
.badge-teachers-inactive {
    background-color: #d1fae5 !important;
    color: #059669 !important;
    border: 1px solid #a7f3d0 !important;
}

.badge-classes-active {
    background-color: #7c3aed !important;
    color: #ffffff !important;
}
.badge-classes-inactive {
    background-color: #ede9fe !important;
    color: #7c3aed !important;
    border: 1px solid #ddd6fe !important;
}

.manage-tab-roles {
    color: #d97706 !important;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}
.manage-tab-roles:hover {
    color: #b45309 !important;
    background-color: #fffbeb !important;
}
.manage-tab-roles.active {
    color: #d97706 !important;
    border-top: 3px solid #d97706 !important;
    border-bottom-color: transparent !important;
    background-color: #ffffff !important;
    font-weight: 700 !important;
}

.badge-roles-active {
    background-color: #d97706 !important;
    color: #ffffff !important;
}
.badge-roles-inactive {
    background-color: #fef3c7 !important;
    color: #d97706 !important;
    border: 1px solid #fde68a !important;
}

/* Reports Page Filter Card - Distinct & Prominent Theme */
.reports-filter-card {
    border: 1px solid #bfdbfe !important;
    border-radius: 0.6rem !important;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(24, 59, 99, 0.08) !important;
}

.reports-filter-header {
    background: linear-gradient(135deg, #183b63 0%, #1e40af 100%) !important;
    color: #ffffff !important;
    border-bottom: 1px solid #1e3a8a !important;
    padding: 10px 16px !important;
}

.reports-filter-card .card-body {
    background-color: #f8fafc !important;
    border-top: none;
}

.reports-filter-card .form-label {
    color: #1e3a8a !important;
    font-weight: 600;
}

.reports-filter-card .form-control,
.reports-filter-card .form-select {
    border-color: #cbd5e1;
    background-color: #ffffff;
}

.reports-filter-card .form-control:focus,
.reports-filter-card .form-select:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.18);
}

/* Print Stylesheet */
@media print {
    .d-print-none, nav, footer, .btn, .card-header .btn {
        display: none !important;
    }
    body {
        background-color: #fff !important;
        font-size: 11pt;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
    }
    .print-card {
        border: 1px solid #000 !important;
        page-break-inside: avoid;
    }
}

/* Custom Scrollbar */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Modal Stacking Context Safeguards */
.modal {
    z-index: 1060 !important;
}
.modal-backdrop {
    z-index: 1050 !important;
}

/* Yeni Olay Girişi Butonu (Belirgin Mavi Tasarım) */
.btn-new-incident {
    background-color: #2563eb !important;
    border-color: #1d4ed8 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
    transition: all 0.15s ease-in-out;
}
.btn-new-incident:hover {
    background-color: #1d4ed8 !important;
    border-color: #1e40af !important;
    color: #ffffff !important;
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}
.btn-new-incident:active, .btn-new-incident:focus {
    background-color: #1e40af !important;
    border-color: #172554 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35) !important;
}

/* ============================================================ */
/* Left Sidebar Navigation Layout                               */
/* ============================================================ */
:root {
    --sidebar-width: 248px;
    --sidebar-collapsed-width: 70px;
}

body.has-sidebar {
    overflow-x: hidden;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #183b63 0%, #102a49 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    box-shadow: 3px 0 18px rgba(15, 23, 42, 0.14);
    transition: width 0.22s ease, transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 12px 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    min-height: 70px;
    flex-shrink: 0;
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.sidebar-logo {
    height: 44px;
    width: 44px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand-text {
    min-width: 0;
    overflow: hidden;
}

.sidebar-school-name {
    font-size: 0.86rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-collapse-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}

.sidebar-collapse-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.sidebar-meta {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(9, 24, 42, 0.35);
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.sidebar-meta-badge,
.sidebar-meta-date {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.88);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-meta-badge {
    font-weight: 600;
}

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-section-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.45);
    padding: 10px 10px 4px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-section-title:first-child {
    padding-top: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.84);
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 500;
    white-space: nowrap;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease, padding-left 0.15s ease;
}

.sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.11);
    color: #ffffff;
}

.sidebar-link.active {
    background-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #f6c23e;
}

.sidebar-link .sidebar-icon {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.78);
}

.sidebar-link.active .sidebar-icon,
.sidebar-link:hover .sidebar-icon {
    color: #f6c23e;
}

.sidebar-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user {
    padding: 10px 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(9, 24, 42, 0.42);
    flex-shrink: 0;
}

.sidebar-user-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 9px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    text-align: left;
    transition: background-color 0.15s ease;
}

.sidebar-user-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.sidebar-user-btn::after {
    margin-left: auto;
    flex-shrink: 0;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-user-info {
    min-width: 0;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* Main Content Wrapper */
.app-main-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.22s ease;
}

body.has-sidebar .app-main-wrapper {
    margin-left: var(--sidebar-width);
}

/* Desktop Collapsed State */
@media (min-width: 992px) {
    body.has-sidebar.sidebar-collapsed .app-sidebar {
        width: var(--sidebar-collapsed-width);
    }

    body.has-sidebar.sidebar-collapsed .app-main-wrapper {
        margin-left: var(--sidebar-collapsed-width);
    }

    body.has-sidebar.sidebar-collapsed .sidebar-brand {
        justify-content: center;
        padding: 12px 6px;
        flex-direction: column;
        gap: 6px;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-brand-link {
        justify-content: center;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-brand-text,
    body.has-sidebar.sidebar-collapsed .sidebar-meta,
    body.has-sidebar.sidebar-collapsed .sidebar-section-title,
    body.has-sidebar.sidebar-collapsed .sidebar-label,
    body.has-sidebar.sidebar-collapsed .sidebar-user-info,
    body.has-sidebar.sidebar-collapsed .sidebar-user-btn::after {
        display: none !important;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-link {
        justify-content: center;
        padding: 10px;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-user-btn {
        justify-content: center;
        padding: 6px;
    }

    body.has-sidebar.sidebar-collapsed .sidebar-user .dropdown-menu {
        min-width: 220px;
        left: 60px !important;
    }
}

/* Mobile Header & Offcanvas Drawer (< 992px) */
.app-mobile-header {
    background-color: var(--primary-navy);
    color: #ffffff;
    padding: 8px 14px;
    min-height: 52px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
    z-index: 1030;
}

.mobile-menu-btn {
    min-width: 40px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.mobile-menu-btn:active {
    background-color: rgba(255, 255, 255, 0.16);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1035;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

@media (max-width: 991.98px) {
    body.has-sidebar .app-main-wrapper {
        margin-left: 0;
        min-height: calc(100vh - 52px);
    }

    .app-sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-mobile-open .app-sidebar {
        transform: translateX(0);
    }

    body.sidebar-mobile-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-link {
        min-height: 44px;
        padding: 10px 14px;
        font-size: 0.92rem;
    }

    .sidebar-collapse-btn {
        width: 36px;
        height: 36px;
    }

    /* iOS Safari otomatik yakınlaştırmayı önle (16px minimum font-size) */
    input.form-control,
    select.form-select,
    textarea.form-control,
    .input-group-sm > .form-control,
    .input-group-sm > .form-select {
        font-size: 16px !important;
    }

    /* Mobilde form sonundaki Yapılan İşlem öneri kutusunu klavyenin üstünde (yukarı doğru) aç */
    .custom-action-dropdown {
        top: auto;
        bottom: calc(100% + 6px);
        margin-top: 0;
        max-height: 210px;
    }

    .custom-teacher-dropdown {
        max-height: 200px;
    }

    .custom-action-dropdown-item,
    .custom-teacher-dropdown-item {
        padding: 10px 12px;
        min-height: 42px;
        font-size: 0.9rem;
    }
}

@media (max-width: 767.98px) {
    /* Sekmelerin dar ekranda alt alta kırılması yerine yatay kaydırılması */
    .card-header-tabs,
    .mobile-nav-scroll {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .card-header-tabs::-webkit-scrollbar,
    .mobile-nav-scroll::-webkit-scrollbar {
        display: none;
    }

    .card-header-tabs .nav-link,
    .mobile-nav-scroll .nav-link {
        white-space: nowrap;
        padding: 0.55rem 0.8rem;
    }
}

/* Print override for Sidebar Layout */
@media print {
    .app-sidebar,
    .app-mobile-header,
    .sidebar-backdrop,
    .pwa-install-banner {
        display: none !important;
    }

    body.has-sidebar .app-main-wrapper {
        margin-left: 0 !important;
    }
}

/* ============================================================ */
/* PWA Install Banner & iOS/Android Safe Area Support           */
/* ============================================================ */
@supports (padding: env(safe-area-inset-bottom)) {
    .app-mobile-header {
        padding-top: calc(8px + env(safe-area-inset-top));
        padding-left: calc(14px + env(safe-area-inset-left));
        padding-right: calc(14px + env(safe-area-inset-right));
    }

    .sidebar-user {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }

    html.pwa-standalone footer {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom)) !important;
    }
}

html.pwa-standalone body {
    overscroll-behavior-y: contain;
}

.pwa-install-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 1038;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.pwa-install-banner-inner {
    pointer-events: auto;
    width: 100%;
    max-width: 460px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.pwa-install-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(24, 59, 99, 0.25);
}

.pwa-install-text {
    min-width: 0;
    flex: 1 1 auto;
}

/* PWA alt bandı açıkken sayfa sonundaki butonların örtülmesini engelle */
body.has-pwa-banner main.pb-5 {
    padding-bottom: 6rem !important;
}

body.has-pwa-banner footer {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important;
}



