﻿/* ============================================================
   5. LAYOUT â€” APP SHELL
   ============================================================ */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-slow);
}


/* ============================================================
   6. SIDEBAR
   ============================================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    transition: transform var(--transition-slow);
    overflow-y: auto;
}

.sidebar-header {
    padding: var(--space-6) var(--space-5);
    border-bottom: 1px solid var(--color-border);
}

.sidebar-brand {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-3) var(--space-3);
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--border-radius);
    color: var(--sidebar-text);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    margin-bottom: 2px;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--sidebar-bg-hover);
    color: var(--sidebar-text-hover);
    text-decoration: none;
}

.nav-item.active {
    background: var(--sidebar-bg-active);
    color: var(--sidebar-text-active);
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.nav-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-3) var(--space-4);
}

.nav-section-label {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: var(--space-1) var(--space-4) var(--space-2);
}

.sidebar-footer {
    padding: var(--space-4) var(--space-4);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-full);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.user-name {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--sidebar-text-hover);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: var(--text-xs);
    color: var(--sidebar-text);
}

.role-owner {
    color: var(--color-warning);
}

.role-cashier {
    color: var(--color-info);
}

.btn-logout {
    padding: var(--space-2);
    border-radius: var(--border-radius);
    color: var(--sidebar-text);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}

.btn-logout:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--color-danger);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-sidebar) - 1);
    cursor: pointer;
}

/* Sidebar collapsed state (desktop) */
.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar.collapsed ~ .main-content,
.app-shell.sidebar-collapsed .main-content {
    margin-left: 0;
}


/* ============================================================
   7. HEADER
   ============================================================ */

.main-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    height: var(--header-height);
    padding: 0 var(--space-6);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: calc(var(--z-sidebar) - 5);
}

.btn-sidebar-toggle {
    display: inline-flex;  /* Always visible â€” allows collapsing sidebar */
}

.header-title {
    flex: 1;
    min-width: 0;
}

.header-title h1 {
    font-size: var(--text-lg);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--border-radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-warning);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}


/* ============================================================
   8. PAGE CONTENT
   ============================================================ */

.page-wrapper {
    flex: 1;
    padding: var(--space-6);
    overflow-y: auto;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.page-header h2 {
    font-size: var(--text-xl);
}

.page-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: var(--color-text-muted);
    font-size: var(--text-md);
}

/* Metric cards row */
.metric-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}


