@import "tailwindcss";
@import "tw-animate-css";
@import "shadcn/tailwind.css";

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

@theme inline {
  /* === Editorial Design System Colors === */
  --color-primary: #00193c;
  --color-on-primary: #ffffff;
  --color-primary-container: #002d62;
  --color-on-primary-container: #7796d1;
  --color-primary-fixed: #d7e2ff;
  --color-primary-fixed-dim: #abc7ff;
  --color-on-primary-fixed: #001b3f;
  --color-on-primary-fixed-variant: #24467c;

  --color-secondary: #50606f;
  --color-on-secondary: #ffffff;
  --color-secondary-container: #d1e1f4;
  --color-on-secondary-container: #556474;
  --color-secondary-fixed: #d4e4f6;
  --color-secondary-fixed-dim: #b8c8da;
  --color-on-secondary-fixed: #0d1d2a;
  --color-on-secondary-fixed-variant: #394857;

  --color-tertiary: #001d3a;
  --color-on-tertiary: #ffffff;
  --color-tertiary-container: #003461;
  --color-on-tertiary-container: #5b9bd5;
  --color-tertiary-fixed: #a8c8f0;
  --color-tertiary-fixed-dim: #6fa3de;
  --color-on-tertiary-fixed: #002444;
  --color-on-tertiary-fixed-variant: #1a5a96;

  --color-surface: #f8f9fa;
  --color-surface-bright: #f8f9fa;
  --color-surface-dim: #d9dadb;
  --color-surface-container-lowest: #ffffff;
  --color-surface-container-low: #f3f4f5;
  --color-surface-container: #edeeef;
  --color-surface-container-high: #e7e8e9;
  --color-surface-container-highest: #e1e3e4;
  --color-surface-variant: #e1e3e4;
  --color-surface-tint: #3e5e95;

  --color-on-surface: #191c1d;
  --color-on-surface-variant: #43474f;
  --color-on-background: #191c1d;
  --color-background: #f8f9fa;

  --color-outline: #747781;
  --color-outline-variant: #c4c6d1;

  --color-error: #ba1a1a;
  --color-on-error: #ffffff;
  --color-error-container: #ffdad6;
  --color-on-error-container: #93000a;

  --color-inverse-surface: #2e3132;
  --color-inverse-on-surface: #f0f1f2;
  --color-inverse-primary: #abc7ff;

  /* === Font Families === */
  --font-sans: var(--font-manrope), var(--font-ibm-plex-sans-kr), system-ui, -apple-system, sans-serif;
  --font-serif: var(--font-ibm-plex-sans-kr), system-ui, sans-serif;
  --font-headline: var(--font-manrope), var(--font-ibm-plex-sans-kr), system-ui, -apple-system, sans-serif;
  --font-body: var(--font-ibm-plex-sans-kr), system-ui, sans-serif;
  --font-label: var(--font-manrope), var(--font-ibm-plex-sans-kr), system-ui, -apple-system, sans-serif;

  /* === Sidebar (Admin) === */
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);

  /* === shadcn Tokens (mapped) === */
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --color-foreground: var(--foreground);

  /* === Border Radius === */
  --radius-sm: calc(var(--radius) * 0.6);
  --radius-md: calc(var(--radius) * 0.8);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) * 1.4);
  --radius-2xl: calc(var(--radius) * 1.8);
  --radius-3xl: calc(var(--radius) * 2.2);
  --radius-4xl: calc(var(--radius) * 2.6);
}

/* === shadcn Variable Mapping to Editorial Palette === */
:root {
  --background: #f8f9fa;
  --foreground: #191c1d;
  --card: #ffffff;
  --card-foreground: #191c1d;
  --popover: #ffffff;
  --popover-foreground: #191c1d;
  --primary: #00193c;
  --primary-foreground: #ffffff;
  --secondary: #e0e7ff;
  --secondary-foreground: #1e293b;
  --muted: #f3f4f5;
  --muted-foreground: #50606f;
  --accent: #edeeef;
  --accent-foreground: #191c1d;
  --destructive: #ba1a1a;
  --border: #c4c6d1;
  --input: #e1e3e4;
  --ring: #00193c;
  --chart-1: #00193c;
  --chart-2: #50606f;
  --chart-3: #5b9bd5;
  --chart-4: #3e5e95;
  --chart-5: #a8c8f0;
  --radius: 0.375rem;
  --sidebar: #f3f4f5;
  --sidebar-foreground: #191c1d;
  --sidebar-primary: #00193c;
  --sidebar-primary-foreground: #ffffff;
  --sidebar-accent: #edeeef;
  --sidebar-accent-foreground: #191c1d;
  --sidebar-border: #c4c6d1;
  --sidebar-ring: #00193c;
}

/* === Base Styles === */
body {
  font-family: var(--font-manrope), var(--font-ibm-plex-sans-kr), system-ui, -apple-system, sans-serif;
  color: #191c1d;
}

::selection {
  background: #a8c8f0;
  color: #002444;
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
  html {
    @apply font-sans;
  }
}

/* === Material Symbols === */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  display: inline-block;
  vertical-align: middle;
  line-height: 1;
}

/* === Editorial Utilities === */
@layer utilities {
  .font-headline {
    font-family: var(--font-manrope), var(--font-ibm-plex-sans-kr), system-ui, -apple-system, sans-serif;
  }
  .font-body-text {
    font-family: var(--font-ibm-plex-sans-kr), system-ui, sans-serif;
  }
  .font-label-text {
    font-family: var(--font-manrope), var(--font-ibm-plex-sans-kr), system-ui, -apple-system, sans-serif;
  }
  .ambient-shadow {
    box-shadow: 0 20px 40px rgba(25, 28, 29, 0.06);
  }
  .glass-nav {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* === Custom Scrollbar === */
* {
  scrollbar-width: thin;
  scrollbar-color: #c4c6d1 transparent;
}

*:hover {
  scrollbar-color: #747781 transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c4c6d1;
  border-radius: 9999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #747781;
  border: 1px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-corner {
  background: transparent;
}
