/* ═══════════════════════════════════════════════════════════════
   SCHWARZGELB HUB - MODERN CSS ARCHITECTURE
   ═══════════════════════════════════════════════════════════════ */

/* ═══ LAYER 1: RESET ═══ */
@layer reset {
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
  }
  
  html {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  body {
    line-height: 1.6;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  }
  
  img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
  }
  
  input, button, textarea, select {
    font: inherit;
  }
  
  p, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word;
  }
}

/* ═══ LAYER 2: DESIGN TOKENS ═══ */
@layer tokens {
  :root {
    /* Color System */
    --color-primary-50: #fff5e6;
    --color-primary-100: #ffe6b3;
    --color-primary-200: #ffd680;
    --color-primary-300: #ffc64d;
    --color-primary-400: #d4a817;
    --color-primary-500: #b8920f;
    --color-primary-600: #9c7c0d;
    --color-primary-700: #80670b;
    --color-primary-800: #645209;
    --color-primary-900: #483d07;
    
    /* Neutral Colors */
    --color-neutral-0: #ffffff;
    --color-neutral-100: #f5f5f5;
    --color-neutral-200: #e5e5e5;
    --color-neutral-300: #d4d4d4;
    --color-neutral-400: #a3a3a3;
    --color-neutral-500: #737373;
    --color-neutral-600: #525252;
    --color-neutral-700: #404040;
    --color-neutral-800: #262626;
    --color-neutral-900: #171717;
    
    /* Semantic Colors */
    --color-success: #22c55e;
    --color-warning: #f59e0b;
    --color-error: #ef4444;
    --color-info: #3b82f6;
    
    /* Spacing Scale (4px base) */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    
    /* Typography Scale */
    --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.8rem);
    --text-sm: clamp(0.875rem, 0.8rem + 0.3vw, 0.95rem);
    --text-base: clamp(1rem, 0.9rem + 0.4vw, 1.1rem);
    --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
    --text-xl: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
    --text-2xl: clamp(1.5rem, 1.3rem + 0.8vw, 1.875rem);
    --text-3xl: clamp(1.875rem, 1.5rem + 1vw, 2.25rem);
    --text-4xl: clamp(2.25rem, 1.8rem + 1.2vw, 2.75rem);
    --text-5xl: clamp(3rem, 2.2rem + 1.5vw, 3.5rem);
    --text-6xl: clamp(3.75rem, 2.8rem + 2vw, 4.5rem);
    
    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    
    /* Line Heights */
    --leading-none: 1;
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;
    
    /* Letter Spacing */
    --tracking-tighter: -0.05em;
    --tracking-tight: -0.025em;
    --tracking-normal: 0em;
    --tracking-wide: 0.025em;
    --tracking-wider: 0.05em;
    --tracking-widest: 0.1em;
    
    /* Border Radius */
    --radius-none: 0;
    --radius-sm: 0.25rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);
    --shadow-glow: 0 0 15px rgb(212 168 23 / 0.3);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* Z-Index Scale */
    --z-behind: -1;
    --z-base: 0;
    --z-above: 10;
    --z-overlay: 100;
    --z-modal: 1000;
    --z-toast: 2000;
    --z-tooltip: 3000;
    --z-max: 9999;
  }
}

/* ═══ LAYER 3: UTILITIES ═══ */
@layer utilities {
  .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;
  }
  
  .container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--space-4);
  }
  
  .flex { display: flex; }
  .grid { display: grid; }
  .inline-flex { display: inline-flex; }
  .inline-grid { display: inline-grid; }
  
  .items-center { align-items: center; }
  .items-start { align-items: flex-start; }
  .items-end { align-items: flex-end; }
  .justify-center { justify-content: center; }
  .justify-between { justify-content: space-between; }
  .justify-start { justify-content: flex-start; }
  .justify-end { justify-content: flex-end; }
  
  .flex-col { flex-direction: column; }
  .flex-row { flex-direction: row; }
  .flex-wrap { flex-wrap: wrap; }
  .flex-1 { flex: 1 1 0%; }
  .flex-shrink-0 { flex-shrink: 0; }
  
  .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: 1.2rem; }
  .gap-8 { gap: var(--space-8); }
  .gap-10 { gap: var(--space-10); }
  
  .w-full { width: 100%; }
  .h-full { height: 100%; }
  .min-h-screen { min-height: 100vh; }
  
  .overflow-hidden { overflow: hidden; }
  .overflow-auto { overflow: auto; }
  .overflow-y-auto { overflow-y: auto; }
  
  .text-center { text-align: center; }
  .text-left { text-align: left; }
  .text-right { text-align: right; }
  
  .relative { position: relative; }
  .absolute { position: absolute; }
  .fixed { position: fixed; }
  .sticky { position: sticky; }
  
  .inset-0 { inset: 0; }
  .top-0 { top: 0; }
  .left-0 { left: 0; }
  .right-0 { right: 0; }
  .bottom-0 { bottom: 0; }
  
  .hidden { display: none; }
  .visible { visibility: visible; }
  .invisible { visibility: hidden; }
  
  .opacity-0 { opacity: 0; }
  .opacity-50 { opacity: 0.5; }
  .opacity-100 { opacity: 1; }
  
  .pointer-events-none { pointer-events: none; }
  .pointer-events-auto { pointer-events: auto; }
  
  .select-none { user-select: none; }
  
  .transition-all { transition: all var(--transition-base); }
  .transition-transform { transition: transform var(--transition-base); }
  .transition-opacity { transition: opacity var(--transition-base); }
  .transition-shadow { transition: box-shadow var(--transition-base); }
  
  .transform { transform: translateY(0); }
  .transform-gpu { transform: translateZ(0); will-change: transform; }
  
  .animate-spin { animation: spin 1s linear infinite; }
  .animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
  .animate-bounce { animation: bounce 1s infinite; }
  
  @keyframes spin { to { transform: rotate(360deg); } }
  @keyframes pulse { 50% { opacity: 0.5; } }
  @keyframes bounce {
    0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
    50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
  }
}

/* ═══ LAYER 4: COMPONENTS ═══ */
@layer components {
  /* Sport Button System */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-weight: var(--font-semibold);
    line-height: var(--leading-none);
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
  }
  
  .btn-primary {
    background: linear-gradient(135deg, var(--color-primary-400), var(--color-primary-600));
    color: var(--color-neutral-900);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    text-shadow: 0 1px 0 rgb(255 255 255 / 0.2);
  }
  
  .btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-lg), 0 0 30px rgb(212 168 23 / 0.4);
  }
  
  .btn-primary:active {
    transform: translateY(0) scale(0.98);
  }
  
  .btn-secondary {
    background: transparent;
    color: var(--color-primary-400);
    border: 1px solid var(--color-primary-400);
  }
  
  .btn-secondary:hover {
    background: rgb(212 168 23 / 0.1);
    border-color: var(--color-primary-300);
  }
  
  .btn-ghost {
    background: transparent;
    color: #e5e5e5;
  }
  
  .btn-ghost:hover {
    background: rgb(255 255 255 / 0.05);
    color: var(--color-primary-400);
  }
  
  /* Card System */
  .card {
    position: relative;
    background: linear-gradient(135deg, rgb(20 20 20 / 0.9), rgb(10 10 10 / 0.95));
    border: 1px solid rgb(255 255 255 / 0.08);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-xl);
    transition: all var(--transition-base);
  }
  
  .card:hover {
    transform: translateY(-8px);
    border-color: rgb(212 168 23 / 0.3);
    box-shadow: var(--shadow-2xl), 0 0 40px rgb(212 168 23 / 0.15);
  }
  
  /* Badge System */
  .badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
  }
  
  .badge-primary {
    background: rgb(212 168 23 / 0.15);
    color: var(--color-primary-400);
    border: 1px solid rgb(212 168 23 / 0.3);
  }
  
  /* Icon Button */
  .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--space-10);
    height: var(--space-10);
    padding: 0;
    background: transparent;
    border: 1px solid rgb(255 255 255 / 0.1);
    border-radius: var(--radius-lg);
    color: #e5e5e5;
    cursor: pointer;
    transition: all var(--transition-base);
  }
  
  .icon-btn:hover {
    background: rgb(255 255 255 / 0.05);
    border-color: var(--color-primary-400);
    color: var(--color-primary-400);
  }
  
  /* Input System */
  .input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: rgb(0 0 0 / 0.3);
    border: 1px solid rgb(255 255 255 / 0.1);
    border-radius: var(--radius-lg);
    color: var(--color-neutral-0);
    font-size: var(--text-base);
    transition: all var(--transition-base);
  }
  
  .input:focus {
    outline: none;
    border-color: var(--color-primary-400);
    box-shadow: 0 0 0 3px rgb(212 168 23 / 0.2);
  }
  
  .input::placeholder {
    color: var(--color-neutral-500);
  }
}

/* ═══ LAYER 5: LAYOUT ═══ */
@layer layout {
  .app {
    position: relative;
    z-index: var(--z-above);
    width: 100%;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    overflow: hidden;
  }
  
  .header {
    text-align: center;
    margin-bottom: var(--space-8);
    position: relative;
    z-index: 15;
  }
  
  .main {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-8);
  }
  
  .footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-base);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-6);
    background: rgb(0 0 0 / 0.3);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgb(255 255 255 / 0.05);
  }
  
  .modal {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(0 0 0 / 0.9);
    backdrop-filter: blur(20px);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
  }
  
  .modal.active {
    opacity: 1;
    visibility: visible;
  }
  
  .modal-content {
    width: min(90vw, 800px);
    height: min(80vh, 600px);
    max-height: 80vh;
    background: linear-gradient(135deg, rgb(20 20 20), rgb(10 10 10));
    border: 1px solid rgb(255 255 255 / 0.1);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-spring);
    display: flex;
    flex-direction: column;
  }
  
  .modal.active .modal-content {
    transform: scale(1) translateY(0);
  }
  
  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid rgb(255 255 255 / 0.1);
  }
  
  .modal-header h2 {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-primary-400);
  }
  
  .modal-body {
    flex: 1;
    overflow: hidden;
    padding: var(--space-4);
  }
}

/* ═══ LAYER 6: RESPONSIVE ═══ */
@layer responsive {
  @container (max-width: 640px) {
    .card {
      padding: var(--space-4);
    }
    
    .btn {
      padding: var(--space-2) var(--space-4);
    }
  }
  
  @container (min-width: 768px) {
    .grid-responsive {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  
  @container (min-width: 1024px) {
    .grid-responsive {
      grid-template-columns: repeat(3, 1fr);
    }
  }
}

/* ═══ LAYER 7: ANIMATIONS ═══ */
@layer animations {
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  
  @keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  @keyframes slideLeft {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
  }
  
  @keyframes slideRight {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
  }
  
  @keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
  }
  
  @keyframes rotateIn {
    from { opacity: 0; transform: rotate(-10deg) scale(0.9); }
    to { opacity: 1; transform: rotate(0) scale(1); }
  }
  
  @keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgb(212 168 23 / 0.3); }
    50% { box-shadow: 0 0 40px rgb(212 168 23 / 0.5); }
  }
  
  @keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
  }
  
  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }
}

/* ═══ LAYER 8: ACCESSIBILITY ═══ */
@layer accessibility {
  :focus-visible {
    outline: 2px solid var(--color-primary-400);
    outline-offset: 2px;
  }
  
  :focus:not(:focus-visible) {
    outline: none;
  }
  
  @media (prefers-contrast: high) {
    :root {
      --color-primary-400: #d4a817;
      --color-neutral-400: #a3a3a3;
    }
  }
  
  @media (prefers-color-scheme: dark) {
    :root {
      --color-bg: var(--color-neutral-900);
      --color-text: var(--color-neutral-0);
    }
  }
}

/* ═══ LAYER 9: THEME ═══ */
@layer theme {
  :root[data-theme="dark"] {
    --color-bg: var(--color-neutral-900);
    --color-text: var(--color-neutral-0);
    --color-surface: var(--color-neutral-800);
  }
  
  :root[data-theme="light"] {
    --color-bg: var(--color-neutral-0);
    --color-text: var(--color-neutral-900);
    --color-surface: var(--color-neutral-100);
  }
}

/* ═══ LAYER 10: UTILITIES (EXTENDED) ═══ */
@layer utilities-extended {
  .gradient-text {
    background: linear-gradient(135deg, var(--color-primary-400), var(--color-primary-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  .glass {
    background: rgb(255 255 255 / 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgb(255 255 255 / 0.1);
  }
  
  .glass-dark {
    background: rgb(0 0 0 / 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgb(255 255 255 / 0.05);
  }
  
  .text-gradient {
    background: linear-gradient(135deg, var(--color-primary-400), var(--color-primary-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  .border-gradient {
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
  }
  
  .border-gradient::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--color-primary-400), var(--color-primary-600));
    z-index: -1;
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    padding: 2px;
  }
}

/* ═══ CUSTOM PROPERTIES FOR DYNAMIC THEMES ═══ */
:root {
  --primary: var(--color-primary-500);
  --primary-light: var(--color-primary-400);
  --primary-dark: var(--color-primary-600);
  --primary-glow: rgb(212 168 23 / 0.4);
}

/* ═══ COMPONENT STYLES ═══ */
@layer components {
  /* Header */
  .header h1 {
    font-size: var(--text-5xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-none);
    margin-bottom: var(--space-2);
    color: var(--color-neutral-0);
  }
  
  .header .subtitle {
    font-size: var(--text-lg);
    color: #e5e5e5;
    letter-spacing: var(--tracking-wide);
  }
  
  /* Cards Grid */
  .cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); gap: 1.2rem;
    gap: 1.2rem;
    width: 100%;
  }
  
  .card-icon {
    width: var(--space-16);
    height: var(--space-16);
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-700));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-3xl);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
  }
  
  .card-title { text-align: center;
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-neutral-0);
    margin-bottom: var(--space-2);
  }
  
  .card-description { text-align: center;
    font-size: var(--text-sm);
    color: #e5e5e5;
    line-height: var(--leading-relaxed);
  }
}

/* ═══ MODERN CSS FEATURES ═══ */
@layer modern {
  /* Container Queries */
  .card-container {
    container-type: inline-size;
    container-name: card;
  }
  
  @container card (min-width: 400px) {
    .card-content {
      flex-direction: row;
      align-items: center;
    }
  }
  
  /* Aspect Ratio */
  .aspect-square { aspect-ratio: 1; }
  .aspect-video { aspect-ratio: 16/9; }
  .aspect-portrait { aspect-ratio: 3/4; }
  
  /* Object Fit */
  .object-cover { object-fit: cover; }
  .object-contain { object-fit: contain; }
  .object-fill { object-fit: fill; }
  
  /* CSS Nesting (native) */
  .nav-item {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    
    &:hover {
      background: rgb(255 255 255 / 0.05);
      color: var(--color-primary-400);
    }
    
    &.active {
      background: rgb(212 168 23 / 0.1);
      color: var(--color-primary-400);
    }
  }
}

/* ═══ FINAL ═══ */
html {
  background: var(--color-bg, var(--color-neutral-900));
  color: var(--color-text, var(--color-neutral-0));
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow: hidden;
}

/* Ensure proper font loading */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('https://fonts.gstatic.com/s/inter/v18/UcCo3FwrK3iLTcviYwY.woff2') format('woff2');
}

/* Add your custom font here */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

body {
  font-family: var(--font-sans);
}

/* ═══ PREVENT SCROLLING ═══ */
html, body {
  overflow: hidden !important;
  height: 100% !important;
  width: 100% !important;
}

.app {
  height: 100vh !important;
  overflow: hidden !important;
}

.modal {
  height: 100vh !important;
  overflow: hidden !important;
}

.modal-body {
  overflow: hidden !important;
}