/* css/main.css - Modernes Design-System mit Theme Support */

/* ========================================
   CSS VARIABLES & DESIGN TOKENS
   ======================================== */
:root {
  /* Theme-Farben (werden via JavaScript überschrieben) */
  --primary-color: #1a73e8;
  --secondary-color: #f5f5f5;
  --accent-color: #008060;
  --text-on-primary: #ffffff;

  /* Grayscale */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* Shadows (Elevation) */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Spacing Scale */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */

  /* Typography Scale */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */
  --text-4xl: 2.25rem;   /* 36px */

  /* Border Radius */
  --radius-sm: 0.25rem;  /* 4px */
  --radius-md: 0.5rem;   /* 8px */
  --radius-lg: 0.75rem;  /* 12px */
  --radius-xl: 1rem;     /* 16px */
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Font */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  --font-family-display: var(--font-family);
}


/* ========================================
   RESET & BASE
   ======================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  line-height: 1.6;
  color: var(--gray-800);
  background-color: transparent; /* ✅ Transparent für Embed-Mode */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;

  /* Initial verstecken für Theme-Lade-Effekt */
  opacity: 0;
  transition: opacity 0.4s var(--transition-base);
}

body.loaded {
  opacity: 1;
}

/* Standalone-Modus: Weißer Hintergrund */
body.standalone {
  background-color: #ffffff;
}

/* Container transparent halten */
.container,
.products-container,
.main-content {
  background: transparent;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}


/* ========================================
   LOADING SPINNER
   ======================================== */
.loading-spinner {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;

  border: 4px solid var(--gray-200);
  border-top: 4px solid var(--primary-color);
  border-radius: var(--radius-full);
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

body.loaded .loading-spinner {
  display: none;
}


/* ========================================
   CONTAINER
   ======================================== */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-md);
  }
}


/* ========================================
   HEADER - Sticky mit Theme-Farben
   ======================================== */
header {
  background: var(--primary-color);
  color: var(--text-on-primary);
  padding: 12px 48px;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color var(--transition-base);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-lg);
}

/* ✅ Logo Container - nur Logo, kein Text mehr */
.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.verein-logo {
  height: 96px;
  width: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

header nav {
  display: flex;
  gap: var(--space-xl);
  align-items: center;
}

header nav a {
  color: var(--text-on-primary);
  text-decoration: none;
  font-weight: 500;
  font-family: var(--font-family-display);
  font-size: var(--text-xl);
  transition: opacity var(--transition-fast);
  position: relative;
  padding: var(--space-sm) 0;
}

header nav a:hover {
  opacity: 0.8;
}

header nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--text-on-primary);
  transition: width var(--transition-base);
}

header nav a:hover::after {
  width: 100%;
}

header nav a.active::after {
  width: 100%;
  background: var(--text-on-primary);
}

#cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-xs);
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
}


/* ========================================
   EMBED MODE - Header/Footer verstecken
   ======================================== */
body.embed-mode header,
body.embed-mode footer {
  display: none;
}

body.embed-mode main {
  padding-top: var(--space-lg);
  margin-top: 0;
}

body.embed-mode {
  background-color: transparent;
}

/* Mobile: Filter-Buttons und Cart-Button überlappen nicht */
@media (max-width: 768px) {
  body.embed-mode main,
  body.embedded main {
    padding-top: 68px; /* embed-nav cart button: top 16px + ~40px Höhe + Buffer */
  }

  body.embed-mode .filter-buttons,
  body.embedded .filter-buttons {
    padding-right: 80px; /* letzter Filter-Button scrollt nicht hinter Cart-Button */
  }
}


/* ========================================
   MAIN CONTENT
   ======================================== */
main {
  min-height: calc(100vh - 300px);
  padding: var(--space-3xl) 0;
}

main h2 {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: var(--space-xl);
  letter-spacing: -0.02em;
  font-family: var(--font-family-display);
}


/* ========================================
   BUTTONS - Modern mit Invertiertem Hover
   ======================================== */
.btn-primary {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md) var(--space-xl);

  background: var(--primary-color);
  color: var(--text-on-primary);

  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-family-display);
  text-decoration: none;

  border: 2px solid var(--primary-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);

  cursor: pointer;

  transition: all var(--transition-base);
}

/* ✅ Invertierter Hover: Outline-Style für besseren Kontrast */
.btn-primary:hover:not(:disabled) {
  background: transparent; /* Statt Primär auf Primär */
  color: var(--primary-color); /* Text wird zur Primärfarbe */
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  background: var(--gray-300);
  color: var(--gray-500);
  border-color: var(--gray-300);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md) var(--space-xl);

  background: white;
  color: var(--primary-color);

  font-size: var(--text-base);
  font-weight: 600;
  text-decoration: none;

  border: 2px solid var(--primary-color);
  border-radius: var(--radius-md);

  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-secondary:hover {
  background: var(--primary-color);
  color: var(--text-on-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}


/* ========================================
   FILTER BUTTONS
   ======================================== */
.filter-buttons {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-2xl);
}

button[data-collection],
button[data-tag] {
  background: white;
  color: var(--gray-700);

  border: 2px solid var(--gray-300);
  border-radius: var(--radius-lg);

  padding: var(--space-sm) var(--space-lg);
  font-size: var(--text-sm);
  font-weight: 600;

  cursor: pointer;
  transition: all var(--transition-fast);
}

button[data-collection]:hover,
button[data-tag]:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

button[data-collection].active,
button[data-tag].active {
  background: var(--primary-color);
  color: var(--text-on-primary);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-md);
}


/* ========================================
   FORMS
   ======================================== */
label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--gray-700);
}

select,
input[type="number"] {
  width: 100%;
  padding: var(--space-md);

  font-family: inherit;
  font-size: var(--text-base);

  background: white;
  color: var(--gray-800);

  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);

  transition: all var(--transition-fast);
}

select:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

select:disabled,
input[type="number"]:disabled {
  background: var(--gray-100);
  cursor: not-allowed;
}


/* ========================================
   MESSAGES & STATES
   ======================================== */
#loading {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--gray-500);
  font-size: var(--text-lg);
}

.error {
  color: #dc2626;
  font-weight: 600;
}

.error-msg {
  color: #dc2626;
  font-size: var(--text-sm);
  margin-top: var(--space-xs);
  display: none;
}

.success-msg {
  color: #059669;
  font-weight: 600;
  margin-top: var(--space-md);
  padding: var(--space-md);

  background: #d1fae5;
  border-radius: var(--radius-md);
  text-align: center;

  display: none;
}

.success-msg.show {
  display: block;
  animation: slideIn 0.3s var(--transition-base);
}

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


/* ========================================
   PRICE STYLING
   ======================================== */
.price,
.price-large {
  color: var(--gray-900);
  font-weight: 700;
  font-family: var(--font-family-display);
}

.price-large {
  font-size: var(--text-3xl);
  letter-spacing: -0.02em;
}


/* ========================================
   VEREINS-SELECTOR
   ======================================== */
.verein-selector {
  background: var(--gray-100);
  border-left: 4px solid var(--primary-color);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xl);
}


/* ========================================
   FOOTER
   ======================================== */
footer {
  background: var(--gray-900);
  color: white;
  padding: var(--space-3xl) 0;
  margin-top: var(--space-3xl);
  text-align: center;
}

footer p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--gray-400);
}


/* ========================================
   RESPONSIVE - Mobile First
   ======================================== */
@media (max-width: 768px) {
  header {
    padding: 10px 16px;
    min-height: unset;
  }

  header .container {
    flex-direction: row;
    align-items: center;
    gap: var(--space-sm);
  }

  header nav {
    flex-direction: row;
    gap: var(--space-md);
    flex-shrink: 0;
  }

  header nav a {
    font-size: var(--text-sm);
  }

  .verein-logo {
    height: 44px;
  }

  main h2 {
    font-size: var(--text-2xl);
  }

  .filter-buttons {
    justify-content: center;
  }
}


/* ========================================
   UTILITY CLASSES
   ======================================== */
.text-center {
  text-align: center;
}

.mt-4 {
  margin-top: var(--space-xl);
}

.mb-4 {
  margin-bottom: var(--space-xl);
}


/* ========================================
   EMBED-MODE
   ======================================== */
body.embedded header,
body.embedded nav,
body.embedded footer {
  display: none !important;
}
body.embedded {
  background: transparent !important;
  padding-top: 0 !important;
}


/* ========================================
   TOAST NOTIFICATION
   ======================================== */
#added-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-color);
  color: #000000;
  padding: 14px 20px;
  border-radius: 24px;
  z-index: 99999;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  font-family: var(--font-family-display);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}
#added-toast .toast-dismiss {
  background: transparent;
  border: 2px solid rgba(0,0,0,0.25);
  color: #000000;
  padding: 4px 12px;
  border-radius: 24px;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-family);
  transition: background 0.2s;
}
#added-toast .toast-dismiss:hover {
  background: rgba(0,0,0,0.1);
}
#added-toast .toast-cart-link {
  background: #000000;
  color: #ffffff;
  padding: 4px 14px;
  border-radius: 24px;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.2s;
}
#added-toast .toast-cart-link:hover {
  opacity: 0.8;
}

/* ========================================
   FLOATING EMBED NAVIGATION
   ======================================== */
.embed-nav {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  flex-direction: column;
  gap: 8px;
}
body.embedded .embed-nav { display: flex; }
body:not(.embedded) .embed-nav { display: none !important; }
.embed-btn {
  background: var(--primary-color);
  color: #000000;
  border: 2px solid var(--primary-color);
  padding: 10px 24px;
  border-radius: 24px;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.3s ease;
}
.embed-btn:hover {
  opacity: 0.85;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Early embed class (set before CSS renders) */
.embedded-early header,
.embedded-early footer { display: none !important; }


/* ========================================
   FCW INFO POPUP
   ======================================== */
.fcw-popup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: fcwFadeIn 0.25s ease;
}

.fcw-popup-backdrop[hidden] {
  display: none;
}

@keyframes fcwFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fcw-popup {
  background: #ffffff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  animation: fcwSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fcwSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.fcw-popup-header {
  background: var(--primary-color);
  color: var(--text-on-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: var(--text-lg);
}

.fcw-popup-close {
  background: transparent;
  border: none;
  color: var(--text-on-primary);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 var(--space-xs);
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}

.fcw-popup-close:hover {
  opacity: 1;
}

.fcw-popup-body {
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
  text-align: left;
}

.fcw-popup-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  line-height: 1;
  text-align: center;
}

.fcw-popup-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-xs);
  text-align: center;
}

.fcw-popup-date {
  font-family: var(--font-family-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
  text-align: center;
}

.fcw-popup-hint {
  font-size: var(--text-sm);
  color: var(--gray-500);
  line-height: 1.5;
  margin-bottom: var(--space-sm);
}

.fcw-popup-list {
  font-size: var(--text-sm);
  color: var(--gray-500);
  line-height: 1.6;
  padding-left: var(--space-lg);
  margin: 0;
}

.fcw-popup-footer {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.fcw-popup-dismiss {
  max-width: 100%;
}
