/**
 * Waggy Pet Shop - Core Theme CSS
 * Design tokens, typography, surfaces, and component utilities
 */

:root {
  --background: #FFFFFF;
  --foreground: #41403E;
  --primary: #71816B;
  --primary-foreground: #FFFFFF;
  --secondary: #F6F1EA;
  --secondary-foreground: #41403E;
  --tertiary: #DEAD6F;
  --tertiary-foreground: #41403E;
  --muted: #F6F1EA;
  --muted-foreground: #736D69;
  --accent: #EFE6D9;
  --accent-foreground: #41403E;
  --card: #FFFFFF;
  --card-foreground: #41403E;
  --destructive: #B64C3B;
  --destructive-foreground: #FFFFFF;
  --border: #E3E2DD;
  --input: #D1CECE;
  --ring: #71816B;
  --radius: 0.75rem;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'DM Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-subtle: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
  --shadow-theme: 0 10px 30px -8px rgba(15, 23, 42, 0.12);
  --shadow-elevated: 0 20px 40px -12px rgba(15, 23, 42, 0.18);

  --primary-text: #5e6f58;
  --secondary-text: #6e6a64;
  --tertiary-text: #966729;
  --accent-text: #736b60;
  --destructive-text: #B64C3B;
}

/* Base resets & typography */
html {
  scroll-behavior: smooth;
  font-family: var(--font-sans);
  color: var(--foreground);
  background-color: var(--background);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6, .font-heading {
  font-family: var(--font-heading);
}

/* Brand Helpers */
.brand-gradient {
  background-image: linear-gradient(135deg, var(--primary), var(--accent));
}

.brand-gradient-warm {
  background-image: linear-gradient(135deg, var(--secondary), var(--accent));
}

.shadow-theme {
  box-shadow: var(--shadow-theme);
}

.shadow-subtle {
  box-shadow: var(--shadow-subtle);
}

.shadow-elevated {
  box-shadow: var(--shadow-elevated);
}

/* Contrast-tuned text utilities */
.text-primary { color: var(--primary-text); }
.text-secondary { color: var(--secondary-text); }
.text-tertiary { color: var(--tertiary-text); }
.text-accent { color: var(--accent-text); }
.text-destructive { color: var(--destructive-text); }

/* Form inputs */
.waggy-input {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background-color: var(--background);
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: var(--foreground);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.waggy-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(113, 129, 107, 0.18);
}

.waggy-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23736D69'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.1rem;
  padding-right: 2.5rem;
}

/* Badge styles */
.badge-bestseller {
  background-color: var(--card);
  color: var(--foreground);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 0.5rem;
}

.badge-discount {
  background-color: var(--tertiary);
  color: var(--tertiary-foreground);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 0.5rem;
}

.badge-new {
  background-color: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 0.5rem;
}

/* Quantity Counter Component */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background-color: var(--background);
  overflow: hidden;
}

.qty-stepper button {
  width: 2.25rem;
  height: 2.5rem;
  background: transparent;
  border: none;
  font-size: 1.1rem;
  color: var(--foreground);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background-color 0.15s;
}

.qty-stepper button:hover {
  background-color: var(--secondary);
}

.qty-stepper input {
  width: 2.75rem;
  height: 2.5rem;
  border: none;
  text-align: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--foreground);
  background: transparent;
  outline: none;
}

/* Toast notifications */
#waggy-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  background-color: var(--foreground);
  color: var(--background);
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-elevated);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  transform: translateY(120%);
  opacity: 0;
  pointer-events: none;
}

#waggy-toast.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* Slide-out Cart Drawer */
#cart-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#cart-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

#cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 440px;
  background: var(--background);
  z-index: 9001;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-elevated);
}

#cart-drawer.open {
  transform: translateX(0);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--secondary);
}
::-webkit-scrollbar-thumb {
  background: #cbd0c8;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}
