/* ===========================
   TODO App - Custom Styles
   (Bootstrap 5 üzerine)
   =========================== */

:root {
    --app-primary: #4f46e5;
    --app-primary-hover: #4338ca;
    --app-bg: #f8f9fc;
    --app-sidebar-bg: #ffffff;
    --app-sidebar-width: 280px;
    --app-border: #e9ecef;
    --app-text-muted: #6c757d;
    --app-card-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

body {
    background: var(--app-bg);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-width: 320px;
}

/* ---- Navbar ---- */
.app-navbar {
    background: #ffffff !important;
    border-bottom: 1px solid var(--app-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 0.5rem 1rem;
}

.app-navbar .navbar-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--app-primary) !important;
    letter-spacing: -0.3px;
}

.app-navbar .navbar-toggler {
    color: #495057;
    padding: 0.4rem;
}

.app-navbar .navbar-toggler:focus {
    box-shadow: none;
}

.app-navbar .nav-link {
    color: #495057 !important;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem !important;
    border-radius: 6px;
    transition: background 0.15s;
    white-space: nowrap;
}

.app-navbar .nav-link:hover {
    background: #f1f0ff;
    color: var(--app-primary) !important;
}

.app-navbar .nav-link.active {
    background: #ede9fe;
    color: var(--app-primary) !important;
}

.app-navbar .navbar-user {
    font-size: 0.8rem;
    color: var(--app-text-muted);
}

/* Dropdown inside navbar */
.app-navbar .dropdown-toggle::after {
    font-size: 0.65rem;
    vertical-align: 0.15em;
}

.app-navbar .dropdown-menu {
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .1);
    border: 1px solid var(--app-border);
    padding: 0.35rem;
    min-width: 220px;
}

.app-navbar .dropdown-item {
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
    border-radius: 6px;
}

.app-navbar .dropdown-item:hover {
    background: #f1f0ff;
    color: var(--app-primary);
}

.app-navbar .dropdown-item.active {
    background: #ede9fe;
    color: var(--app-primary);
}

/* Offcanvas mobile styling */
.offcanvas-xl .offcanvas-header {
    padding: 1rem 1.25rem;
}

.offcanvas-xl .offcanvas-body .nav-link {
    padding: 0.6rem 0.75rem !important;
    font-size: 0.95rem;
}

/* Remove mobile border-top when on desktop */
@media (max-width: 1199.98px) {
    .navbar-user-section {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--app-border);
        flex-shrink: 0;
    }

    #navOffcanvas .offcanvas-body {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #navOffcanvas .sidebar-nav-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }
}

@media (min-width: 1200px) {
    body {
        padding-left: var(--app-sidebar-width);
    }

    .app-navbar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--app-sidebar-width);
        z-index: 1030;
        border-right: 1px solid var(--app-border);
        border-bottom: 0;
        box-shadow: 2px 0 14px rgba(0, 0, 0, 0.06);
        padding: 0.75rem;
    }

    .app-navbar .container-fluid {
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        padding: 0 !important;
        gap: 0.75rem;
        min-height: 0;
        overflow: hidden;
    }

    .app-navbar .navbar-brand {
        margin-right: 0;
        padding: 0.35rem 0.5rem;
    }

    .app-navbar .navbar-toggler {
        display: none;
    }

    .app-navbar .offcanvas-xl {
        position: static;
        visibility: visible !important;
        transform: none !important;
        background: transparent;
        border: 0;
        width: 100%;
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .app-navbar .offcanvas-header {
        display: none;
    }

    .app-navbar .offcanvas-body {
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
    }

    .app-navbar .sidebar-nav-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .app-navbar .navbar-nav {
        margin-right: 0 !important;
        width: 100%;
        flex-direction: column !important;
        gap: 0.3rem !important;
    }

    .app-navbar .nav-link {
        display: flex;
        align-items: center;
        gap: 0.55rem;
        padding: 0.55rem 0.7rem !important;
        white-space: normal;
    }

    .app-navbar .nav-link .bi {
        display: inline-flex;
        width: 1rem;
        justify-content: center;
    }

    .app-navbar .nav-link .d-xl-none {
        display: inline-flex !important;
    }

    .app-navbar .dropdown-menu {
        position: static;
        transform: none !important;
        width: 100%;
        min-width: 0;
        margin-top: 0.3rem;
        box-shadow: none;
    }

    .app-navbar .sidebar-tools-toggle {
        display: flex;
        align-items: center;
        gap: 0.55rem;
    }

    .app-navbar .sidebar-tools-chevron {
        margin-left: auto;
        font-size: 0.75rem;
        transition: transform 0.2s ease;
    }

    .app-navbar .sidebar-tools-toggle:not(.collapsed) .sidebar-tools-chevron {
        transform: rotate(180deg);
    }

    .app-navbar .sidebar-tools-list {
        gap: 0.15rem;
        margin: 0.15rem 0 0.35rem;
        padding-left: 0.35rem;
    }

    .app-navbar .sidebar-tools-link {
        padding: 0.45rem 0.7rem 0.45rem 1.85rem !important;
        font-size: 0.88rem;
    }

    .app-navbar .navbar-user-section {
        flex-shrink: 0;
        margin-top: 0;
        padding-top: 0.85rem;
        border-top: 1px solid var(--app-border);
        display: flex;
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .app-navbar .navbar-user {
        display: block;
        padding: 0.1rem 0.25rem;
    }

    .app-navbar .navbar-user-section .btn {
        justify-content: center;
    }

    .app-navbar .navbar-user-section .theme-toggle-btn {
        width: 100%;
    }

    .page-wrapper {
        max-width: none;
        margin: 0;
        padding: 1.5rem 2rem;
    }
}

/* Update badge on dropdown toggle */
.app-navbar .nav-link-update-badge::after {
    top: 6px;
    right: 14px;
}

.dropdown-item-update {
    position: relative;
}

/* ---- Tema toggle butonu ---- */
.theme-toggle-btn {
    padding: 0.35rem 0.6rem !important;
}

.theme-icon-dark {
    display: none;
}

.theme-icon-light {
    display: inline-block;
}

[data-bs-theme="dark"] .theme-icon-light {
    display: none;
}

[data-bs-theme="dark"] .theme-icon-dark {
    display: inline-block;
}

.login-theme-toggle {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

/* ---- Page wrapper ---- */
.page-wrapper {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* ---- Cards ---- */
.card {
    border: 1px solid var(--app-border);
    border-radius: 10px;
    box-shadow: var(--app-card-shadow);
}

.card-header {
    background: #ffffff;
    border-bottom: 1px solid var(--app-border);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.85rem 1.25rem;
    border-radius: 10px 10px 0 0 !important;
}

.card-body {
    padding: 1.25rem;
}

/* ---- Buttons ---- */
.btn-primary {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

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

.btn-outline-primary {
    color: var(--app-primary);
    border-color: var(--app-primary);
}

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

/* ---- Tables ---- */
.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-text-muted);
    background: #f8f9fc;
    border-bottom: 1px solid var(--app-border);
}

.table td {
    vertical-align: middle;
    font-size: 0.875rem;
}

.table-hover tbody tr:hover {
    background: #f5f4ff;
}

.trigger-list-item {
    padding: 0;
}

.trigger-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border: 0;
    background: transparent;
    text-align: left;
}

.trigger-toggle:hover {
    background: #f8fafc;
}

.trigger-toggle-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.trigger-toggle-icon {
    color: #64748b;
    transition: transform 0.2s ease;
}

.trigger-toggle[aria-expanded="true"] .trigger-toggle-icon {
    transform: rotate(180deg);
}

.trigger-collapse-body {
    padding: 0 1.25rem 1.1rem;
    border-top: 1px solid #e5e7eb;
}

.trigger-url,
.trigger-url-table {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78rem;
    color: #475569;
    word-break: break-all;
}

.trigger-url {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.7rem 0.85rem;
}

.trigger-url-table {
    max-width: 420px;
}

/* ---- Stat Cards ---- */
.stat-card {
    background: #ffffff;
    border: 1px solid var(--app-border);
    border-radius: 10px;
    padding: 1.25rem 1.5rem;
    box-shadow: var(--app-card-shadow);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--app-text-muted);
    margin-top: 0.25rem;
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

/* ---- Badges (Priority & Status) ---- */
.badge-priority-low {
    background: #d1fae5;
    color: #065f46;
    font-weight: 600;
}

.badge-priority-medium {
    background: #fef9c3;
    color: #854d0e;
    font-weight: 600;
}

.badge-priority-high {
    background: #fed7aa;
    color: #9a3412;
    font-weight: 600;
}

.badge-priority-critical {
    background: #fecaca;
    color: #991b1b;
    font-weight: 600;
}

.badge-status-open {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 600;
}

.badge-status-in_progress {
    background: #fef9c3;
    color: #854d0e;
    font-weight: 600;
}

.badge-status-done {
    background: #d1fae5;
    color: #065f46;
    font-weight: 600;
}

.badge-status-cancelled {
    background: #e5e7eb;
    color: #374151;
    font-weight: 600;
}

.badge-status-on_hold {
    background: #e0e7ff;
    color: #3730a3;
    font-weight: 600;
}

.badge-status-rejected {
    background: #fecaca;
    color: #991b1b;
    font-weight: 600;
}

.badge-escalated {
    background: #fef9c3;
    color: #854d0e;
    font-weight: 600;
}

/* backward compat */
.badge-low {
    background: #d1fae5;
    color: #065f46;
}

.badge-medium {
    background: #fef9c3;
    color: #854d0e;
}

.badge-high {
    background: #fed7aa;
    color: #9a3412;
}

.badge-critical {
    background: #fecaca;
    color: #991b1b;
}

.badge-open {
    background: #dbeafe;
    color: #1e40af;
}

.badge-in_progress {
    background: #fef9c3;
    color: #854d0e;
}

.badge-done {
    background: #d1fae5;
    color: #065f46;
}

.badge-cancelled {
    background: #e5e7eb;
    color: #374151;
}

.badge-on_hold {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-rejected {
    background: #fecaca;
    color: #991b1b;
}

/* ---- Task title link ---- */
.todo-title-link {
    color: #212529;
    font-weight: 500;
    text-decoration: none;
}

.todo-title-link:hover {
    color: var(--app-primary);
    text-decoration: underline;
}

/* ---- History timeline ---- */
.history-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--app-border);
    font-size: 0.85rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item.history-created {
    border-left: 3px solid #10b981;
    padding-left: 0.75rem;
}

.history-item.history-updated {
    border-left: 3px solid #6366f1;
    padding-left: 0.75rem;
}

.history-item.history-assigned {
    border-left: 3px solid #3b82f6;
    padding-left: 0.75rem;
}

.history-item.history-status_change {
    border-left: 3px solid #f59e0b;
    padding-left: 0.75rem;
}

.history-item.history-escalated {
    border-left: 3px solid #ef4444;
    padding-left: 0.75rem;
}

.history-item.history-monitor_read {
    border-left: 3px solid #22c55e;
    padding-left: 0.75rem;
}

.history-time {
    white-space: nowrap;
    color: var(--app-text-muted);
    font-size: 0.75rem;
    min-width: 110px;
}

/* ---- Comment items ---- */
.comment-item {
    background: #f8f9fc;
    border-left: 3px solid var(--app-primary);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.comment-item .comment-author {
    font-weight: 600;
    font-size: 0.875rem;
}

.comment-item .comment-time {
    font-size: 0.75rem;
    color: var(--app-text-muted);
}

/* ---- Login page ---- */
body.login-bg {
    padding-left: 0 !important;
}

.login-bg {
    min-height: 100dvh;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0f0ff 0%, #e8f4fd 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    overflow-x: hidden;
}

.login-card {
    width: min(100%, 400px);
    margin: 0 auto;
    border: none;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(79, 70, 229, 0.12);
}

.login-card .login-header {
    text-align: center;
    padding: 2rem 2rem 1rem;
}

.login-card .login-logo {
    width: 52px;
    height: 52px;
    background: var(--app-primary);
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: white;
}

/* ---- Monitor (TV) page ---- */
.monitor-page {
    background: #0f0f1a;
    color: #e8e8f0;
    min-height: 100vh;
    padding: 1.5rem;
    font-family: 'Inter', system-ui, sans-serif;
}

.monitor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #2a2a3e;
}

.monitor-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #a5b4fc;
}

.monitor-time {
    font-size: 0.8rem;
    color: #6b7280;
}

.monitor-table {
    width: 100%;
    border-collapse: collapse;
}

.monitor-table th {
    background: #1a1a2e;
    color: #a5b4fc;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.6rem 1rem;
}

.monitor-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #1e1e30;
    font-size: 0.875rem;
}

.monitor-table tr:hover td {
    background: #1a1a2e;
}

/* ---- View tabs ---- */
.view-tabs {
    display: flex;
    gap: 0.25rem;
}

.view-tab {
    padding: 0.35rem 0.85rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    color: #495057;
    background: #f1f3f5;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.view-tab:hover {
    background: #e9e8ff;
    color: var(--app-primary);
}

.view-tab.active {
    background: var(--app-primary);
    color: #fff;
    border-color: var(--app-primary);
}

/* ---- Page header ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #212529;
    margin: 0;
}

.page-header.page-header-stack {
    flex-direction: column;
    align-items: stretch;
}

.page-header-actions,
.page-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.page-toolbar-btn,
.page-header-actions .btn,
.page-toolbar .btn {
    flex: 0 0 auto;
    width: auto;
    max-width: 100%;
}

.crud-split-layout > [class*="col-"] {
    min-width: 0;
}

.stat-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
    gap: 0.75rem;
}

.stat-summary-card {
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: #fff;
    padding: 1rem;
    min-width: 0;
}

.stat-summary-card .stat-value {
    font-size: clamp(1.35rem, 4vw, 1.9rem);
    font-weight: 700;
    line-height: 1.1;
}

.stat-summary-card .stat-label {
    font-size: 0.82rem;
    color: var(--app-text-muted);
}

.today-schedule-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.today-schedule-item {
    border: 1px solid var(--app-border);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    background: #fcfcff;
}

.today-schedule-item.type-class {
    border-left: 3px solid #0d6efd;
}

.today-schedule-item.type-practice {
    border-left: 3px solid #198754;
}

.today-schedule-item.type-private_lesson {
    border-left: 3px solid #fd7e14;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-commit-input {
    width: 140px;
}

.user-role-select {
    max-width: 180px;
}

.user-password-input {
    max-width: 160px;
}

@media (max-width: 991.98px) {
    .page-wrapper {
        padding: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .page-header > div:last-child {
        margin-left: 0;
        width: 100%;
    }

    .page-header > div:last-child .btn,
    .page-header > div:last-child .btn-group {
        width: 100%;
    }

    .page-header.page-header-stack > .page-header-actions,
    .page-header.page-header-stack > .page-toolbar,
    .page-header.page-header-stack > a.btn {
        width: auto;
    }

    .page-header.page-header-stack > .page-header-actions .btn,
    .page-header.page-header-stack > .page-toolbar .btn,
    .page-header.page-header-stack > a.btn {
        width: auto !important;
    }

    .page-header-tasks > div:last-child .btn {
        width: auto !important;
    }

    .page-header-tasks > div:last-child {
        width: auto;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .view-tabs {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.2rem;
    }

    .view-tab {
        flex: 0 0 auto;
    }

    #filterForm > [class*="col-"],
    #logFilterForm > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    #filterForm .input-group,
    #logFilterForm .input-group,
    #filterForm .form-control,
    #filterForm .form-select,
    #logFilterForm .form-control,
    #logFilterForm .form-select {
        width: 100% !important;
    }

    .filter-commit-input {
        width: 100% !important;
    }

    .table-responsive > .table.table-tasks-wide {
        min-width: 760px;
    }

    .table-responsive > .table.table-tasks-wide.table-sm {
        min-width: 680px;
    }

    .table td form.d-flex,
    .table td .d-flex.gap-1 {
        flex-wrap: wrap;
    }

    .table td form.d-flex .form-control,
    .table td form.d-flex .form-select {
        flex: 1 1 140px;
        min-width: 130px;
    }

    .assign-select,
    .status-select {
        max-width: 100%;
        width: 100%;
    }

    .user-role-select,
    .user-password-input {
        max-width: 100%;
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .page-wrapper {
        padding: 0.75rem;
    }

    .page-title {
        font-size: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.6rem;
    }
}

/* ---- Form tweaks ---- */
.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.3rem;
}

.form-control,
.form-select {
    font-size: 0.875rem;
    border-color: var(--app-border);
    border-radius: 7px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.12);
}

/* ---- Task detail DL ---- */
.task-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.task-meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    overflow: hidden;
}

.task-meta-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-text-muted);
}

.task-meta-value {
    font-size: 0.875rem;
    color: #212529;
    font-weight: 500;
}

/* ---- Score badge ---- */
.score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--app-primary);
    color: white;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ---- Tag pills ---- */
.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.15em 0.55em;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
    border: 1px solid transparent;
}

.tag-check-label .tag-pill {
    cursor: pointer;
    transition: opacity 0.15s;
}

.tag-check-label:hover .tag-pill {
    opacity: 0.85;
}

/* ---- Overdue rows ---- */
tr.row-overdue>td {
    background: #fff5f5 !important;
}

tr.row-overdue .overdue-date {
    color: #dc2626;
    font-weight: 600;
}

tr.row-overdue .overdue-icon {
    font-size: 0.75rem;
    color: #dc2626;
}

/* ---- Sortable column headers ---- */
.sort-th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sort-th:hover {
    color: var(--app-primary);
}

.sort-th .sort-icon {
    font-size: 0.65rem;
    margin-left: 3px;
    opacity: 0.4;
}

.sort-th.sort-active .sort-icon {
    opacity: 1;
    color: var(--app-primary);
}

/* ---- Inline status select ---- */
.status-select {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    border-radius: 5px;
    border: 1px solid var(--app-border);
    background: white;
    cursor: pointer;
    max-width: 130px;
}

.status-select:focus {
    outline: none;
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}

.assign-select {
    max-width: 140px;
    min-width: 100px;
}

/* ---- Monitor: critical alert overlay ---- */
.critical-alert {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #dc2626;
    color: white;
    text-align: center;
    padding: 0.6rem 1rem;
    font-weight: 700;
    font-size: 1rem;
    z-index: 9999;
    animation: criticalPulse 1s ease-in-out infinite alternate;
}

@keyframes criticalPulse {
    from {
        background: #dc2626;
    }

    to {
        background: #7f1d1d;
    }
}

/* ---- VS Code Eklentisi güncelleme animasyonu ---- */
.nav-link-update-badge {
    position: relative;
}

.nav-link-update-badge::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    background: #f59e0b;
    border-radius: 50%;
    animation: updatePulse 1.4s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6);
}

@keyframes updatePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }

    60% {
        box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

/* ---- Pagination ---- */
.pagination .page-link {
    font-size: 0.82rem;
    padding: 0.3rem 0.65rem;
    color: var(--app-primary);
    border-color: var(--app-border);
}

.pagination .page-item.active .page-link {
    background-color: var(--app-primary);
    border-color: var(--app-primary);
}

.pagination .page-link:hover {
    background: #ede9fe;
    color: var(--app-primary);
    border-color: var(--app-border);
}

.pagination .page-item.disabled .page-link {
    color: #adb5bd;
}

/* ===========================
   Dark Mode Overrides
   =========================== */
[data-bs-theme="dark"] {
    --app-bg: #1e1e2e;
    --app-sidebar-bg: #252536;
    --app-border: #3f3f5a;
    --app-text-muted: #94a3b8;
    --app-card-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .app-navbar {
    background: #1e1e2e !important;
    border-bottom-color: #3f3f5a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .app-navbar .navbar-toggler {
    color: #94a3b8;
}

[data-bs-theme="dark"] .app-navbar .nav-link:hover {
    background: #2a2a3e;
}

[data-bs-theme="dark"] .app-navbar .nav-link.active {
    background: #3f3f5a;
}

[data-bs-theme="dark"] .app-navbar .dropdown-menu {
    background-color: #252536;
    border-color: #3f3f5a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .3);
}

[data-bs-theme="dark"] .app-navbar .dropdown-item {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .app-navbar .dropdown-item:hover {
    background: #2a2a3e;
    color: #a5b4fc;
}

[data-bs-theme="dark"] .app-navbar .dropdown-item.active {
    background: #3f3f5a;
    color: #a5b4fc;
}

[data-bs-theme="dark"] .offcanvas-xl {
    background-color: #1e1e2e;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .offcanvas-xl .offcanvas-header {
    border-bottom-color: #3f3f5a;
}

[data-bs-theme="dark"] .offcanvas-xl .btn-close {
    filter: invert(1);
}

[data-bs-theme="dark"] .stat-card {
    background: #252536;
    border-color: #3f3f5a;
}

[data-bs-theme="dark"] .stat-card .stat-value {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .card-header {
    background: #252536;
    border-bottom-color: #3f3f5a;
}

[data-bs-theme="dark"] .table th {
    background: #1a1a2e;
    color: #94a3b8;
    border-bottom-color: #3f3f5a;
}

[data-bs-theme="dark"] .table-hover tbody tr:hover {
    background: #2a2a3e;
}

[data-bs-theme="dark"] .trigger-url {
    background: #0f172a;
    border-color: #334155;
}

[data-bs-theme="dark"] .trigger-toggle:hover {
    background: #1f2937;
}

[data-bs-theme="dark"] .trigger-toggle-title {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .trigger-collapse-body {
    border-top-color: #334155;
}

[data-bs-theme="dark"] .trigger-url,
[data-bs-theme="dark"] .trigger-url-table {
    color: #cbd5e1;
}

[data-bs-theme="dark"] .login-bg {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f172a 100%);
}

[data-bs-theme="dark"] .login-card {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .todo-title-link {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .todo-title-link:hover {
    color: #a5b4fc;
}

[data-bs-theme="dark"] .view-tab {
    color: #94a3b8;
    background: #2a2a3e;
}

[data-bs-theme="dark"] .view-tab:hover {
    background: #3f3f5a;
    color: #a5b4fc;
}

[data-bs-theme="dark"] .page-title {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-label {
    color: #94a3b8;
}

[data-bs-theme="dark"] .task-meta-value {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .status-select {
    background: #252536;
    border-color: #3f3f5a;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .comment-item {
    background: #252536;
    border-left-color: #6366f1;
}

[data-bs-theme="dark"] tr.row-overdue>td {
    background: #3f1f1f !important;
}

[data-bs-theme="dark"] .breadcrumb-item a,
[data-bs-theme="dark"] .breadcrumb-item.active {
    color: #94a3b8;
}

[data-bs-theme="dark"] .breadcrumb-item a:hover {
    color: #a5b4fc;
}

/* stats.php inline styles override */
[data-bs-theme="dark"] .user-card {
    color: inherit;
}

[data-bs-theme="dark"] .user-card .stat-mini .n {
    color: inherit;
}

[data-bs-theme="dark"] .user-card:hover {
    color: inherit;
}

[data-bs-theme="dark"] .text-dark {
    color: #e2e8f0 !important;
}

[data-bs-theme="dark"] .card {
    background-color: #252536;
    border-color: #3f3f5a;
}

/* Dark mode - genel yazı renkleri */
[data-bs-theme="dark"] body {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .table td {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .stat-card .stat-label {
    color: #94a3b8;
}

[data-bs-theme="dark"] .card-body,
[data-bs-theme="dark"] .card-header {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .comment-item .comment-author {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .comment-item .comment-time {
    color: #94a3b8;
}

[data-bs-theme="dark"] .history-time {
    color: #94a3b8;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #252536;
    border-color: #3f3f5a;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #64748b;
}

[data-bs-theme="dark"] .app-navbar .nav-link {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] .app-navbar .nav-link.active {
    color: #a5b4fc !important;
}

[data-bs-theme="dark"] .app-navbar .nav-link:hover {
    color: #a5b4fc !important;
}

[data-bs-theme="dark"] .app-navbar .navbar-user {
    color: #94a3b8;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    color: #94a3b8;
    border-color: #3f3f5a;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #3f3f5a;
    border-color: #3f3f5a;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .theme-toggle-btn {
    color: #94a3b8;
    border-color: #3f3f5a;
}

[data-bs-theme="dark"] .theme-toggle-btn:hover {
    background-color: #3f3f5a;
    color: #e2e8f0;
    border-color: #3f3f5a;
}

[data-bs-theme="dark"] .sort-th {
    color: #94a3b8;
}

[data-bs-theme="dark"] .sort-th:hover,
[data-bs-theme="dark"] .sort-th.sort-active {
    color: #a5b4fc;
}

[data-bs-theme="dark"] .pagination .page-link {
    color: #a5b4fc;
    background-color: transparent;
    border-color: #3f3f5a;
}

[data-bs-theme="dark"] .pagination .page-link:hover {
    background-color: #3f3f5a;
    color: #a5b4fc;
    border-color: #3f3f5a;
}

[data-bs-theme="dark"] .pagination .page-item.disabled .page-link {
    color: #64748b;
    border-color: #3f3f5a;
}

[data-bs-theme="dark"] .pagination .page-item.active .page-link {
    background-color: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

[data-bs-theme="dark"] .task-meta-label {
    color: #94a3b8;
}

[data-bs-theme="dark"] .login-card .login-header h1,
[data-bs-theme="dark"] .login-card .login-header .h5 {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .login-card .text-muted {
    color: #94a3b8 !important;
}

[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.todo-title-link):not(.view-tab) {
    color: #a5b4fc;
}

[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.todo-title-link):not(.view-tab):hover {
    color: #c7d2fe;
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #252536;
    border-color: #3f3f5a;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #3f3f5a;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .dropdown-divider {
    border-color: #3f3f5a;
}

/* ---- Lecturer list (class form) ---- */
.lecturer-list {
    max-height: 9.5rem;
    overflow-y: auto;
    background: #fff;
}

.lecturer-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.4rem 0.65rem;
    min-height: 2.25rem;
    cursor: pointer;
    border-bottom: 1px solid var(--app-border);
    font-size: 0.875rem;
    line-height: 1.3;
}

.lecturer-list-item:last-child {
    border-bottom: 0;
}

.lecturer-list-item:hover {
    background: #f8f9fc;
}

.lecturer-list-check {
    flex-shrink: 0;
    margin: 0;
    width: 1rem;
    height: 1rem;
}

.lecturer-list-text {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
    min-width: 0;
}

.lecturer-list-name {
    font-weight: 500;
}

[data-bs-theme="dark"] .lecturer-list {
    background: #252536;
}

[data-bs-theme="dark"] .lecturer-list-item:hover {
    background: #2f2f42;
}

/* ---- Cafe sale (POS) ---- */
.cafe-sale-pos {
    padding-bottom: 5.5rem;
}

.cafe-sale-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-text-muted);
    margin-bottom: 0.75rem;
}

.cafe-sale-student-select {
    font-size: 1rem;
}

.cafe-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
    gap: 0.65rem;
}

@media (min-width: 576px) {
    .cafe-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
        gap: 0.75rem;
    }
}

.cafe-product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 5.75rem;
    padding: 0.65rem 0.4rem;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: #fff;
    color: inherit;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.cafe-product-card:active {
    transform: scale(0.97);
}

.cafe-product-card.is-active {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
    background: #f8f7ff;
}

.cafe-product-card-badge {
    position: absolute;
    top: 0.35rem;
    right: 0.35rem;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--app-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1.35rem;
    text-align: center;
}

.cafe-product-icon {
    font-size: 1.35rem;
    color: var(--app-primary);
    line-height: 1;
}

.cafe-product-name {
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    word-break: break-word;
}

.cafe-product-price {
    font-size: 0.7rem;
    color: var(--app-text-muted);
}

.cafe-cart {
    border: 1px solid var(--app-border);
    border-radius: 12px;
    overflow: hidden;
}

.cafe-cart-empty {
    padding: 1.25rem 1rem;
    text-align: center;
}

.cafe-cart-list {
    display: flex;
    flex-direction: column;
}

.cafe-cart-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--app-border);
}

.cafe-cart-item:last-child {
    border-bottom: 0;
}

.cafe-cart-item-main {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem;
}

.cafe-cart-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.cafe-cart-item-qty-label {
    font-size: 0.85rem;
    color: var(--app-text-muted);
}

.cafe-cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.cafe-qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid var(--app-border);
    border-radius: 8px;
    background: #fff;
    color: inherit;
    cursor: pointer;
    touch-action: manipulation;
}

.cafe-qty-btn:active {
    background: #f1f3f5;
}

.cafe-cart-qty {
    min-width: 1.25rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.cafe-cart-item-total {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.cafe-sale-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1020;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0));
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--app-border);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(8px);
}

@media (min-width: 1200px) {
    .cafe-sale-bar {
        left: var(--app-sidebar-width);
    }
}

.cafe-sale-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 720px;
    margin: 0 auto;
}

.cafe-sale-bar-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-text-muted);
}

.cafe-sale-bar-total strong {
    font-size: 1.25rem;
    color: var(--app-primary);
}

.cafe-sale-submit {
    flex-shrink: 0;
    white-space: nowrap;
}

@media (max-width: 575.98px) {
    .cafe-sale-bar-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .cafe-sale-bar-total {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
    }

    .cafe-sale-submit {
        width: 100%;
    }
}

[data-bs-theme="dark"] .cafe-product-card {
    background: #252536;
}

[data-bs-theme="dark"] .cafe-product-card.is-active {
    background: #2a2844;
}

[data-bs-theme="dark"] .cafe-qty-btn {
    background: #252536;
}

[data-bs-theme="dark"] .cafe-sale-bar {
    background: rgba(30, 30, 46, 0.96);
}

/* Scrollable modals (mobile-friendly) */
.app-scroll-modal {
    max-height: calc(100vh - 1rem);
    margin: 0.5rem auto;
}

.app-scroll-modal .modal-content {
    max-height: calc(100vh - 1rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-scroll-modal .modal-content form {
    display: flex;
    flex-direction: column;
    max-height: inherit;
    overflow: hidden;
}

.app-scroll-modal .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
}

.lesson-modal-dialog {
    max-height: calc(100vh - 1rem);
    margin: 0.5rem auto;
}

.lesson-modal-dialog .modal-content {
    max-height: calc(100vh - 1rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lesson-modal-dialog .modal-content form {
    display: flex;
    flex-direction: column;
    max-height: inherit;
    overflow: hidden;
}

.lesson-modal-dialog .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
}

.badge {
    white-space: normal;
    text-align: center;
    line-height: 1.25;
}

.private-lesson-card .form-control {
    max-width: 100%;
}

.private-lesson-mobile-list .btn {
    min-height: 2.5rem;
}

@media (max-width: 575.98px) {
    .page-header-actions {
        width: 100%;
    }

    .page-header-actions .btn,
    .page-header-actions .btn-group {
        width: 100%;
    }

    .student-class-item-actions .btn {
        flex: 1 1 calc(50% - 0.25rem);
    }

    .modal .table {
        font-size: 0.82rem;
    }

    .modal .badge {
        font-size: 0.72rem;
    }
}