/**
 * VinoLoop - Custom Styles
 *
 * Ergänzt Tailwind CSS um markenspezifische Komponenten
 */

/* ==========================================================================
   CSS Custom Properties (Design Tokens)
   ========================================================================== */

:root {
  /* Brand Colors */
  --vl-burgunder: #721B24;
  --vl-magnat-green: #4A6741;
  --vl-kreide: #F5F1E9;
  --vl-raps-yellow: #EBC03F;

  /* Typography */
  --vl-font-sans: 'Inter', 'Manrope', system-ui, -apple-system, sans-serif;
  --vl-font-display: 'Space Grotesk', 'Inter', sans-serif;

  /* Spacing */
  --vl-section-padding: clamp(3rem, 8vw, 6rem);

  /* Transitions */
  --vl-transition-fast: 150ms ease;
  --vl-transition-base: 300ms ease;
  --vl-transition-slow: 500ms ease;

  /* Shadows */
  --vl-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --vl-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --vl-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --vl-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */

html {
  scroll-behavior: smooth;
  font-size: 107%;
}

/* Logo-Größe fixieren (unabhängig von font-size-Skalierung) */
#header-logo {
  height: 64px;
}
@media (min-width: 640px) {
  #header-logo {
    height: 90px;
  }
}

body {
  font-family: var(--vl-font-sans);
  background-color: var(--vl-kreide);
  color: #1f2937;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Selection */
::selection {
  background-color: var(--vl-burgunder);
  color: white;
}

/* Focus States */
:focus-visible {
  outline: 2px solid var(--vl-burgunder);
  outline-offset: 2px;
}

/* ==========================================================================
   Typography
   ========================================================================== */

.font-display {
  font-family: var(--vl-font-display);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.vl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
  border-radius: 9999px;
  transition: all var(--vl-transition-base);
  cursor: pointer;
  border: 2px solid transparent;
}

.vl-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button (Burgunder) */
.vl-btn-primary {
  background-color: var(--vl-burgunder);
  color: white;
  border-color: var(--vl-burgunder);
}

.vl-btn-primary:hover:not(:disabled) {
  background-color: #5B161D;
  border-color: #5B161D;
  transform: translateY(-1px);
  box-shadow: var(--vl-shadow-lg);
}

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

/* Secondary Button (Green) */
.vl-btn-secondary {
  background-color: var(--vl-magnat-green);
  color: white;
  border-color: var(--vl-magnat-green);
}

.vl-btn-secondary:hover:not(:disabled) {
  background-color: #3B5234;
  border-color: #3B5234;
  transform: translateY(-1px);
  box-shadow: var(--vl-shadow-lg);
}

/* Ghost Button (Outline) */
.vl-btn-ghost {
  background-color: transparent;
  color: white;
  border-color: white;
}

.vl-btn-ghost:hover:not(:disabled) {
  background-color: white;
  color: var(--vl-burgunder);
}

/* Ghost on Light Background */
.vl-btn-ghost-dark {
  background-color: transparent;
  color: var(--vl-burgunder);
  border-color: var(--vl-burgunder);
}

.vl-btn-ghost-dark:hover:not(:disabled) {
  background-color: var(--vl-burgunder);
  color: white;
}

/* ==========================================================================
   Cards
   ========================================================================== */

.vl-card {
  background-color: white;
  border-radius: 1rem;
  box-shadow: var(--vl-shadow-sm);
  transition: all var(--vl-transition-base);
}

.vl-card:hover {
  box-shadow: var(--vl-shadow-lg);
  transform: translateY(-2px);
}

/* ==========================================================================
   Click Animation Styles
   ========================================================================== */

.vl-click-moment .vl-click-loading {
  transition: opacity var(--vl-transition-base);
}

.vl-click-moment.is-loaded .vl-click-loading {
  opacity: 0;
  pointer-events: none;
}

.vl-click-moment .vl-scroll-hint {
  transition: opacity var(--vl-transition-base);
}

.vl-click-moment.is-scrolling .vl-scroll-hint {
  opacity: 0;
}

/* Click Particle Effect */
.vl-particle {
  position: fixed;
  pointer-events: none;
  z-index: 100;
  border-radius: 50%;
}

/* ==========================================================================
   Material Story / Ingredients Cloud
   ========================================================================== */

.vl-ingredient {
  transform-origin: center;
}

.vl-ingredient:nth-child(odd) {
  animation-delay: 0.1s;
}

.vl-ingredient:nth-child(even) {
  animation-delay: 0.2s;
}

/* Stagger effect for grid items */
.vl-ingredients-cloud > div > article:nth-child(1) { --delay: 0; }
.vl-ingredients-cloud > div > article:nth-child(2) { --delay: 0.1s; }
.vl-ingredients-cloud > div > article:nth-child(3) { --delay: 0.2s; }
.vl-ingredients-cloud > div > article:nth-child(4) { --delay: 0.3s; }
.vl-ingredients-cloud > div > article:nth-child(5) { --delay: 0.4s; }

/* ==========================================================================
   Trust Badges
   ========================================================================== */

.vl-trust-badges > div {
  transition: all var(--vl-transition-base);
}

.vl-trust-badges > div:hover {
  transform: translateY(-2px);
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

.vl-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #1f2937;
  background-color: white;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  transition: all var(--vl-transition-fast);
}

.vl-input:focus {
  outline: none;
  border-color: var(--vl-burgunder);
  box-shadow: 0 0 0 3px rgba(114, 27, 36, 0.1);
}

.vl-input::placeholder {
  color: #9ca3af;
}

/* Checkbox Custom Style */
input[type="checkbox"].vl-checkbox {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.25rem;
  border: 2px solid #d1d5db;
  cursor: pointer;
  transition: all var(--vl-transition-fast);
}

input[type="checkbox"].vl-checkbox:checked {
  background-color: var(--vl-burgunder);
  border-color: var(--vl-burgunder);
}

/* ==========================================================================
   Checkout Specific
   ========================================================================== */

.vl-checkout-step {
  position: relative;
  padding-left: 3rem;
}

.vl-checkout-step::before {
  content: attr(data-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--vl-burgunder);
  color: white;
  font-weight: 600;
  border-radius: 50%;
}

.vl-checkout-step.is-complete::before {
  content: '✓';
  background-color: var(--vl-magnat-green);
}

/* ==========================================================================
   Configurator
   ========================================================================== */

.vl-configurator-preview {
  position: relative;
  background: white;
}

.vl-configurator-preview .vl-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 300ms ease;
  z-index: 1;
}

.vl-configurator-preview .vl-layer-base   { z-index: 1; }
.vl-configurator-preview .vl-layer-band    { z-index: 2; }
.vl-configurator-preview .vl-layer-stopper { z-index: 3; }

.vl-configurator-preview .vl-layer.is-active {
  display: block !important;
  animation: scaleIn 0.3s ease-out;
}

#layer-placeholder {
  z-index: 0;
  transition: opacity 300ms ease;
}

#layer-placeholder.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.vl-conf-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  border-radius: 0.75rem;
  border: 2px solid transparent;
  background: none;
  cursor: pointer;
  transition: all 150ms ease;
  min-width: 4.5rem;
  overflow: visible;
}

.vl-conf-swatch:hover {
  border-color: #d1d5db;
  background-color: #f9fafb;
}

.vl-conf-swatch.is-selected {
  border-color: var(--vl-burgunder);
  background-color: #fef2f2;
}

.vl-conf-swatch__color {
  display: block;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.vl-conf-swatch:hover .vl-conf-swatch__color {
  transform: scale(1.1);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.vl-conf-swatch.is-selected .vl-conf-swatch__color {
  border-color: var(--vl-burgunder);
  box-shadow: 0 0 0 3px rgba(114, 27, 36, 0.2);
}

.vl-conf-swatch__check {
  display: none;
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  width: 1.25rem;
  height: 1.25rem;
  background-color: var(--vl-burgunder);
  color: white;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}

.vl-conf-swatch.is-selected .vl-conf-swatch__check {
  display: flex;
}

.vl-conf-swatch__label {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.65rem;
  color: #6b7280;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  overflow: visible;
}

.vl-conf-swatch__sublabel {
  display: block;
  font-size: 0.55rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-top: 1px;
  white-space: nowrap;
}

.vl-conf-swatch.is-selected .vl-conf-swatch__label {
  color: var(--vl-burgunder);
  font-weight: 600;
}

#conf-summary .conf-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Individualisierung: Radio-Optionen */
.vl-ind-option input:checked ~ div .w-2\.5 {
  opacity: 1 !important;
}

.vl-ind-option:has(input:checked) {
  border-color: var(--vl-burgunder);
  background-color: rgba(114, 27, 36, 0.03);
}

#conf-summary .conf-line__color {
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  margin-right: 0.5rem;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes clickPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-scale-in {
  animation: scaleIn 0.4s ease-out forwards;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-burgunder { color: var(--vl-burgunder); }
.text-magnat-green { color: var(--vl-magnat-green); }
.text-raps-yellow { color: var(--vl-raps-yellow); }

.bg-burgunder { background-color: var(--vl-burgunder); }
.bg-magnat-green { background-color: var(--vl-magnat-green); }
.bg-kreide { background-color: var(--vl-kreide); }
.bg-raps-yellow { background-color: var(--vl-raps-yellow); }

.border-burgunder { border-color: var(--vl-burgunder); }
.border-magnat-green { border-color: var(--vl-magnat-green); }

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 640px) {
  .vl-btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
  }

  .vl-hero h1 {
    font-size: 2.5rem;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .vl-hero video,
  .vl-click-moment,
  .vl-btn {
    display: none;
  }

  body {
    background: white;
    color: black;
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

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

  html {
    scroll-behavior: auto;
  }
}

/* === Mobile Optimierungen === */
@media (max-width: 640px) {
  /* Swatch-Buttons: bessere Touch-Targets */
  .vl-conf-swatch {
    padding: 0.4rem 0.6rem;
    min-width: 4rem;
  }

  .vl-conf-swatch__color {
    width: 2.5rem;
    height: 2.5rem;
  }

  /* Quantity-Buttons: etwas kompakter */
  .vl-quantity-btn {
    width: 2.5rem;
    height: 2.5rem;
  }

  .vl-quantity-input {
    width: 3rem;
    height: 2.5rem;
  }
}

@media (max-width: 374px) {
  /* Extrem kleine Screens (iPhone SE etc.) */
  .vl-conf-swatch {
    padding: 0.3rem 0.4rem;
    min-width: 3.5rem;
    gap: 0.25rem;
  }

  .vl-conf-swatch__color {
    width: 2rem;
    height: 2rem;
  }

  .vl-conf-swatch__label {
    font-size: 0.55rem;
  }
}

/* Mengen-Input im Warenkorb: Spinner-Buttons ausblenden, Tastatureingabe erlauben */
.vl-item-qty,
.cart-qty-value {
  appearance: textfield;
  -moz-appearance: textfield;
}
.vl-item-qty::-webkit-inner-spin-button,
.vl-item-qty::-webkit-outer-spin-button,
.cart-qty-value::-webkit-inner-spin-button,
.cart-qty-value::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
