/* ============================================================================
   identUP Pass — Layout
   Sidebar (260/72) + Topbar (64) + Content shell
   ============================================================================ */

/* ── App shell ─────────────────────────────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--color-bg);
}

.app-main {
    flex: 1;
    min-width: 0; /* flex çocuğun overflow sorununu engeller */
    margin-left: var(--sidebar-w);
    transition: margin-left var(--tr-base);
    display: flex;
    flex-direction: column;
}

body.sidebar-mini .app-main {
    margin-left: var(--sidebar-w-mini);
}

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: var(--z-fixed);
    transition: width var(--tr-base), transform var(--tr-base);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.sidebar-mini .app-sidebar {
    width: var(--sidebar-w-mini);
}

/* Sidebar header (logo) */
.sidebar-header {
    height: var(--topbar-h);
    padding: 0 var(--sp-5);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    border-bottom: 1px solid var(--sidebar-divider);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    color: var(--sidebar-text-active);
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar-logo img {
    height: 32px;
    width: auto;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
}

.sidebar-logo-text {
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    letter-spacing: -0.01em;
    color: var(--sidebar-text-active);
}

body.sidebar-mini .sidebar-logo-text,
body.sidebar-mini .sidebar-search-wrap,
body.sidebar-mini .sidebar-section-title,
body.sidebar-mini .nav-text,
body.sidebar-mini .user-card-info {
    display: none;
}

body.sidebar-mini .sidebar-header {
    padding: 0;
    justify-content: center;
}

body.sidebar-mini .user-card {
    justify-content: center;
}

/* Sidebar search */
.sidebar-search-wrap {
    padding: var(--sp-4) var(--sp-4) var(--sp-2);
    flex-shrink: 0;
}

.sidebar-search {
    position: relative;
}

.sidebar-search .ti {
    position: absolute;
    left: var(--sp-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--sidebar-text);
    font-size: 16px;
    pointer-events: none;
}

.sidebar-search input {
    width: 100%;
    height: 36px;
    padding: 0 var(--sp-3) 0 var(--sp-8);
    background: var(--sidebar-search-bg);
    border: 1px solid var(--sidebar-divider);
    border-radius: var(--radius-md);
    color: var(--sidebar-search-text);
    font-size: var(--fs-sm);
    font-family: inherit;
    transition: border-color var(--tr-fast), background var(--tr-fast);
}

.sidebar-search input::placeholder {
    color: var(--sidebar-text);
}

.sidebar-search input:focus {
    outline: none;
    border-color: var(--brand-primary);
    background: rgba(255, 255, 255, 0.06);
}

/* Sidebar nav (scrollable) */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-2) var(--sp-3) var(--sp-4);
    list-style: none;
    margin: 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--sidebar-divider);
}

.sidebar-section {
    margin-top: var(--sp-4);
}

.sidebar-section:first-child {
    margin-top: 0;
}

.sidebar-section-title {
    padding: var(--sp-2) var(--sp-3) var(--sp-1);
    font-size: 10.5px;
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-section);
}

.sidebar-nav-item {
    list-style: none;
    margin-bottom: 2px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    height: 38px;
    padding: 0 var(--sp-3);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: var(--fs-base);
    font-weight: var(--fw-medium);
    border-radius: var(--radius-md);
    transition: background var(--tr-fast), color var(--tr-fast);
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.sidebar-nav-link:hover {
    background: var(--sidebar-bg-hover);
    color: var(--sidebar-text-active);
}

.sidebar-nav-link.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
}

.sidebar-nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    background: var(--sidebar-active-border);
    border-radius: 0 3px 3px 0;
}

.sidebar-nav-link .ti {
    font-size: 18px;
    flex-shrink: 0;
}

.nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-badge {
    background: var(--brand-primary);
    color: var(--brand-primary-text);
    font-size: 10px;
    font-weight: var(--fw-semibold);
    padding: 1px 6px;
    border-radius: var(--radius-pill);
}

body.sidebar-mini .sidebar-nav-link {
    justify-content: center;
    padding: 0;
}

body.sidebar-mini .sidebar-section {
    margin-top: var(--sp-3);
}

body.sidebar-mini .nav-badge {
    display: none;
}

/* Sidebar footer / user card */
.sidebar-footer {
    border-top: 1px solid var(--sidebar-divider);
    padding: var(--sp-3) var(--sp-3);
    flex-shrink: 0;
}

.user-card {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--tr-fast);
    color: var(--sidebar-text-active);
}

.user-card:hover {
    background: var(--sidebar-bg-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-primary);
    color: var(--brand-primary-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--fw-semibold);
    font-size: var(--fs-sm);
    flex-shrink: 0;
}

.user-card-info {
    flex: 1;
    min-width: 0;
}

.user-card-name {
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    line-height: 1.2;
    color: var(--sidebar-text-active);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-card-role {
    font-size: 11px;
    color: var(--sidebar-text);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Topbar ────────────────────────────────────────────────────────────── */
.app-topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    padding: 0 var(--sp-6);
    gap: var(--sp-4);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    backdrop-filter: blur(8px);
}

.topbar-toggle {
    background: transparent;
    border: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: background var(--tr-fast), color var(--tr-fast);
}

.topbar-toggle:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.topbar-toggle .ti {
    font-size: 20px;
}

.topbar-breadcrumb {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-size: var(--fs-sm);
    color: var(--color-text-secondary);
    overflow: hidden;
}

.topbar-breadcrumb a {
    color: var(--color-text-secondary);
    text-decoration: none;
}

.topbar-breadcrumb a:hover {
    color: var(--color-text);
}

.topbar-breadcrumb .ti-chevron-right {
    font-size: 14px;
    color: var(--color-text-muted);
}

.topbar-breadcrumb .current {
    color: var(--color-text);
    font-weight: var(--fw-medium);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}

.topbar-btn {
    background: transparent;
    border: 0;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    position: relative;
    transition: background var(--tr-fast), color var(--tr-fast);
}

.topbar-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.topbar-btn .ti {
    font-size: 20px;
}

.topbar-btn .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--color-danger);
    border: 2px solid var(--topbar-bg);
    border-radius: 50%;
}

/* Theme switcher segment (sun / monitor / moon) */
.theme-switch {
    display: inline-flex;
    align-items: center;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: 2px;
    gap: 2px;
}

.theme-switch-btn {
    background: transparent;
    border: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: background var(--tr-fast), color var(--tr-fast);
}

.theme-switch-btn:hover {
    color: var(--color-text);
}

.theme-switch-btn.active {
    background: var(--color-surface);
    color: var(--brand-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.theme-switch-btn .ti {
    font-size: 15px;
}

/* ── Content ───────────────────────────────────────────────────────────── */
.app-content {
    flex: 1;
    padding: var(--sp-6);
    min-width: 0;
}

/* Page banner (başlık + aksiyonlar) */
.page-banner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
    flex-wrap: wrap;
}

.page-title {
    margin: 0 0 4px;
    font-size: var(--fs-2xl);
    font-weight: var(--fw-semibold);
    line-height: 1.2;
    color: var(--color-text);
}

.page-subtitle {
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--color-text-muted);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

/* ── Mobil: sidebar drawer (lg breakpoint = 992px) ─────────────────────── */
@media (max-width: 991.98px) {
    .app-main {
        margin-left: 0;
    }

    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 32px rgba(0, 0, 0, 0.3);
    }

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

    body.sidebar-mini .app-main {
        margin-left: 0;
    }

    body.sidebar-mini .app-sidebar {
        width: var(--sidebar-w); /* mobilde mini değil, tam */
    }

    /* Backdrop */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: var(--color-overlay);
        z-index: calc(var(--z-fixed) - 1);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .app-content {
        padding: var(--sp-4);
    }
}
