/* ============================================
   LocalPlanner.ai - REA Construct Kit Design System
   ============================================ */

/* ---- CSS Custom Properties ---- */
:root {
  /* Primary Colors */
  --rea-red: #E4002B;
  --rea-red-hover: #C20024;

  /* Secondary Colors */
  --bluestone: #587284;
  --bluestone-dark: #3D5A6C;

  /* Neutrals */
  --pebble: #E5E3E8;
  --pebble-light: #F5F5F7;
  --white: #FFFFFF;

  /* Semantic Colors */
  --success: #2E7D32;
  --warning: #FCCA36;
  --error: #E4002B;
  --info: #587284;

  /* Text Colors */
  --text-primary: #2C2C2C;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --text-on-red: #FFFFFF;

  /* Typography */
  --font-primary: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: SF Mono, Monaco, Consolas, monospace;

  /* Font Weights */
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
  --shadow-xl: 0 8px 30px rgba(0,0,0,0.12);

  /* Transitions */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;

  /* Layout */
  --header-height: 64px;
  --container-max: 1200px;
  --sidebar-width: 280px;
}

/* ---- CSS Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-primary);
  font-weight: var(--font-regular);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--white);
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

/* ---- Typography ---- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-bold);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.text-hero {
  font-size: 48px;
  line-height: 56px;
  font-weight: var(--font-bold);
}

.text-h1 {
  font-size: 32px;
  line-height: 40px;
}

.text-h2 {
  font-size: 24px;
  line-height: 32px;
}

.text-h3 {
  font-size: 20px;
  line-height: 28px;
  font-weight: var(--font-semibold);
}

.text-h4 {
  font-size: 18px;
  line-height: 24px;
  font-weight: var(--font-semibold);
}

.text-body {
  font-size: 16px;
  line-height: 24px;
}

.text-small {
  font-size: 14px;
  line-height: 20px;
}

.text-xs {
  font-size: 12px;
  line-height: 16px;
}

.text-mono {
  font-family: var(--font-mono);
}

.text-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: var(--font-semibold);
  font-size: 12px;
}

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-red { color: var(--rea-red); }
.text-bluestone { color: var(--bluestone); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }
.text-white { color: var(--white); }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* ---- Layout Utilities ---- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

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

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

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

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.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-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Spacing */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* Width/Height */
.w-full { width: 100%; }
.h-full { height: 100%; }
.min-h-screen { min-height: 100vh; }

/* ---- Background Colors ---- */
.bg-white { background-color: var(--white); }
.bg-pebble { background-color: var(--pebble); }
.bg-pebble-light { background-color: var(--pebble-light); }
.bg-red { background-color: var(--rea-red); }
.bg-bluestone { background-color: var(--bluestone); }
.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }

/* ---- Visibility ---- */
.hidden { display: none; }
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* ---- Responsive ---- */
@media (max-width: 639px) {
  .text-hero {
    font-size: 32px;
    line-height: 40px;
  }

  .text-h1 {
    font-size: 28px;
    line-height: 36px;
  }

  .text-h2 {
    font-size: 22px;
    line-height: 28px;
  }

  .text-h3 {
    font-size: 18px;
    line-height: 24px;
  }

  .container {
    padding: 0 var(--space-4);
  }

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

  .hide-mobile { display: none !important; }
}

@media (min-width: 640px) {
  .hide-tablet { display: none !important; }
  .show-tablet { display: block !important; }

  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .hide-desktop { display: none !important; }
  .show-desktop { display: block !important; }

  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---- Accessibility ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--bluestone);
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Animations ---- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-default);
}

.animate-slide-up {
  animation: slideUp var(--duration-slow) var(--ease-default);
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--pebble-light) 25%,
    var(--pebble) 50%,
    var(--pebble-light) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-md);
}
