/* Layout.css - Application Shell */

/* Remove default body padding from head.html if exists and reset */
body {
    background-color: var(--bg-page) !important;
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    width: 100%;
    color-scheme: dark; /* Force native components to dark mode */
}

/* App Shell Grid */
.app-shell {
    display: flex;
    min-height: 100vh;
    position: relative;
    width: 100%;
}

/* Sidebar Styling */
.app-sidebar {
    width: 250px;
    background-color: var(--bg-page);
    border-right: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    padding: var(--spacing-md) var(--spacing-sm);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main Content Area Wrapper */
.app-content {
    flex: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0; /* Critical for horizontal scroll items inside flex */
}

/* Rounded Content Block */
.app-main {
    flex: 1;
    margin: 24px;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
    border-radius: 24px;
    padding: var(--spacing-xl);
    position: relative;
    min-width: 0; /* Prevent content from pushing width */
    overflow-x: hidden; /* Prevent internal leaking */
}

/* Sidebar Navigation Items */
.nav-section {
    margin-bottom: var(--spacing-sm);
}

.nav-section-title {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    color: var(--color-inactive);
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-xs);
    padding-left: var(--spacing-xs);
    font-weight: 500;
}

.app-sidebar .nav-item {
    display: block;
    padding: 0.35rem var(--spacing-sm);
    color: var(--text-secondary);
    border-radius: var(--border-radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 1px;
    font-weight: 400;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.app-sidebar .nav-item:hover {
    background-color: var(--bg-main);
    color: var(--text-primary);
}

.app-sidebar .nav-item.active {
    background-color: rgba(250, 27, 62, 0.1); /* Red tint */
    color: var(--color-accent);
}

.app-sidebar .nav-item i {
    width: 20px;
    text-align: center;
}

/* User Profile Mini-Block in Sidebar */
.user-mini-profile {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0.75rem var(--spacing-sm);
    background-color: var(--bg-main);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--bg-layer-2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-weight: bold;
}

/* =========================================
   Public Layout
   ========================================= */
.public-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-main);
}

.public-layout .container-fluid {
    width: 100%;
}

/* Mobile Handlers */
.mobile-header {
    display: none; /* Hidden on desktop */
    position: sticky;
    top: 0;
    z-index: 90;
    background-color: var(--bg-page);
    padding: var(--spacing-md);
    border-bottom: none;
    align-items: center;
    justify-content: space-between;
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%); /* Hide sidebar by default */
        box-shadow: none;
    }
    
    .app-sidebar.open {
        transform: translateX(0);
    }

    .app-content {
        margin-left: 0;
    }

    .app-main {
        margin: 0;
        width: 100%;
        border-radius: 0;
        padding: var(--spacing-xl) var(--spacing-md);
    }

    .mobile-header {
        display: flex;
        padding: 1rem var(--spacing-md);
        background-color: var(--bg-page);
        margin-bottom: 0;
    }

    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.7);
        z-index: 95;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }
    
    .mobile-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }
}
