/* ==========================================================================
   Layout Architecture
   ========================================================================== */

/* Universal Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--s-6);
}

/* Flex Utilities */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* CSS Grid Engine */
.grid {
    display: grid;
    gap: var(--s-8);
}

.grid-2 {
    grid-template-columns: repeat(1, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 768px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Sections */
.section-spacing {
    padding: var(--s-20) 0;
}

.section-spacing-sm {
    padding: var(--s-12) 0;
}

.section-divider {
    border-top: 1px solid var(--border-subtle);
}

/* Split Layout (50/50 side by side) */
.split-layout {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    align-items: center;
}

@media (min-width: 900px) {
    .split-layout {
        flex-direction: row;
        justify-content: space-between;
    }
    
    .split-text, .split-image {
        flex: 1;
    }
    
    .split-image {
        max-width: 50%;
    }
}

/*
 * TOOL LAYOUT (Generator App Specific)
 * Using CSS Grid for the sidebar/main paradigm
 */
.app-layout {
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-muted);
}

.sidebar {
    background-color: var(--bg-surface);
    border-inline-end: 1px solid var(--border-subtle);
    padding: var(--s-8);
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 340px;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform var(--transition-relax);
    box-shadow: 4px 0 24px rgba(0,0,0,0.02);
}

/* RTL / LTR specific off-screen transforms */
[dir="ltr"] .sidebar { transform: translateX(-100%); }
[dir="rtl"] .sidebar { transform: translateX(100%); }

.sidebar.open {
    transform: translateX(0) !important;
}

.app-layout.sidebar-open {
    padding-inline-start: 340px;
}

.main-content {
    padding: var(--s-8);
    background-color: var(--bg-main);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Sidebar close button for mobile or general use */
.sidebar-close {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--s-10);
}
