/* ═══════════════════════════════════════════════════════
   Micro Platform — Sidebar Navigasyon
   ═══════════════════════════════════════════════════════ */

/* ── Layout ── */
.micro-layout {
    display: flex;
    min-height: 100vh;
}

.micro-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #1e1b4b;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

.micro-sidebar::-webkit-scrollbar { width: 4px; }
.micro-sidebar::-webkit-scrollbar-track { background: transparent; }
.micro-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.micro-main {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f8fafc;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark .micro-main {
    background: #0f172a;
}

/* ── Sidebar Brand ── */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
}

/* Kaynak görsel: docs/kokpitim-logo.png — koyu sidebar’da okunması için beyaz zemin */
.sidebar-brand-logo {
    width: auto;
    max-width: 132px;
    height: 40px;
    object-fit: contain;
    object-position: center center;
    display: block;
    flex-shrink: 0;
    border-radius: 6px;
    /* Arka plan + çerçeve kaldırıldı — şeffaf PNG'ler sidebar üzerinde direkt görünür.
       Koyu renkli logosu olan tenant için fallback altında. */
}

/* Yardımcı: koyu logosu olan tenant beyaz arka plan ister
   (template'de tenant.logo_needs_background varsa eklenebilir) */
.sidebar-brand-logo.has-bg {
    padding: 4px 6px;
    box-sizing: content-box;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.sidebar-brand-name {
    font-size: var(--text-lg);
    font-weight: 700;
    color: white;
    letter-spacing: -0.3px;
}

.sidebar-brand-sub {
    font-size: var(--text-2xs);
    color: rgba(255,255,255,0.4);
    font-weight: 400;
    display: block;
    margin-top: 1px;
}

/* ── Sidebar Nav ── */
.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
}

.sidebar-section-label {
    font-size: var(--text-2xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.3);
    padding: 12px 10px 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: rgba(255,255,255,0.65);
    font-size: var(--text-md);
    font-weight: 500;
    transition: all 0.15s ease;
    margin-bottom: 2px;
    position: relative;
}

.sidebar-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
    text-decoration: none;
}

.sidebar-item.active {
    background: rgba(99, 102, 241, 0.25);
    color: white;
}

.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #6366f1;
    border-radius: 0 2px 2px 0;
}

.sidebar-item-icon {
    width: 20px;
    text-align: center;
    font-size: var(--text-base);
    flex-shrink: 0;
}

.sidebar-item-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.sidebar-user:hover {
    background: rgba(255,255,255,0.08);
}

.sidebar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: var(--text-xs);
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: var(--text-2xs);
    color: rgba(255,255,255,0.4);
}

/* ── Topbar ── */
.micro-topbar {
    height: 56px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.dark .micro-topbar {
    background: #1e293b;
    border-bottom-color: #334155;
}

.topbar-hamburger {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: background 0.15s;
}

.topbar-hamburger:hover {
    background: #f1f5f9;
}

.dark .topbar-hamburger {
    color: #94a3b8;
}

.dark .topbar-hamburger:hover {
    background: #334155;
}

.topbar-title {
    font-size: var(--text-lg);
    font-weight: 600;
    color: #1e293b;
    flex: 1;
}

.dark .topbar-title {
    color: #f1f5f9;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: var(--text-base);
    transition: all 0.15s;
    text-decoration: none;
    position: relative;
}

.topbar-icon-btn:hover {
    background: #f1f5f9;
    color: #6366f1;
}

.dark .topbar-icon-btn {
    color: #94a3b8;
}

.dark .topbar-icon-btn:hover {
    background: #334155;
    color: #818cf8;
}

.topbar-notif-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
}

/* ── Page Content ── */
.micro-page {
    flex: 1;
    padding: 28px 32px;
}

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}

/* ── Mobile ── */
@media (max-width: 1024px) {
    .micro-sidebar {
        transform: translateX(-100%);
    }

    .micro-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }

    .micro-main {
        margin-left: 0;
    }

    .topbar-hamburger {
        display: flex;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .micro-page {
        padding: 20px 16px;
    }
}

@media (max-width: 640px) {
    .micro-page {
        padding: 16px 12px;
    }
}

/* Collapsible sidebar groups (hamburger submenu) */
.sidebar-group { display: block; }
.sidebar-group-toggle {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    display: flex;
    align-items: center;
}
.sidebar-group-chevron {
    margin-left: auto;
    font-size: 11px;
    transition: transform 0.2s ease;
    opacity: 0.7;
}
.sidebar-group.open > .sidebar-group-toggle .sidebar-group-chevron {
    transform: rotate(180deg);
}
.sidebar-group-items {
    display: none;
    overflow: hidden;
}
.sidebar-group.open > .sidebar-group-items {
    display: block;
}
