@import "tailwindcss" source(none);
@source "../src";
@import "tw-animate-css";

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

/*
 * Tienda Ágil — Design System
 *
 * The @theme inline block maps CSS custom properties to Tailwind utility
 * classes (e.g. --color-primary -> bg-primary, text-primary).
 *
 * The :root and .dark blocks define the actual color values using oklch.
 * The brand palette is "fresh market": vibrant emerald + warm amber accent,
 * for an appetizing, energetic feel that fits a grocery/minimarket POS.
 *
 * To add a new semantic color:
 * 1. Add the variable to :root (light value) and .dark (dark value)
 * 2. Register it in @theme inline as --color-<name>: var(--<name>)
 */

@theme inline {
  --font-sans:
    "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --radius-2xl: calc(var(--radius) + 8px);
  --radius-3xl: calc(var(--radius) + 12px);
  --radius-4xl: calc(var(--radius) + 16px);

  --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-success: var(--success);
  --color-success-foreground: var(--success-foreground);
  --color-warm: var(--warm);
  --color-warm-foreground: var(--warm-foreground);
  --color-info: var(--info);
  --color-info-foreground: var(--info-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-ring-offset-background: var(--background);
  --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);
  --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);

  --animate-pop-in: pop-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
  --animate-fade-up: fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  --animate-shimmer: shimmer 1.6s linear infinite;
}

:root {
  --radius: 1rem;

  --background: oklch(0.984 0.008 158);
  --foreground: oklch(0.26 0.03 160);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.26 0.03 160);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.26 0.03 160);

  --primary: oklch(0.585 0.152 156.4);
  --primary-foreground: oklch(0.99 0.01 150);
  --secondary: oklch(0.962 0.022 158);
  --secondary-foreground: oklch(0.34 0.06 160);
  --muted: oklch(0.958 0.013 158);
  --muted-foreground: oklch(0.52 0.03 160);
  --accent: oklch(0.95 0.03 159);
  --accent-foreground: oklch(0.34 0.06 160);

  --destructive: oklch(0.6 0.224 24.5);
  --destructive-foreground: oklch(0.99 0.01 90);
  --success: oklch(0.62 0.16 156);
  --success-foreground: oklch(0.99 0.01 150);
  --warm: oklch(0.74 0.155 64);
  --warm-foreground: oklch(0.28 0.05 60);
  --info: oklch(0.62 0.13 232);
  --info-foreground: oklch(0.99 0.01 230);

  --border: oklch(0.912 0.022 158);
  --input: oklch(0.912 0.022 158);
  --ring: oklch(0.585 0.152 156.4);

  --chart-1: oklch(0.585 0.152 156.4);
  --chart-2: oklch(0.72 0.15 168);
  --chart-3: oklch(0.74 0.155 64);
  --chart-4: oklch(0.66 0.16 36);
  --chart-5: oklch(0.62 0.13 232);

  /* Brand gradient stops + soft shadows (used by utility classes below). */
  --brand-from: oklch(0.6 0.16 156);
  --brand-to: oklch(0.72 0.15 172);
  --shadow-color: 150 35% 18%;

  --sidebar: oklch(0.255 0.045 162);
  --sidebar-foreground: oklch(0.94 0.02 160);
  --sidebar-primary: oklch(0.62 0.16 156);
  --sidebar-primary-foreground: oklch(0.99 0.01 150);
  --sidebar-accent: oklch(0.33 0.05 162);
  --sidebar-accent-foreground: oklch(0.97 0.015 160);
  --sidebar-border: oklch(0.4 0.04 162 / 35%);
  --sidebar-ring: oklch(0.62 0.16 156);
}

.dark {
  --background: oklch(0.17 0.018 162);
  --foreground: oklch(0.95 0.012 160);
  --card: oklch(0.215 0.024 162);
  --card-foreground: oklch(0.95 0.012 160);
  --popover: oklch(0.215 0.024 162);
  --popover-foreground: oklch(0.95 0.012 160);

  --primary: oklch(0.7 0.16 156);
  --primary-foreground: oklch(0.16 0.03 160);
  --secondary: oklch(0.27 0.03 162);
  --secondary-foreground: oklch(0.95 0.012 160);
  --muted: oklch(0.27 0.03 162);
  --muted-foreground: oklch(0.72 0.025 160);
  --accent: oklch(0.3 0.035 162);
  --accent-foreground: oklch(0.96 0.012 160);

  --destructive: oklch(0.66 0.2 24);
  --destructive-foreground: oklch(0.99 0.01 90);
  --success: oklch(0.7 0.16 156);
  --success-foreground: oklch(0.16 0.03 160);
  --warm: oklch(0.78 0.15 64);
  --warm-foreground: oklch(0.22 0.05 60);
  --info: oklch(0.7 0.12 232);
  --info-foreground: oklch(0.16 0.03 230);

  --border: oklch(1 0 0 / 12%);
  --input: oklch(1 0 0 / 16%);
  --ring: oklch(0.7 0.16 156);

  --chart-1: oklch(0.7 0.16 156);
  --chart-2: oklch(0.76 0.14 172);
  --chart-3: oklch(0.78 0.15 64);
  --chart-4: oklch(0.7 0.16 36);
  --chart-5: oklch(0.7 0.12 232);

  --brand-from: oklch(0.62 0.16 156);
  --brand-to: oklch(0.74 0.15 172);
  --shadow-color: 150 40% 4%;

  --sidebar: oklch(0.2 0.024 162);
  --sidebar-foreground: oklch(0.94 0.02 160);
  --sidebar-primary: oklch(0.7 0.16 156);
  --sidebar-primary-foreground: oklch(0.16 0.03 160);
  --sidebar-accent: oklch(0.28 0.035 162);
  --sidebar-accent-foreground: oklch(0.97 0.015 160);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.7 0.16 156);
}

@layer base {
  * {
    border-color: var(--color-border);
  }

  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    background-color: var(--color-background);
    color: var(--color-foreground);
    font-family: var(--font-sans);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  /* Smooth, non-janky tap targets on mobile. */
  button,
  [role="button"],
  a {
    -webkit-tap-highlight-color: transparent;
  }

  /* Tailwind v4 no longer sets cursor:pointer on buttons — restore it so every
     clickable element shows the hand cursor (disabled stays default). */
  button:not(:disabled),
  [role="button"]:not([aria-disabled="true"]),
  label[for],
  summary {
    cursor: pointer;
  }
}

/* ---------------------------------------------------------------- */
/* Keyframes                                                         */
/* ---------------------------------------------------------------- */
@keyframes pop-in {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(6px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fade-up {
  0% {
    opacity: 0;
    transform: translateY(14px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes float-soft {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes check-pop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes ring-pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.7;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* ---------------------------------------------------------------- */
/* Utilities                                                         */
/* ---------------------------------------------------------------- */
@layer utilities {
  .animate-pop-in {
    animation: pop-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .animate-fade-up {
    animation: fade-up 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .animate-float-soft {
    animation: float-soft 4s ease-in-out infinite;
  }
  .animate-check-pop {
    animation: check-pop 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .animate-ring-pulse {
    animation: ring-pulse 1.1s ease-out forwards;
  }

  /* Staggered entrance helpers */
  .delay-1 {
    animation-delay: 0.05s;
  }
  .delay-2 {
    animation-delay: 0.1s;
  }
  .delay-3 {
    animation-delay: 0.15s;
  }
  .delay-4 {
    animation-delay: 0.2s;
  }
  .delay-5 {
    animation-delay: 0.25s;
  }

  .bg-brand-gradient {
    background-image: linear-gradient(135deg, var(--brand-from) 0%, var(--brand-to) 100%);
  }
  .bg-brand-radial {
    background-image: radial-gradient(
      120% 120% at 0% 0%,
      var(--brand-from) 0%,
      var(--brand-to) 55%,
      color-mix(in oklch, var(--brand-to), black 22%) 100%
    );
  }
  .text-gradient {
    background-image: linear-gradient(120deg, var(--brand-from), var(--brand-to));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }

  .shadow-card {
    box-shadow:
      0 1px 2px hsl(var(--shadow-color) / 0.05),
      0 8px 24px -14px hsl(var(--shadow-color) / 0.22);
  }
  .shadow-soft {
    box-shadow: 0 14px 44px -18px hsl(var(--shadow-color) / 0.3);
  }
  .shadow-glow {
    box-shadow: 0 12px 34px -12px hsl(var(--shadow-color) / 0.45);
  }

  .pb-safe {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .pt-safe {
    padding-top: env(safe-area-inset-top);
  }
  .h-safe-bottom {
    height: calc(env(safe-area-inset-bottom) + 4.5rem);
  }

  .no-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .no-scrollbar::-webkit-scrollbar {
    display: none;
  }

  .nice-scroll {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in oklch, var(--primary), transparent 70%) transparent;
  }
  .nice-scroll::-webkit-scrollbar {
    width: 0.4rem;
    height: 0.4rem;
  }
  .nice-scroll::-webkit-scrollbar-thumb {
    border-radius: 9999px;
    background: color-mix(in oklch, var(--primary), transparent 70%);
  }
  .nice-scroll::-webkit-scrollbar-track {
    background: transparent;
  }
}

/* ---------------------------------------------------------------- */
/* Print — only the receipt (#receipt-print) is sent to paper        */
/* ---------------------------------------------------------------- */
@media print {
  body * {
    visibility: hidden !important;
  }
  #receipt-print,
  #receipt-print *,
  #ganancias-print,
  #ganancias-print * {
    visibility: visible !important;
  }
  #receipt-print,
  #ganancias-print {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none !important;
  }
}
