:root {
    --primary-color: #3f4650;
    --primary-hover: #2f343b;
    --primary-soft: #eef0f3;
    --surface-color: #ffffff;
    --surface-muted: #f6f7f9;
    --surface-subtle: #eef0f3;
    --border-color: #d8dde3;
    --text-strong: #1f2328;
    --text-muted: #6c737d;
    --navbar-start: #f8f9fb;
    --navbar-mid: #e8ebef;
    --navbar-end: #d9dde3;
    --navbar-height: 56px;
    --footer-height: 26px;
    --sidebar-width: 260px;
    --sidebar-nav-bg: #ffffff;
    --sidebar-bottom-mid: #f6f7f9;
    --sidebar-bottom-end: #eef0f3;
    --sidebar-active-bg: #eef0f3;
    --sidebar-active-text: #1f2328;
    --sidebar-text: #3f4650;
    --bg-secondary: #f4f5f7;
    --card-shadow: 0 0.5rem 1.5rem rgba(31, 35, 40, 0.08);
}

body {
    font-size: 0.875rem;
    padding-top: var(--navbar-height);
    padding-bottom: var(--footer-height);
    background-color: var(--bg-secondary);
    color: var(--text-strong);
    overflow-x: hidden;
}

.navbar {
    min-height: var(--navbar-height);
    height: var(--navbar-height);
    overflow: visible;
    background: linear-gradient(90deg, var(--navbar-start) 0%, var(--navbar-mid) 55%, var(--navbar-end) 100%) !important;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 0.25rem 1rem rgba(31, 35, 40, 0.06);
    z-index: 1100;
}

.navbar .container-fluid {
    min-height: var(--navbar-height);
    height: var(--navbar-height);
    align-items: center;
}

.navbar-dark .navbar-brand {
    color: var(--text-strong);
}

.navbar-dark .navbar-brand:hover,
.navbar-dark .navbar-brand:focus {
    color: var(--primary-hover);
}

.navbar .navbar-brand {
    min-width: var(--sidebar-width);
    height: var(--navbar-height);
    position: relative;
    padding: 0;
    z-index: 2;
}

.brand-logo-swap {
    position: relative;
    display: inline-block;
    width: var(--logo-width, 112px);
    height: var(--logo-height, 34px);
    flex: 0 0 auto;
}

.navbar .brand-logo-swap {
    position: absolute;
    left: 0.75rem;
    top: 0.5rem;
    width: 196px;
    height: 90px;
    padding: 0.85rem 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.9rem;
    box-shadow: 0 0.75rem 1.6rem rgba(31, 35, 40, 0.16);
}

.brand-logo-swap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
}

.navbar .brand-logo-swap img {
  inset: 0.8rem 1rem;
  width: calc(100% - 2rem);
  height: calc(100% - 1.6rem);
}

.sidebar {
    position: fixed;
    top: var(--navbar-height);
    bottom: var(--footer-height);
    left: 0;
    width: var(--sidebar-width);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 3rem 0.75rem 0.75rem;
    background: linear-gradient(180deg, var(--sidebar-nav-bg) 0%, var(--sidebar-bottom-mid) 100%);
    z-index: 1090;
    border-right: 1px solid var(--border-color);
    box-shadow: 0.35rem 0 1.5rem rgba(31, 35, 40, 0.04);
    scrollbar-width: thin;
    scrollbar-color: rgba(108, 115, 125, 0.55) rgba(108, 115, 125, 0.12);
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(108, 115, 125, 0.12);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(108, 115, 125, 0.55);
    border-radius: 4px;
}

.sidebar .sidebar-nav-list {
    margin: 0;
    padding: 0;
    overflow: visible;
}

/* Modal açıkken sol menü ve üst bar her zaman filigranın dışında kalır */
body.modal-open #sidebarMenu,
body.modal-open .sidebar {
    z-index: 1200 !important;
    pointer-events: auto !important;
}

body.modal-open .navbar,
body.modal-open .app-footer {
    z-index: 1210 !important;
}

/*
 * Bootstrap backdrop tam viewport'u kapladığı için sol menüyü de karartabiliyor.
 * Gerçek backdrop'u gizleyip karartmayı sadece içerik alanında üretiyoruz.
 */
body .modal-backdrop {
    display: none !important;
}

body.modal-open .content-area::before {
    content: "";
    position: fixed;
    top: var(--navbar-height);
    right: 0;
    bottom: var(--footer-height);
    left: var(--sidebar-width);
    z-index: 1040;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

/* Bootstrap .modal tam ekran fixed; yalnızca içerik alanını kaplasın */
body.modal-open .modal {
    left: var(--sidebar-width) !important;
    width: calc(100% - var(--sidebar-width)) !important;
    top: var(--navbar-height) !important;
    bottom: var(--footer-height) !important;
    height: auto !important;
    right: auto !important;
    z-index: 1070 !important;
    pointer-events: none !important;
}

body.modal-open .modal-dialog {
    pointer-events: auto !important;
}

#accessDeniedModal {
    z-index: 1080 !important;
}

.sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 0.55rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.12rem;
    border: 1px solid transparent;
    border-radius: 0.7rem;
    font-weight: 500;
    font-size: 0.78rem;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.sidebar .nav-link i {
    color: #6c737d;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus {
    background-color: var(--surface-muted);
    border-color: var(--border-color);
    color: var(--text-strong);
}

.sidebar .nav-link.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-color: var(--border-color);
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.sidebar .nav-link.active i,
.sidebar .nav-link:hover i,
.sidebar .nav-link:focus i {
    color: var(--primary-color);
}

.sidebar .nav-link[aria-expanded="true"]:not(.active) {
    background-color: var(--surface-muted);
    border-color: var(--border-color);
}

.sidebar .collapse .nav-link {
    padding: 0.35rem 0.65rem;
    margin-left: 0.1rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.sidebar .collapse .collapse .nav-link {
    font-size: 0.68rem;
    padding: 0.3rem 0.55rem;
}

.sidebar .collapse .nav-link i:not(.menu-arrow) {
    display: none;
}

.sidebar .sidebar-submenu-flat .nav-link i:not(.menu-arrow) {
    display: inline;
}

.sidebar .sidebar-submenu-label {
    padding: 0.45rem 0.65rem 0.15rem;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    list-style: none;
    pointer-events: none;
    user-select: none;
}

.sidebar .sidebar-submenu-flat > li > .nav-link {
    padding-left: 0.75rem;
}

.content-area {
    position: relative;
    z-index: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    padding-top: 1.25rem;
    padding-bottom: calc(2rem + var(--footer-height));
}

.app-footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 0.75rem;
    color: #d8dde3;
    background: #343434;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.72rem;
    line-height: 1;
}

.app-footer-title,
.app-footer-meta {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.app-footer-title {
    color: #f4f5f7;
    font-weight: 500;
}

.app-footer-meta span,
.app-footer-title span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.app-footer i {
    color: #b8bec6;
    font-size: 0.75rem;
}

.card {
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
}

.card-header {
    background-color: var(--surface-muted);
    border-bottom-color: var(--border-color);
    color: var(--text-strong);
    font-weight: 600;
}

.bg-light,
.table-light {
    background-color: var(--surface-muted) !important;
}

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

.text-primary,
.text-success,
.text-info,
.text-warning,
.text-danger {
    color: var(--primary-color) !important;
}

.border-primary,
.border-success,
.border-info,
.border-warning,
.border-danger {
    border-color: var(--border-color) !important;
}

.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
    --bs-btn-color: #ffffff;
    --bs-btn-bg: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: var(--primary-hover);
    --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-focus-shadow-rgb: 63, 70, 80;
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
    --bs-btn-disabled-bg: #9aa1aa;
    --bs-btn-disabled-border-color: #9aa1aa;
}

.btn-outline-primary,
.btn-outline-success,
.btn-outline-info,
.btn-outline-warning,
.btn-outline-danger {
    --bs-btn-color: var(--primary-color);
    --bs-btn-border-color: #aeb5bd;
    --bs-btn-hover-color: #ffffff;
    --bs-btn-hover-bg: var(--primary-color);
    --bs-btn-hover-border-color: var(--primary-color);
    --bs-btn-focus-shadow-rgb: 63, 70, 80;
    --bs-btn-active-color: #ffffff;
    --bs-btn-active-bg: var(--primary-hover);
    --bs-btn-active-border-color: var(--primary-hover);
}

.btn-secondary,
.btn-outline-secondary {
    --bs-btn-focus-shadow-rgb: 108, 115, 125;
}

.badge.text-bg-primary,
.badge.text-bg-success,
.badge.text-bg-info,
.badge.text-bg-warning,
.badge.text-bg-danger,
.badge.text-bg-secondary {
    color: var(--text-strong) !important;
    background-color: var(--surface-subtle) !important;
    border: 1px solid var(--border-color) !important;
}

.badge.text-bg-light {
    color: var(--text-strong) !important;
    background-color: var(--surface-color) !important;
}

.toast-stack {
    max-width: min(420px, calc(100vw - 1.5rem));
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-stack .toast {
    pointer-events: auto;
    min-width: 280px;
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.toast.toast-success {
    color: #fff;
    background-color: #198754;
    border-left: 4px solid #146c43;
}

.toast.toast-danger {
    color: #fff;
    background-color: #dc3545;
    border-left: 4px solid #b02a37;
}

.toast.toast-warning {
    color: #212529;
    background-color: #ffc107;
    border-left: 4px solid #cc9a06;
}

.toast.toast-info {
    color: #055160;
    background-color: #cff4fc;
    border-left: 4px solid #0dcaf0;
}

.toast.toast-success .bi,
.toast.toast-danger .bi {
    color: rgba(255, 255, 255, 0.9);
}

.toast.toast-warning .bi {
    color: #856404;
}

.toast.toast-info .bi {
    color: #087990;
}

.alert-warning,
.alert-info,
.alert-success,
.alert-danger {
    --bs-alert-color: var(--text-strong);
    --bs-alert-bg: var(--surface-muted);
    --bs-alert-border-color: var(--border-color);
}

.progress {
    background-color: var(--surface-subtle);
}

.progress-bar,
.progress-bar.bg-success,
.progress-bar.bg-warning,
.progress-bar.bg-danger,
.progress-bar.bg-info {
    background-color: var(--primary-color) !important;
}

.form-control:focus,
.form-select:focus {
    border-color: #9aa1aa;
    box-shadow: 0 0 0 0.2rem rgba(63, 70, 80, 0.16);
}

.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.searchable-select-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    cursor: pointer;
    background-color: var(--surface-color);
    color: var(--text-strong);
}

.searchable-select-toggle:disabled,
.searchable-select.is-disabled .searchable-select-toggle {
    cursor: not-allowed;
    opacity: 0.65;
    background-color: var(--surface-subtle);
}

.searchable-select-label {
    flex: 1 1 auto;
    min-width: 0;
}

.searchable-select-caret {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.15s ease;
}

.searchable-select.is-open .searchable-select-caret {
    transform: rotate(180deg);
}

.searchable-select-menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    z-index: 1065;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--surface-color);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.searchable-select-search {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-muted);
}

.searchable-select-search .form-control {
    background-color: var(--surface-color);
}

.searchable-select-list {
    max-height: 240px;
    overflow-y: auto;
    padding: 0.35rem;
}

.searchable-select-option {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--text-strong);
    text-align: left;
    padding: 0.45rem 0.6rem;
    font-size: 0.875rem;
    line-height: 1.35;
}

.searchable-select-option:hover:not(:disabled) {
    background: var(--surface-muted);
}

.searchable-select-option.is-selected {
    background: var(--primary-soft);
    color: var(--text-strong);
    font-weight: 600;
}

.searchable-select-option:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
}

.searchable-select-empty {
    padding: 0.65rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
}

.searchable-select-sm .searchable-select-option {
    font-size: 0.8125rem;
    padding: 0.35rem 0.5rem;
}

.dropdown-menu-search-wrap {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-muted);
    position: sticky;
    top: 0;
    z-index: 1;
}

.dropdown-menu-search-wrap .form-control {
    background-color: var(--surface-color);
}

.map-layer-dropdown-menu .dropdown-menu-search-wrap {
    margin: -0.45rem -0.45rem 0.35rem;
    border-radius: 0.6rem 0.6rem 0 0;
}

a {
    color: var(--primary-color);
}

a:hover {
    color: var(--primary-hover);
}

.sidebar-with-stats {
    display: flex;
    flex-direction: column;
}

.sidebar-with-stats .sidebar-nav-list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.imar-sidebar-stats {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.45rem;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--surface-muted) 0%, var(--surface-subtle) 100%);
}

.imar-sidebar-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 0.55rem;
}

.imar-sidebar-stat i {
    color: var(--primary-color);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.imar-sidebar-stat strong {
    color: var(--text-strong);
    font-weight: 700;
}

@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    body.modal-open .content-area::before {
        left: 0;
    }

    body.modal-open .modal {
        left: 0 !important;
        width: 100% !important;
    }

    .sidebar.show {
        z-index: 1205;
    }

    .content-area {
        margin-left: 0;
        width: 100%;
    }
}

.notification-bell-btn {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 .28rem;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: .64rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    border: 2px solid #fff;
}

.notification-menu {
    width: min(22rem, calc(100vw - 1.5rem));
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.notification-menu-header,
.notification-menu-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .7rem .85rem;
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border-color);
}

.notification-menu-footer {
    border-bottom: 0;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.notification-menu-section {
    padding: .55rem .55rem .2rem;
}

.notification-menu-label {
    padding: .2rem .35rem .35rem;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.notification-groups {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.notification-group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .65rem;
    padding: .55rem .65rem;
    border-radius: .65rem;
    text-decoration: none;
    color: var(--text-strong);
    background: var(--surface-color);
    border: 1px solid transparent;
}

.notification-group-item:hover {
    background: var(--primary-soft);
    border-color: var(--border-color);
    color: var(--text-strong);
}

.notification-group-left {
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    font-size: .82rem;
    font-weight: 600;
}

.notification-group-left i {
    color: var(--primary-color);
}

.notification-recent-list {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    max-height: 14rem;
    overflow: auto;
    padding: 0 .2rem .45rem;
}

.notification-recent-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .6rem;
    border: 1px solid var(--border-color);
    border-radius: .65rem;
    background: var(--surface-color);
    text-decoration: none;
    color: inherit;
}
.notification-recent-item:hover {
    background: var(--surface-muted);
    color: inherit;
}

.notification-recent-body {
    min-width: 0;
}

.notification-recent-actions {
    flex: 0 0 auto;
}

.notification-recent-item.is-unread {
    background: rgba(255, 193, 7, 0.12);
    border-left: 3px solid #f0ad4e;
}
.notification-recent-item.is-read {
    opacity: 0.78;
}

.notification-empty {
    padding: .8rem .65rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .8rem;
}
