@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CTS UI System — Shared tokens + base (light mode only)
   Loaded by both public catalog and admin. */

/* Material Symbols — keep icon rendering consistent */
.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
}

:root {
  /* Brand */
  --color-brand-50: #fff7f1;
  --color-brand-100: #ffe7d7;
  --color-brand-200: #FFCBB1;
  --color-brand-400: #FE9A6F;
  --color-brand-500: #fd6919;
  --color-brand-600: #d65208;

  /* Neutrals (warm) */
  --color-neutral-0: #ffffff;
  --color-neutral-50: #faf8f5;
  --color-neutral-100: #f4f1ec;
  --color-neutral-200: #e8e0d7;
  --color-neutral-300: #d5c8bc;
  --color-neutral-600: #65564B;
  --color-neutral-700: #433831;
  --color-neutral-900: #1f1814;

  /* Semantic */
  --color-success-600: #168A4B;
  --color-success-50: #E9F8EF;
  --color-danger-600: #C62828;
  --color-danger-50: #FDECEC;
  --color-warning-700: #B54708;
  --color-warning-50: #FFF4E5;
  --color-info-600: #1D4ED8;
  --color-info-50: #EAF2FF;

  /* Typography */
  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

  /* Primary action color — referência única para todos os elementos interativos */
  --color-primary: var(--color-brand-500);
  --color-primary-dark: var(--color-brand-600);
  --color-primary-light: var(--color-brand-400);
  --color-primary-subtle: var(--color-brand-50);
  --focus-ring-color: rgba(253, 105, 25, 0.22);
  --focus-ring: 0 0 0 3px var(--focus-ring-color);

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  --lh-tight: 1.25;
  --lh-snug: 1.4;
  --lh-base: 1.6;
  --lh-copy-sm: 1.58;
  --lh-copy-md: 1.68;

  /* Letter-spacing (optical refinement) */
  --letter-tight: -0.02em;
  --letter-display: -0.01em;
  --letter-label: 0.06em;
  --letter-caps: 0.12em;

  --fw-300: 300;
  --fw-400: 400;
  --fw-500: 500;
  --fw-600: 600;
  --fw-700: 700;

  /* Surfaces */
  --surface-body: linear-gradient(180deg, #faf8f5 0%, #f3efe9 100%);
  --surface-1: #ffffff;
  --surface-2: #fbfaf8;
  --surface-3: #f2ede6;

  /* Text */
  --text-primary: #4a3f38;
  --text-secondary: #6b5e54;
  --text-muted: #7e7069;
  --text-light: #9a8d84;
  --text-accent: var(--color-brand-600);

  /* Borders */
  --border-strong: rgba(67, 56, 49, 0.14);
  --border-subtle: rgba(67, 56, 49, 0.08);
  --border-accent: rgba(253, 105, 25, 0.24);

  /* Radius */
  --radius-xs: 10px;
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 30px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-1: 0 2px 10px rgba(31, 24, 20, 0.05);
  --shadow-2: 0 12px 30px rgba(31, 24, 20, 0.07);
  --shadow-3: 0 20px 48px rgba(31, 24, 20, 0.1);
  --shadow-hover: 0 20px 25px -5px rgba(31, 24, 20, 0.10), 0 8px 10px -6px rgba(31, 24, 20, 0.04);
  --shadow-surface: 0 6px 20px rgba(31, 24, 20, 0.05);
  --shadow-card: 0 12px 30px rgba(31, 24, 20, 0.06);
  --shadow-card-hover: 0 22px 44px rgba(31, 24, 20, 0.1);
  --shadow-elevated: 0 28px 60px rgba(31, 24, 20, 0.12);
  --shadow-modal: 0 32px 90px rgba(31, 24, 20, 0.18);

  /* Motion (microinteractions) */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-emphasized: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 260ms;
  --dur-4: 320ms;
  --transition-fast: var(--dur-1) var(--ease-standard);
  --transition-normal: var(--dur-2) var(--ease-standard);
  --transition-slow: var(--dur-3) var(--ease-emphasized);
  --transition-bounce: var(--dur-2) var(--ease-bounce);

  /* Microinteraction scale/feedback */
  --scale-press: 0.97;
  --scale-hover: 1.02;
  --lift-hover: -4px;
  --lift-active: -2px;

  /* 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;
  --mobile-gutter: clamp(0.9rem, 4vw, 1.15rem);
  --touch-target-min: 44px;

  /* Layout */
  --content-max: 1240px;

  /* Back-compat aliases */
  --brand-orange: var(--color-brand-500);
  --brand-orange-light: var(--color-brand-400);
  --brand-orange-dark: var(--color-brand-600);

  --off-white: var(--color-neutral-100);
  --warm-neutral: var(--color-neutral-300);
  --warm-neutral-light: var(--color-neutral-200);

  --accent-color: #8C7D72;
  --accent-muted: #B0A49B;
  --accent-strip: var(--color-neutral-100);

  --background-body: var(--surface-body);
  --surface-white: var(--surface-1);
  --surface-sidebar: var(--surface-1);
  --surface-hover: var(--surface-3);
  --surface-card: var(--surface-1);

  --border-color: var(--border-strong);

  --shadow-sm: var(--shadow-1);
  --shadow-md: var(--shadow-2);
  --shadow-lg: var(--shadow-3);

  /* Text overlay (contrast for text on images) */
  --overlay-gradient: linear-gradient(to top, rgb(28 20 16 / 0.72) 0%, rgb(28 20 16 / 0.40) 45%, rgb(28 20 16 / 0.15) 75%, transparent 100%);
  --overlay-gradient-hover: linear-gradient(to top, rgb(28 20 16 / 0.85) 0%, rgb(28 20 16 / 0.50) 50%, rgb(28 20 16 / 0.20) 75%, transparent 100%);
  --text-shadow-overlay: 0 1px 3px rgb(28 20 16 / 0.50), 0 2px 6px rgb(28 20 16 / 0.35);
  --text-shadow-overlay-strong: 0 2px 4px rgb(28 20 16 / 0.60), 0 4px 8px rgb(28 20 16 / 0.40);
  --text-overlay-color: #ffffff;

  /* Admin tokens */
  --admin-primary: var(--color-brand-500);
  --admin-primary-dark: var(--color-brand-600);
  --admin-bg: #f7f4ef;
  --admin-surface: #ffffff;
  --admin-surface-2: #fbfaf8;
  --admin-border: rgba(67, 56, 49, 0.12);
  --admin-text: var(--text-primary);
  --admin-text-muted: var(--text-muted);
  --admin-error: #c62828;
  --admin-form-gap: 1.1rem;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background: var(--surface-body);
  color: var(--text-primary);
  line-height: var(--lh-base);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

body[data-scroll-locked='true'] {
  overscroll-behavior: none;
}

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

/* Type defaults (can be overridden per page) */
h1 {
  font-size: var(--text-3xl);
  font-weight: var(--fw-500);
  letter-spacing: -0.025em;
  line-height: var(--lh-tight);
}

h2 {
  font-size: var(--text-2xl);
  font-weight: var(--fw-500);
  letter-spacing: -0.015em;
  line-height: var(--lh-snug);
}

h3 {
  font-size: var(--text-xl);
  font-weight: var(--fw-500);
  letter-spacing: -0.01em;
  line-height: var(--lh-snug);
}

p {
  font-size: var(--text-md);
  line-height: var(--lh-copy-md);
}

strong,
b {
  font-weight: var(--fw-500);
}

small {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--lh-copy-sm);
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.75em;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  background: var(--surface-2);
  color: var(--text-secondary);
}

/* Focus — anel de foco consistente em todos os elementos interativos */
:where(a, button, input, select, textarea, [role="button"], [tabindex]):focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* Utility: hidden element (replaces inline style="display:none;") */
.hidden {
  display: none !important;
}

/* Screen-reader only */
.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;
}

/* Generic toast (used by public + admin) */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(14px) scale(0.98);
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  color: #fff;
  font-weight: 400;
  font-size: 0.95rem;
  z-index: 11000;
  opacity: 0;
  transition: transform var(--dur-2) var(--ease-emphasized), opacity var(--dur-1) var(--ease-standard);
  box-shadow: var(--shadow-3);
  max-width: min(560px, calc(100vw - 2rem));
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.toast.success {
  background: var(--color-success-600);
}

.toast.error {
  background: var(--color-danger-600);
}