/*
  Sidebar styling — a plain, global (non-CSS-isolated) stylesheet. The menu tree is built via
  RenderTreeBuilder in Sidebar.razor's @code block (recursive rendering needs that, not markup),
  and elements built that way never receive Blazor's scoped-CSS "b-xxx" attribute — only elements
  written literally in a .razor file's template do. A component-scoped Sidebar.razor.css would
  silently fail to match almost everything here, so this lives as a regular stylesheet instead,
  loaded via index.html next to theme.css.
*/

.sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width-expanded, 260px);
    min-width: 0;
    box-sizing: border-box;
    background:
        radial-gradient(circle at 22% 8%, rgba(10, 132, 241, 0.18), transparent 27%),
        linear-gradient(180deg, #071a37 0%, #06142d 48%, #030d20 100%);
    border-inline-end: 1px solid var(--border-dark, #1B2F52);
    height: 100%;
    transition: width 0.18s ease;
    overflow-x: hidden;
}

.sidebar--collapsed {
    width: var(--sidebar-width-collapsed, 72px);
}

.sidebar__brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 78px;
    flex: none;
    padding: 8px 10px 8px 12px;
    border-bottom: 1px solid var(--border-dark, #1B2F52);
    overflow: hidden;
}

.sidebar__brand-logo {
    position: relative;
    width: min(184px, calc(100% - 38px));
    aspect-ratio: 1000 / 197;
    flex: 1 1 auto;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(2, 13, 34, .4);
    box-shadow: inset 0 0 0 1px rgba(22, 199, 252, .08), 0 8px 24px rgba(0, 7, 22, .22);
}

.sidebar__brand-logo .brand-logo {
    display: block;
    width: 100%;
    height: 100% !important;
    max-width: none;
    object-fit: contain;
    object-position: center;
    filter: saturate(1.08) contrast(1.06) drop-shadow(0 0 8px rgba(10, 132, 241, .22));
}

.sidebar--collapsed .sidebar__brand {
    padding: 0 8px;
    justify-content: center;
}

.sidebar--collapsed .sidebar__brand-logo {
    display: none;
}

.sidebar__toggle {
    flex: none;
    background: transparent;
    border: 1px solid var(--border-dark, #1B2F52);
    border-radius: var(--radius-md, 10px);
    color: var(--muted-on-dark, #9FB0C9);
    width: 30px;
    height: 30px;
    cursor: pointer;
    transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.sidebar__toggle:hover {
    color: var(--color-accent, #16C7FC);
    border-color: var(--color-accent, #16C7FC);
}

.sidebar__list {
    list-style: none;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    margin: 0;
    padding: 16px 10px 24px;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
    scrollbar-color: var(--color-primary-dark, #023581) var(--surface-1, #061530);
    scrollbar-width: thin;
}

.sidebar__list::-webkit-scrollbar {
    width: 10px;
}

.sidebar__list::-webkit-scrollbar-track {
    background: var(--surface-1, #061530);
    box-shadow: inset 0 0 0 1px rgba(127, 208, 245, .08);
}

.sidebar__list::-webkit-scrollbar-thumb {
    min-height: 32px;
    border: 2px solid var(--surface-1, #061530);
    border-radius: 999px;
    background: var(--color-primary-dark, #023581);
}

.sidebar__list::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary, #0A84F1);
}

.sidebar__list::-webkit-scrollbar-button {
    width: 10px;
    height: 10px;
    background-color: var(--surface-2, #0C1E3D);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 6px 6px;
}

.sidebar__list::-webkit-scrollbar-button:hover {
    background-color: var(--color-primary-dark, #023581);
}

.sidebar__list::-webkit-scrollbar-button:vertical:decrement {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%239FB0C9' d='M4 2 7 6H1z'/%3E%3C/svg%3E");
}

.sidebar__list::-webkit-scrollbar-button:vertical:increment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%239FB0C9' d='m4 6 3-4H1z'/%3E%3C/svg%3E");
}

.sidebar__sublist {
    list-style: none;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    padding-inline-start: 15px;
    position: relative;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    visibility: hidden;
    transform: translateY(-4px);
    transition: max-height 0.28s ease, opacity 0.18s ease, transform 0.22s ease, margin 0.22s ease, visibility 0s linear 0.28s;
}

.sidebar__sublist--open {
    max-height: 2400px;
    margin: 2px 0 4px;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
}

.sidebar__sublist::before {
    content: "";
    position: absolute;
    top: 2px;
    bottom: 8px;
    inset-inline-start: 5px;
    width: 1px;
    background: var(--border-dark, #1B2F52);
}

/*
  ADR-118 — Raporlar dalı menüye üçüncü bir seviye getirdi (Raporlar > Muhasebe > Cari Hesap Ekstresi).
  244px'lik rayda her seviye 15px götürüyordu; ikinci seviyeden itibaren girinti 10px'e iniyor — kılavuz
  çizgisi yine okunuyor ama uzun Türkçe etiketlere yer kalıyor.
*/
.sidebar__sublist .sidebar__sublist {
    padding-inline-start: 10px;
}

.sidebar--collapsed .sidebar__sublist {
    display: none;
}

.sidebar__item {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 2px;
}

.sidebar__row {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.sidebar__favorite-indicator {
    flex: 0 0 auto;
    color: #facc15;
    font-size: .68rem;
    line-height: 1;
    filter: drop-shadow(0 0 4px rgba(250, 204, 21, .34));
}

.sidebar__link--locked .sidebar__label,
.sidebar__link--locked .sidebar__icon {
    opacity: .72;
}

/* CRM FAZ 4 S-4 (ADR-264): paket dışı madde kilit rozeti — etiketten sonra, satırın sonunda. */
.sidebar__lock {
    flex: 0 0 auto;
    margin-inline-start: auto;
    color: var(--muted-on-dark, #9FB0C9);
}

.sidebar--collapsed .sidebar__lock {
    position: absolute;
    bottom: 5px;
    inset-inline-end: 5px;
    margin: 0;
    pointer-events: none;
}

.sidebar__section {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 17px 12px 6px;
    color: var(--muted-on-dark, #9FB0C9);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    font-weight: 600;
}

.sidebar--collapsed .sidebar__section {
    justify-content: center;
    padding: 12px 0 4px;
}

.sidebar--collapsed .sidebar__section .sidebar__label {
    display: none;
}

.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    width: auto;
    max-width: 100%;
    min-width: 0;
    flex: 1;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: var(--muted-on-dark, #9FB0C9);
    text-align: start;
    cursor: pointer;
    white-space: nowrap;
    border-radius: var(--radius-md, 10px);
    font-size: 0.9rem;
    font-family: inherit;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar__label {
    display: block;
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar__link--group {
    width: 100%;
}

.sidebar__link--group > .sidebar__chevron {
    width: 30px;
    height: 34px;
    flex: 0 0 30px;
    margin-inline-end: -12px;
}

.sidebar__bullet {
    width: 5px;
    height: 5px;
    flex: none;
    margin: 0 6.5px;
    border-radius: 50%;
    background: currentColor;
    opacity: .55;
}

.sidebar__chevron {
    display: inline-grid;
    place-items: center;
    margin-inline-start: auto;
    color: currentColor;
    font-size: 1.28rem;
    line-height: 1;
    transform: rotate(0deg);
    transition: transform .2s ease;
}

.sidebar__chevron--open {
    transform: rotate(90deg);
}

.sidebar__expand {
    display: grid;
    place-items: center;
    width: 30px;
    height: 34px;
    flex: 0 0 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted-on-dark, #9FB0C9);
    cursor: pointer;
}

.sidebar__expand > .sidebar__chevron {
    margin-inline-start: 0;
}

.sidebar__expand:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
}

.sidebar__link:hover {
    background: rgba(255, 255, 255, 0.055);
    color: var(--text-on-dark, #F4F8FD);
    transform: translateX(2px);
}

.sidebar__item--active > .sidebar__row > .sidebar__link {
    background: var(--gradient-brand-strong, linear-gradient(90deg, #0A5CC0 0%, #0A74DA 100%));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(10, 132, 241, 0.24);
}

.sidebar__item--active-parent > .sidebar__row > .sidebar__link {
    color: var(--text-on-dark, #F4F8FD);
}

.sidebar__item--child > .sidebar__link {
    padding: 7px 12px;
    font-size: 0.86rem;
}

.sidebar--collapsed .sidebar__label {
    display: none;
}

.sidebar--collapsed .sidebar__link {
    justify-content: center;
    padding: 10px;
}

.sidebar--collapsed .sidebar__expand,
.sidebar--collapsed .sidebar__chevron,
.sidebar--collapsed .sidebar__bullet {
    display: none;
}

.sidebar--collapsed .sidebar__row {
    position: relative;
}

.sidebar--collapsed .sidebar__favorite-indicator {
    position: absolute;
    top: 5px;
    inset-inline-end: 5px;
    font-size: .54rem;
    pointer-events: none;
}

.sidebar__context-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: default;
}

.sidebar__context-menu {
    position: fixed;
    z-index: 1091;
    left: clamp(8px, var(--sidebar-context-x), calc(100vw - 198px));
    top: clamp(8px, var(--sidebar-context-y), calc(100vh - 100px));
    min-width: 190px;
    padding: 5px;
    border: 1px solid rgba(129, 162, 205, .24);
    border-radius: 10px;
    background: #0b1f3d;
    box-shadow: 0 14px 38px rgba(0, 6, 20, .42);
}

.sidebar__context-action {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #e8f2ff;
    font: inherit;
    font-size: .84rem;
    text-align: start;
    cursor: pointer;
}

.sidebar__context-action:hover,
.sidebar__context-action:focus-visible {
    background: rgba(22, 199, 252, .12);
    color: #fff;
    outline: none;
}

.sidebar__context-star {
    color: #facc15;
    font-size: .78rem;
    line-height: 1;
}

@media (max-width: 900px) {
    .sidebar:not(.sidebar--collapsed) {
        width: var(--sidebar-width-collapsed, 72px);
    }

    .sidebar:not(.sidebar--collapsed) .sidebar__brand {
        justify-content: center;
        padding: 0 8px;
    }

    .sidebar:not(.sidebar--collapsed) .sidebar__brand-logo,
    .sidebar:not(.sidebar--collapsed) .sidebar__label,
    .sidebar:not(.sidebar--collapsed) .sidebar__sublist {
        display: none;
    }

    .sidebar:not(.sidebar--collapsed) .sidebar__link,
    .sidebar:not(.sidebar--collapsed) .sidebar__section {
        justify-content: center;
        padding-inline: 0;
    }

    .sidebar:not(.sidebar--collapsed) .sidebar__expand,
    .sidebar:not(.sidebar--collapsed) .sidebar__chevron,
    .sidebar:not(.sidebar--collapsed) .sidebar__bullet {
        display: none;
    }

    .sidebar:not(.sidebar--collapsed) .sidebar__row {
        position: relative;
    }

    .sidebar:not(.sidebar--collapsed) .sidebar__favorite-indicator {
        position: absolute;
        top: 5px;
        inset-inline-end: 5px;
        font-size: .54rem;
        pointer-events: none;
    }
}
