/* website/static/css/base/layout.css */

/* ------------------------------------------------------------
   GLOBAL LAYOUT SYSTEM (Unified + Theme-Aware + Responsive)
   website/static/css/base/layout.css
------------------------------------------------------------
   PURPOSE:
   This file defines the structural foundation of the entire
   application. It handles:
   ✓ Containers
   ✓ Grid + Flex utilities
   ✓ Section wrappers
   ✓ Sidebar layouts
   ✓ Spacing helpers
   ✓ Theme-aware backgrounds
   ✓ Clean, scalable architecture

   GOALS:
   - Zero hardcoded colors
   - 100% variable-driven
   - Works seamlessly with responsive.css
   - Predictable, elegant, maintainable
------------------------------------------------------------ */


/* ============================================================
   1) ROOT LAYOUT VARIABLES
   ------------------------------------------------------------
   These may be overridden by themes.css.
============================================================ */
:root {
  --container-max-width: 1200px;
  --container-padding: 1rem;
  --grid-gap: 16px;

  /* Fallbacks (themes override these) */
  --glass-bg: rgba(255,255,255,0.08);
  --section-bg: rgba(255,255,255,0.04);
  --content-bg: transparent;
}



/* ============================================================
   2) MAIN CONTAINER
============================================================ */
.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: var(--container-padding);
  background: var(--content-bg);
  color: var(--color-text);
}



/* ============================================================
   3) FLEX UTILITIES
============================================================ */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
}



/* ============================================================
   4) GRID UTILITIES
============================================================ */
.grid {
  display: grid;
  gap: var(--grid-gap);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Auto-fit grid for cards, tags, notes, questions */
.grid-auto {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}



/* ============================================================
   5) SPACING UTILITIES
============================================================ */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }



/* ============================================================
   6) TEXT ALIGNMENT UTILITIES
============================================================ */
.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }



/* ============================================================
   7) SECTION WRAPPER
   Used for grouped content blocks.
============================================================ */
.section {
  margin: 2rem 0;
  padding: 1rem;
  background: var(--section-bg);
  color: var(--color-text);
  border-radius: var(--radius-base, 12px);
  backdrop-filter: blur(10px);
}



/* ============================================================
   8) HERO SECTION
   Large, centered, theme-aware intro block.
============================================================ */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  padding: 3rem 1rem;
  text-align: center;

  background: var(--section-bg);
  border-radius: var(--radius-large, 16px);
  backdrop-filter: blur(12px);
  color: var(--color-text);
}



/* ============================================================
   9) SIDEBAR LAYOUT
   Two-column layout for dashboards & admin pages.
============================================================ */
.layout-sidebar {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: var(--grid-gap);
}

.layout-sidebar .sidebar {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-base, 12px);
  padding: 1rem;
  color: var(--color-text);
}

.layout-sidebar .content {
  padding: 1rem;
  background: var(--content-bg);
  color: var(--color-text);
}



/* ============================================================
   10) RESPONSIVE ADJUSTMENTS
   (Structural only — visual responsiveness handled in responsive.css)
============================================================ */
@media (max-width: 768px) {
  .layout-sidebar {
    grid-template-columns: 1fr;
  }

  .layout-sidebar .sidebar {
    margin-bottom: 1rem;
  }
}
