/*
 * ═══════════════════════════════════════════════════════════════
 * HirasMuhasebe — wwwroot/css/sidebar.css  v3
 * Sol sidebar menü stilleri — Beyaz / Soft / Premium
 * ═══════════════════════════════════════════════════════════════
 */

/* ── CSS DEĞİŞKENLER ───────────────────────────── */
:root {
    --sb-width: 300px;
    --sb-collapsed-width: 0px;
    --sb-bg: #ffffff;
    --sb-bg-hover: rgba(99, 102, 241, 0.06);
    --sb-bg-active: rgba(255, 111, 15, 0.08);
    --sb-text: #334155;
    --sb-text-hover: #1e293b;
    --sb-text-active: #ea580c;
    --sb-accent: #ea580c;
    --sb-accent-soft: rgba(234, 88, 12, 0.08);
    --sb-divider: #f1f5f9;
    --sb-sub-bg: #fafbfc;
    --sb-radius: 10px;
    --top-bar-height: 56px;
}

/* ── BODY LAYOUT ────────────────────────────────── */
body.has-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f8fafc;
}

/* ── ÜST BAR ───────────────────────────────────── */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--top-bar-height);
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1001;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.top-bar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    text-decoration: none;
    letter-spacing: -0.02em;
}

.top-bar-logo i {
    font-size: 22px;
    color: var(--sb-accent);
}

.sidebar-toggle {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    font-size: 18px;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.top-bar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #334155;
    font-weight: 500;
}

.top-bar-user i { font-size: 16px; color: #94a3b8; }

.top-bar-logout {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #94a3b8;
    transition: all 0.2s ease;
}

.top-bar-logout:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* ── SIDEBAR ────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: var(--top-bar-height);
    left: 0;
    bottom: 0;
    width: var(--sb-width);
    background: var(--sb-bg);
    border-right: 1px solid #f1f5f9;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
}

.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }
.sidebar:hover::-webkit-scrollbar-thumb { background: #cbd5e1; }

.sidebar-nav {
    padding: 14px 14px 28px;
}

/* ── MENÜ ÖĞELERİ ──────────────────────────────── */
.sb-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    margin: 2px 0;
    color: var(--sb-text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    border-radius: var(--sb-radius);
    line-height: 1.4;
}

.sb-item i:first-child {
    font-size: 19px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.9;
    color: #64748b;
    transition: all 0.2s ease;
}

.sb-item:hover {
    color: var(--sb-text-hover);
    background: var(--sb-bg-hover);
}

.sb-item:hover i:first-child {
    opacity: 1;
}

.sb-item.active {
    color: var(--sb-text-active);
    background: var(--sb-bg-active);
    font-weight: 600;
    border-left: none;
    padding-left: 16px;
}

.sb-item.active i:first-child {
    color: var(--sb-accent);
    opacity: 1;
}

/* ── TOGGLE ARROW ───────────────────────────────── */
.sb-toggle {
    position: relative;
}

.sb-arrow {
    margin-left: auto;
    font-size: 14px;
    opacity: 0.4;
    transition: transform 0.25s ease, opacity 0.2s;
}

.sb-toggle:hover .sb-arrow { opacity: 0.8; }

.sb-group.open > .sb-toggle .sb-arrow {
    transform: rotate(180deg);
    opacity: 0.8;
}

/* ── GRUP BAŞLIK ────────────────────────────────── */
.sb-group {
    margin-bottom: 2px;
}

/* ── ALT MENÜ ───────────────────────────────────── */
.sb-sub {
    display: none;
    padding: 2px 0 6px;
}

.sb-group.open > .sb-sub {
    display: block;
}

.sb-sub-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px 9px 52px;
    color: #475569;
    font-size: 13.5px;
    font-weight: 450;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: var(--sb-radius);
    margin: 1px 0;
    position: relative;
    line-height: 1.4;
}

.sb-sub-item::before {
    content: '';
    position: absolute;
    left: 30px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #94a3b8;
    transition: all 0.2s ease;
}

.sb-sub-item i {
    font-size: 15px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0;
    margin-left: -16px;
    transition: all 0.2s ease;
}

.sb-sub-item:hover {
    color: #1e293b;
    background: var(--sb-bg-hover);
}

.sb-sub-item:hover::before {
    background: #475569;
}

.sb-sub-item.active {
    color: var(--sb-accent);
    font-weight: 650;
    background: var(--sb-accent-soft);
}

.sb-sub-item.active::before {
    background: var(--sb-accent);
    box-shadow: 0 0 0 2px var(--sb-accent-soft);
}

.sb-sub-item.active i {
    opacity: 1;
    color: var(--sb-accent);
}

/* ── BÖLÜM ETİKETİ ─────────────────────────────── */
.sb-section-label {
    padding: 18px 16px 6px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── AYIRICI ────────────────────────────────────── */
.sb-divider {
    height: 1px;
    background: var(--sb-divider);
    margin: 10px 14px;
}

/* ── ANA İÇERİK ALANI ──────────────────────────── */
.site-main.with-sidebar {
    margin-left: var(--sb-width);
    margin-top: var(--top-bar-height);
    min-height: calc(100vh - var(--top-bar-height));
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: 40px;
}

/* ── SIDEBAR OVERLAY (mobil) ────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 999;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.visible { display: block; }

/* ═══════════════════════════════════════════════════ */
/* MASAÜSTÜ COLLAPSED DURUMU                          */
/* ═══════════════════════════════════════════════════ */
@media (min-width: 993px) {
    .sidebar.collapsed {
        transform: translateX(-100%);
    }

    .sidebar.collapsed ~ .site-main.with-sidebar,
    body.has-sidebar .site-main.with-sidebar {
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* collapsed iken main tam genişlik */
    .sidebar.collapsed + .sidebar-overlay + .site-main.with-sidebar {
        margin-left: 0;
    }
}

/* ═══════════════════════════════════════════════════ */
/* MOBİL (< 993px)                                    */
/* ═══════════════════════════════════════════════════ */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
    }

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

    .site-main.with-sidebar {
        margin-left: 0 !important;
    }

    .top-bar-logo span { display: none; }
}

/* ═══════════════════════════════════════════════════ */
/* ÜST MENÜ GİZLE (eski header-main nav)             */
/* ═══════════════════════════════════════════════════ */
body.has-sidebar .site-header { display: none; }

/* ═══════════════════════════════════════════════════ */
/* PAGE HEADER DÜZELTMESİ                             */
/* ═══════════════════════════════════════════════════ */
body.has-sidebar .page-header {
    margin-top: 0;
}
