/* See the Tailwind configuration guide for advanced usage
   https://tailwindcss.com/docs/configuration */

@import "tailwindcss" source(none);
@source "../css";
@source "../js";
@source "../../lib/simpleshop_theme_web";

/* A Tailwind plugin that makes "hero-#{ICON}" classes available.
   The heroicons installation itself is managed by your mix.exs */
@plugin "../vendor/heroicons";

/* daisyUI Tailwind Plugin. You can update this file by fetching the latest version with:
   curl -sLO https://github.com/saadeghi/daisyui/releases/latest/download/daisyui.js
   Make sure to look at the daisyUI changelog: https://daisyui.com/docs/changelog/ */
@plugin "../vendor/daisyui" {
  themes: false;
}

/* daisyUI theme plugin. You can update this file by fetching the latest version with:
  curl -sLO https://github.com/saadeghi/daisyui/releases/latest/download/daisyui-theme.js
  We ship with two themes, a light one inspired on Phoenix colors and a dark one inspired
  on Elixir colors. Build your own at: https://daisyui.com/theme-generator/ */
@plugin "../vendor/daisyui-theme" {
  name: "dark";
  default: false;
  prefersdark: true;
  color-scheme: "dark";
  --color-base-100: oklch(30.33% 0.016 252.42);
  --color-base-200: oklch(25.26% 0.014 253.1);
  --color-base-300: oklch(20.15% 0.012 254.09);
  --color-base-content: oklch(97.807% 0.029 256.847);
  --color-primary: oklch(58% 0.233 277.117);
  --color-primary-content: oklch(96% 0.018 272.314);
  --color-secondary: oklch(58% 0.233 277.117);
  --color-secondary-content: oklch(96% 0.018 272.314);
  --color-accent: oklch(60% 0.25 292.717);
  --color-accent-content: oklch(96% 0.016 293.756);
  --color-neutral: oklch(37% 0.044 257.287);
  --color-neutral-content: oklch(98% 0.003 247.858);
  --color-info: oklch(58% 0.158 241.966);
  --color-info-content: oklch(97% 0.013 236.62);
  --color-success: oklch(60% 0.118 184.704);
  --color-success-content: oklch(98% 0.014 180.72);
  --color-warning: oklch(66% 0.179 58.318);
  --color-warning-content: oklch(98% 0.022 95.277);
  --color-error: oklch(58% 0.253 17.585);
  --color-error-content: oklch(96% 0.015 12.422);
  --radius-selector: 0.25rem;
  --radius-field: 0.25rem;
  --radius-box: 0.5rem;
  --size-selector: 0.21875rem;
  --size-field: 0.21875rem;
  --border: 1.5px;
  --depth: 1;
  --noise: 0;
}

@plugin "../vendor/daisyui-theme" {
  name: "light";
  default: true;
  prefersdark: false;
  color-scheme: "light";
  --color-base-100: oklch(98% 0 0);
  --color-base-200: oklch(96% 0.001 286.375);
  --color-base-300: oklch(92% 0.004 286.32);
  --color-base-content: oklch(21% 0.006 285.885);
  --color-primary: oklch(70% 0.213 47.604);
  --color-primary-content: oklch(98% 0.016 73.684);
  --color-secondary: oklch(55% 0.027 264.364);
  --color-secondary-content: oklch(98% 0.002 247.839);
  --color-accent: oklch(0% 0 0);
  --color-accent-content: oklch(100% 0 0);
  --color-neutral: oklch(44% 0.017 285.786);
  --color-neutral-content: oklch(98% 0 0);
  --color-info: oklch(62% 0.214 259.815);
  --color-info-content: oklch(97% 0.014 254.604);
  --color-success: oklch(70% 0.14 182.503);
  --color-success-content: oklch(98% 0.014 180.72);
  --color-warning: oklch(66% 0.179 58.318);
  --color-warning-content: oklch(98% 0.022 95.277);
  --color-error: oklch(58% 0.253 17.585);
  --color-error-content: oklch(96% 0.015 12.422);
  --radius-selector: 0.25rem;
  --radius-field: 0.25rem;
  --radius-box: 0.5rem;
  --size-selector: 0.21875rem;
  --size-field: 0.21875rem;
  --border: 1.5px;
  --depth: 1;
  --noise: 0;
}

/* Add variants based on LiveView classes */
@custom-variant phx-click-loading (.phx-click-loading&, .phx-click-loading &);
@custom-variant phx-submit-loading (.phx-submit-loading&, .phx-submit-loading &);
@custom-variant phx-change-loading (.phx-change-loading&, .phx-change-loading &);

/* Use the data attribute for dark mode  */
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));

/* Make LiveView wrapper divs transparent for layout */
[data-phx-session], [data-phx-teleported-src] { display: contents }

/* Theme CSS - Layer 1: Primitives (fixed CSS variables) */
@import "./theme-primitives.css";

/* Theme CSS - Layer 2: Attribute-based theme tokens */
@import "./theme-layer2-attributes.css";

/* Theme CSS - Layer 3: Semantic aliases */
@import "./theme-semantic.css";

/* This file is for your main application CSS */

/* Cart drawer open state styles */
.cart-drawer.open {
  right: 0 !important;
}

.cart-drawer-overlay.open {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Product gallery thumbnail styles */
.pdp-thumbnail {
  border: 2px solid var(--t-border-default);
  transition: border-color 0.15s ease;
}

.pdp-thumbnail-active {
  border-color: hsl(var(--t-accent-h) var(--t-accent-s) var(--t-accent-l));
}

/* =============================================
   THEME EDITOR ONLY: .preview-frame CSS variable switching
   These rules enable live theme switching in the editor.
   Shop pages get CSS variables inline from CSSGenerator.
   ============================================= */

.preview-frame {
  /* Mood - Default (Neutral) */
  --t-surface-base: #ffffff;
  --t-surface-raised: #ffffff;
  --t-surface-sunken: #f5f5f5;
  --t-surface-overlay: rgba(255, 255, 255, 0.95);
  --t-text-primary: #171717;
  --t-text-secondary: #525252;
  --t-text-tertiary: #a3a3a3;
  --t-text-inverse: #ffffff;
  --t-border-default: #e5e5e5;
  --t-border-subtle: #f0f0f0;

  /* Typography - Default (Clean) */
  --t-font-heading: var(--p-font-manrope);
  --t-font-body: var(--p-font-inter);
  --t-heading-weight: 600;
  --t-heading-tracking: -0.02em;

  /* Shape - Default (Soft) */
  --t-radius-sm: var(--p-radius-sm);
  --t-radius-md: var(--p-radius-md);
  --t-radius-lg: var(--p-radius-lg);
  --t-radius-button: var(--p-radius-md);
  --t-radius-card: var(--p-radius-lg);
  --t-radius-input: var(--p-radius-md);
  --t-radius-image: var(--p-radius-md);

  /* Density - Default (Balanced) */
  --t-density: 1;
  --space-xs: calc(var(--p-space-2) * var(--t-density));
  --space-sm: calc(var(--p-space-3) * var(--t-density));
  --space-md: calc(var(--p-space-4) * var(--t-density));
  --space-lg: calc(var(--p-space-6) * var(--t-density));
  --space-xl: calc(var(--p-space-8) * var(--t-density));
  --space-2xl: calc(var(--p-space-12) * var(--t-density));

  /* Mood Variants */
  &[data-mood="warm"] {
    --t-surface-base: #fdf8f3;
    --t-surface-raised: #fffcf8;
    --t-surface-sunken: #f5ebe0;
    --t-text-primary: #1c1917;
    --t-text-secondary: #57534e;
    --t-text-tertiary: #a8a29e;
    --t-border-default: #e7e0d8;
    --t-border-subtle: #f0ebe4;
  }

  &[data-mood="cool"] {
    --t-surface-base: #f4f7fb;
    --t-surface-raised: #f8fafc;
    --t-surface-sunken: #e8eff7;
    --t-text-primary: #0f172a;
    --t-text-secondary: #475569;
    --t-text-tertiary: #94a3b8;
    --t-border-default: #d4dce8;
    --t-border-subtle: #e8eff5;
  }

  &[data-mood="dark"] {
    --t-surface-base: #0a0a0a;
    --t-surface-raised: #171717;
    --t-surface-sunken: #000000;
    --t-surface-overlay: rgba(23, 23, 23, 0.95);
    --t-text-primary: #fafafa;
    --t-text-secondary: #a3a3a3;
    --t-text-tertiary: #737373;
    --t-text-inverse: #171717;
    --t-border-default: #262626;
    --t-border-subtle: #1c1c1c;
    --p-shadow-strength: 0.25;
  }

  /* Typography Variants */
  &[data-typography="editorial"] {
    --t-font-heading: var(--p-font-playfair);
    --t-font-body: var(--p-font-raleway);
    --t-heading-weight: 500;
    --t-heading-tracking: -0.01em;
  }

  &[data-typography="modern"] {
    --t-font-heading: var(--p-font-space);
    --t-font-body: var(--p-font-inter);
    --t-heading-weight: 500;
    --t-heading-tracking: -0.03em;
  }

  &[data-typography="classic"] {
    --t-font-heading: var(--p-font-cormorant);
    --t-font-body: var(--p-font-source-serif);
    --t-heading-weight: 500;
    --t-heading-tracking: 0;
  }

  &[data-typography="friendly"] {
    --t-font-heading: var(--p-font-fraunces);
    --t-font-body: var(--p-font-work-sans);
    --t-heading-weight: 600;
    --t-heading-tracking: -0.01em;
  }

  &[data-typography="minimal"] {
    --t-font-heading: var(--p-font-dm-sans);
    --t-font-body: var(--p-font-source-serif);
    --t-heading-weight: 500;
    --t-heading-tracking: 0;
  }

  &[data-typography="impulse"] {
    --t-font-heading: var(--p-font-raleway);
    --t-font-body: var(--p-font-inter);
    --t-heading-weight: 300;
    --t-heading-tracking: 0.02em;
  }

  /* Shape Variants */
  &[data-shape="sharp"] {
    --t-radius-sm: 0;
    --t-radius-md: 0;
    --t-radius-lg: 0;
    --t-radius-button: 0;
    --t-radius-card: 0;
    --t-radius-input: 0;
    --t-radius-image: 0;
  }

  &[data-shape="round"] {
    --t-radius-sm: var(--p-radius-md);
    --t-radius-md: var(--p-radius-lg);
    --t-radius-lg: var(--p-radius-xl);
    --t-radius-button: var(--p-radius-lg);
    --t-radius-card: var(--p-radius-xl);
    --t-radius-input: var(--p-radius-lg);
    --t-radius-image: var(--p-radius-lg);
  }

  &[data-shape="pill"] {
    --t-radius-sm: var(--p-radius-full);
    --t-radius-md: var(--p-radius-full);
    --t-radius-lg: var(--p-radius-xl);
    --t-radius-button: var(--p-radius-full);
    --t-radius-card: var(--p-radius-xl);
    --t-radius-input: var(--p-radius-full);
    --t-radius-image: var(--p-radius-lg);
  }

  /* Density Variants */
  &[data-density="spacious"] {
    --t-density: 1.25;
  }

  &[data-density="compact"] {
    --t-density: 0.85;
  }
}
