/*
 * ╔═══════════════════════════════════════════════════════════════╗
 * ║                      LAYOUT SYSTEM                            ║
 * ║              Grid + Containers + Wrappers                     ║
 * ╚═══════════════════════════════════════════════════════════════╝
 */

/* ═════════════════════════════════════════════════════════════
 * 1. CONTAINER SYSTEM
 * ═════════════════════════════════════════════════════════════ */

.container {
  width: 100%;
  max-width: 1200px;
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--space-4);
  padding-left: var(--space-4);
}

.container-fluid {
  width: 100%;
  padding-right: var(--space-4);
  padding-left: var(--space-4);
}

.container-narrow {
  max-width: 960px;
}

.container-wide {
  max-width: 1400px;
}

/* Responsive Containers */
@media (min-width: 640px) {
  .container {
    padding-right: var(--space-6);
    padding-left: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .container {
    padding-right: var(--space-8);
    padding-left: var(--space-8);
  }
}

/* ═════════════════════════════════════════════════════════════
 * 2. GRID SYSTEM
 * ═════════════════════════════════════════════════════════════ */

.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

/* Responsive Grid */
@media (max-width: 768px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ═════════════════════════════════════════════════════════════
 * 3. FLEXBOX UTILITIES
 * ═════════════════════════════════════════════════════════════ */

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-row {
  flex-direction: row;
}

.flex-wrap {
  flex-wrap: wrap;
}

.flex-nowrap {
  flex-wrap: nowrap;
}

/* Justify Content */
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

/* Align Items */
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.items-stretch { align-items: stretch; }

/* Gap Utilities */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ═════════════════════════════════════════════════════════════
 * 4. SECTION SPACING
 * ═════════════════════════════════════════════════════════════ */

.section {
  padding: var(--space-16) 0;
}

.section-sm {
  padding: var(--space-8) 0;
}

.section-lg {
  padding: var(--space-24) 0;
}

@media (max-width: 768px) {
  .section {
    padding: var(--space-12) 0;
  }
  
  .section-lg {
    padding: var(--space-16) 0;
  }
}

/* ═════════════════════════════════════════════════════════════
 * 5. SPACING UTILITIES
 * ═════════════════════════════════════════════════════════════ */

/* Margin */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mx-auto { margin-right: auto; margin-left: auto; }
.my-4 { margin-top: var(--space-4); margin-bottom: var(--space-4); }
.my-6 { margin-top: var(--space-6); margin-bottom: var(--space-6); }

/* Padding */
.p-0 { padding: 0; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-right: var(--space-4); padding-left: var(--space-4); }
.px-6 { padding-right: var(--space-6); padding-left: var(--space-6); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }

/* ═════════════════════════════════════════════════════════════
 * 6. POSITIONING
 * ═════════════════════════════════════════════════════════════ */

.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }

/* ═════════════════════════════════════════════════════════════
 * 7. DISPLAY UTILITIES
 * ═════════════════════════════════════════════════════════════ */

.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.hidden { display: none; }

/* Responsive Display */
@media (max-width: 768px) {
  .hidden-mobile { display: none; }
}

@media (min-width: 769px) {
  .hidden-desktop { display: none; }
}

/* ═════════════════════════════════════════════════════════════
 * 8. WIDTH & HEIGHT UTILITIES
 * ═════════════════════════════════════════════════════════════ */

.w-full { width: 100%; }
.w-auto { width: auto; }
.w-fit { width: fit-content; }

.h-full { height: 100%; }
.h-auto { height: auto; }
.h-screen { height: 100vh; }

.max-w-none { max-width: none; }
.max-w-xs { max-width: 320px; }
.max-w-sm { max-width: 480px; }
.max-w-md { max-width: 640px; }
.max-w-lg { max-width: 800px; }
.max-w-xl { max-width: 960px; }
.max-w-2xl { max-width: 1200px; }
.max-w-full { max-width: 100%; }

/* ═════════════════════════════════════════════════════════════
 * 9. OVERFLOW
 * ═════════════════════════════════════════════════════════════ */

.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-visible { overflow: visible; }
.overflow-scroll { overflow: scroll; }

.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* ═════════════════════════════════════════════════════════════
 * 10. Z-INDEX UTILITIES
 * ═════════════════════════════════════════════════════════════ */

.z-0 { z-index: var(--z-base); }
.z-10 { z-index: var(--z-dropdown); }
.z-20 { z-index: var(--z-sticky); }
.z-30 { z-index: var(--z-fixed); }
.z-40 { z-index: var(--z-modal-backdrop); }
.z-50 { z-index: var(--z-modal); }

/* ═════════════════════════════════════════════════════════════
 * 11. ASPECT RATIO
 * ═════════════════════════════════════════════════════════════ */

.aspect-video {
  aspect-ratio: 16 / 9;
}

.aspect-square {
  aspect-ratio: 1 / 1;
}

.aspect-4-3 {
  aspect-ratio: 4 / 3;
}
