@import "tailwindcss";
@import "tw-animate-css";

@source "..";

@custom-variant dark (&:is(.dark *));

:root {
    --background: oklch(1 0 0);
    --foreground: oklch(0.145 0 0);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.145 0 0);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.145 0 0);
    --primary: oklch(0.205 0 0);
    --primary-foreground: oklch(0.985 0 0);
    --secondary: oklch(0.97 0 0);
    --secondary-foreground: oklch(0.205 0 0);
    --muted: oklch(0.97 0 0);
    --muted-foreground: oklch(0.556 0 0);
    --accent: oklch(0.97 0 0);
    --accent-foreground: oklch(0.205 0 0);
    --destructive: oklch(0.577 0.245 27.325);
    --destructive-foreground: oklch(0.577 0.245 27.325);
    --border: oklch(0.922 0 0);
    --input: oklch(0.922 0 0);
    --ring: oklch(0.708 0 0);
    --chart-1: oklch(0.646 0.222 41.116);
    --chart-2: oklch(0.6 0.118 184.704);
    --chart-3: oklch(0.398 0.07 227.392);
    --chart-4: oklch(0.828 0.189 84.429);
    --chart-5: oklch(0.769 0.188 70.08);
    --radius: 0.625rem;
    --sidebar: oklch(0.985 0 0);
    --sidebar-foreground: oklch(0.145 0 0);
    --sidebar-primary: oklch(0.205 0 0);
    --sidebar-primary-foreground: oklch(0.985 0 0);
    --sidebar-accent: oklch(0.97 0 0);
    --sidebar-accent-foreground: oklch(0.205 0 0);
    --sidebar-border: oklch(0.922 0 0);
    --sidebar-ring: oklch(0.708 0 0);

    /* ── Customer shop ("v2") design tokens ──────────────────────────────
       Defined globally (NOT scoped to .kc-shop) so they survive the
       retirement of shop-theme.css AND resolve inside portaled Sheets/
       Dialogs that escape the .kc-shop subtree. The per-store accent
       (--kc-accent) is overridden at runtime on :root by
       contact-page-layout.tsx; these are the design-green fallbacks. */
    --bg-dark: #12110F;
    --bg-dark-card: #1A1916;
    --bg-light: #F7F4ED;
    --bg-light-alt: #EDEAE2;
    --bg-light-card: #FFFFFF;
    --text-dark: #1C1A17;
    --text-mid: #5C5850;
    --text-light: #74706A;
    --text-on-dark: #FFFFFF;
    --text-on-dark-secondary: #A8A49C;
    --status-green: #198545;      /* open/success DOT + paid check — fixed semantic green, never the store accent */
    --status-rust: #B4503C;       /* cancelled/expired DOT + closed */
    --status-rust-ink: #8C3A29;   /* cancelled/expired TEXT (darker) */
    --status-amber-bg: rgba(212, 160, 23, 0.15);
    --status-amber-ink: #8A6A0E;
    --status-amber-dot: #D4A017;
    --status-info-bg: rgba(59, 130, 246, 0.12);
    --status-info-ink: #1D4ED8;
    --status-info-dot: #3B82F6;
    --wa-green: #1FB155;          /* WhatsApp brand — card + continue CTA */
    --wa-green-bright: #25D366;   /* WhatsApp brand — login-gate button */
    --hairline: rgba(60, 55, 45, 0.08);
    --hairline-soft: rgba(60, 55, 45, 0.06);
    --hairline-strong: rgba(60, 55, 45, 0.10);
    /* skeleton fill — warm ink alpha so it reads on BOTH the cream page
       background and white cards (the shadcn bg-accent is near-white and
       vanishes on --bg-light) */
    --skeleton: rgba(60, 55, 45, 0.08);
    --font-heading: 'Cabinet Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Graphik', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono-shop: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    /* per-store accent (runtime-overridden on :root by contact-page-layout) */
    --kc-accent: #198545;
    --kc-accent-hover: #157239;
}

.dark {
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.145 0 0);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.145 0 0);
    --popover-foreground: oklch(0.985 0 0);
    --primary: oklch(0.985 0 0);
    --primary-foreground: oklch(0.205 0 0);
    --secondary: oklch(0.269 0 0);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.396 0.141 25.723);
    --destructive-foreground: oklch(0.637 0.237 25.331);
    --border: oklch(0.269 0 0);
    --input: oklch(0.269 0 0);
    --ring: oklch(0.439 0 0);
    --chart-1: oklch(0.488 0.243 264.376);
    --chart-2: oklch(0.696 0.17 162.48);
    --chart-3: oklch(0.769 0.188 70.08);
    --chart-4: oklch(0.627 0.265 303.9);
    --chart-5: oklch(0.645 0.246 16.439);
    --sidebar: oklch(0.205 0 0);
    --sidebar-foreground: oklch(0.985 0 0);
    --sidebar-primary: oklch(0.488 0.243 264.376);
    --sidebar-primary-foreground: oklch(0.985 0 0);
    --sidebar-accent: oklch(0.269 0 0);
    --sidebar-accent-foreground: oklch(0.985 0 0);
    --sidebar-border: oklch(0.269 0 0);
    --sidebar-ring: oklch(0.439 0 0);
}

@theme inline {
    --color-background: var(--background);
    --color-foreground: var(--foreground);
    --color-card: var(--card);
    --color-card-foreground: var(--card-foreground);
    --color-popover: var(--popover);
    --color-popover-foreground: var(--popover-foreground);
    --color-primary: var(--primary);
    --color-primary-foreground: var(--primary-foreground);
    --color-secondary: var(--secondary);
    --color-secondary-foreground: var(--secondary-foreground);
    --color-muted: var(--muted);
    --color-muted-foreground: var(--muted-foreground);
    --color-accent: var(--accent);
    --color-accent-foreground: var(--accent-foreground);
    --color-destructive: var(--destructive);
    --color-destructive-foreground: var(--destructive-foreground);
    --color-border: var(--border);
    --color-input: var(--input);
    --color-ring: var(--ring);
    --color-chart-1: var(--chart-1);
    --color-chart-2: var(--chart-2);
    --color-chart-3: var(--chart-3);
    --color-chart-4: var(--chart-4);
    --color-chart-5: var(--chart-5);
    --radius-sm: calc(var(--radius) - 4px);
    --radius-md: calc(var(--radius) - 2px);
    --radius-lg: var(--radius);
    --radius-xl: calc(var(--radius) + 4px);
    --color-sidebar: var(--sidebar);
    --color-sidebar-foreground: var(--sidebar-foreground);
    --color-sidebar-primary: var(--sidebar-primary);
    --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
    --color-sidebar-accent: var(--sidebar-accent);
    --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
    --color-sidebar-border: var(--sidebar-border);
    --color-sidebar-ring: var(--sidebar-ring);
}

/* Customer shop ("v2") Tailwind tokens — map the :root design vars to
   utilities. `inline` so values resolve against the live :root vars
   (incl. the runtime per-store --kc-accent and inside portals). Generates
   bg-/text-/border- utilities, e.g. bg-surface-card, text-ink-mid,
   border-hairline, bg-brand, text-brand, bg-brand-tint-12, font-heading. */
@theme inline {
    --color-night: var(--bg-dark);
    --color-night-card: var(--bg-dark-card);
    --color-surface: var(--bg-light);
    --color-surface-alt: var(--bg-light-alt);
    --color-surface-card: var(--bg-light-card);
    --color-ink: var(--text-dark);
    --color-ink-mid: var(--text-mid);
    --color-ink-soft: var(--text-light);
    --color-ink-on-dark: var(--text-on-dark);
    --color-ink-on-dark-soft: var(--text-on-dark-secondary);
    --color-success: var(--status-green);
    --color-rust: var(--status-rust);
    --color-rust-ink: var(--status-rust-ink);
    --color-amber-bg: var(--status-amber-bg);
    --color-amber-ink: var(--status-amber-ink);
    --color-amber-dot: var(--status-amber-dot);
    --color-info-bg: var(--status-info-bg);
    --color-info-ink: var(--status-info-ink);
    --color-info-dot: var(--status-info-dot);
    --color-wa: var(--wa-green);
    --color-wa-bright: var(--wa-green-bright);
    --color-hairline: var(--hairline);
    --color-hairline-soft: var(--hairline-soft);
    --color-hairline-strong: var(--hairline-strong);
    --color-skeleton: var(--skeleton);
    /* runtime per-store accent + accent-derived tints (D1: derive so non-green stores theme) */
    --color-brand: var(--kc-accent);
    --color-brand-hover: var(--kc-accent-hover);
    --color-brand-tint-05: color-mix(in srgb, var(--kc-accent) 5%, transparent);
    --color-brand-tint-08: color-mix(in srgb, var(--kc-accent) 8%, transparent);
    --color-brand-tint-10: color-mix(in srgb, var(--kc-accent) 10%, transparent);
    --color-brand-tint-12: color-mix(in srgb, var(--kc-accent) 12%, transparent);
    --color-brand-tint-15: color-mix(in srgb, var(--kc-accent) 15%, transparent);
    --color-brand-tint-16: color-mix(in srgb, var(--kc-accent) 16%, transparent);
    --font-heading: var(--font-heading);
    --font-body: var(--font-body);
    --font-mono-shop: var(--font-mono-shop);
}

@layer base {
    * {
        @apply border-border outline-ring/50;
    }
    body {
        @apply bg-background text-foreground;
    }
    .max-lines-3 {
      overflow: hidden;
      display: -webkit-box;
      -webkit-line-clamp: 3; /* number of lines to show */
      line-clamp: 3;
      -webkit-box-orient: vertical;
    }
}

/* Shop query-state transition: a resolved state (list or empty) entering
   where skeletons just were. One shared fade-up so skeleton→empty and
   skeleton→list read as the same system instead of an abrupt swap. */
@keyframes kc-state-enter {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.kc-state-enter {
    animation: kc-state-enter 200ms ease-out both;
}

@media (prefers-reduced-motion: reduce) {
    .kc-state-enter {
        animation: none;
    }
}
