/* 
 * PadniSi Design System - Layout: Sidebar
 * ---------------------------------------
 * Standard sidebar + content layout with mobile drawer support.
 */

/* 
 * Desktop Grid (>= 992px)
 * -----------------------
 * Supports two modes:
 * 1. Simple: Sidebar | Content (default)
 * 2. Complex: Named areas for internal Headers
 */
.pds-sidebar-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    align-items: start;
    width: 100%;
}

/* Optional: Full Width Mod */
.pds-sidebar-layout.full-width {
    grid-template-columns: 1fr;
}

/* Optional: Complex structure with Header area */
/* Usage: Add class 'with-internal-header' to container */
.pds-sidebar-layout.with-internal-header {
    grid-template-rows: auto 1fr;
    grid-template-areas:
        "sidebar header"
        "sidebar content";
}

.pds-sidebar-layout.with-internal-header .pds-sidebar {
    grid-area: sidebar;
}

.pds-sidebar-layout.with-internal-header .pds-content-header {
    grid-area: header;
}

.pds-sidebar-layout.with-internal-header .pds-content-body {
    grid-area: content;
}


/* 
 * Mobile Layout (< 992px)
 * -----------------------
 * Switches to single column.
 * Sidebar becomes an off-canvas drawer.
 */
@media (max-width: 991.98px) {
    .pds-sidebar-layout {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    /* If using internal header, reorder for mobile */
    .pds-sidebar-layout.with-internal-header .pds-content-header {
        order: 1;
    }

    .pds-sidebar-layout.with-internal-header .pds-content-body {
        order: 2;
    }

    /* 
     * Mobile Drawer (Off-Canvas)
     * --------------------------
     * The sidebar moves off-screen and slides in.
     */
    .pds-sidebar {
        position: fixed !important;
        top: 0;
        right: -320px;
        left: auto;
        width: 300px;
        height: 100vh !important;
        z-index: 1200;
        background: white !important;
        padding: 0 !important;
        box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
        transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    .pds-sidebar.active {
        right: 0;
    }

    /* Drawer Header (Mobile Only) */
    .pds-sidebar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        border-bottom: 1px solid #eee;
        background: white;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .pds-sidebar-header h3 {
        font-size: 1.1rem;
        font-weight: 700;
        margin: 0;
        color: var(--dark);
    }

    .pds-sidebar-close-btn {
        background: none;
        border: none;
        font-size: 20px;
        color: var(--gray);
        cursor: pointer;
        padding: 5px;
    }

    /* Content wrapper inside sidebar */
    .pds-sidebar-content {
        padding: 20px;
    }
}

/* Desktop: Hide Mobile Header inside Sidebar */
@media (min-width: 992px) {
    .pds-sidebar-header {
        display: none;
    }
}

/* 
 * Backdrop Overlay
 * ----------------
 */
.pds-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1150;
    display: none;
    backdrop-filter: blur(2px);
}

.pds-sidebar-backdrop.active {
    display: block !important;
}

/* 
 * Helper: Mobile Toggle Button 
 * ----------------------------
 * Standard button to open sidebar on mobile.
 */
.pds-mobile-sidebar-toggle {
    display: none;
    width: 100%;
    padding: 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    justify-content: center;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 15px;
}

.pds-mobile-sidebar-toggle:hover {
    background: #f8f9fa;
    border-color: #cbd5e1;
}

@media (max-width: 991.98px) {
    .pds-mobile-sidebar-toggle {
        display: flex;
    }
}