/* ==========================================================================
   SHADCN/UI OFFICIAL DESIGN SYSTEM — NEO-EDITORIAL WARM THEME
   Buttercup Yellow (#F6C95A), Cream Paper Cards (#FFFDF8),
   Fraunces Display Serif & Plus Jakarta Sans.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..900;1,9..144,400..800&family=Plus+Jakarta+Sans:ital,wght@0,400..800;1,400..800&display=swap');

:root {
  --background: 43 90% 66%; /* #F6C95A buttercup yellow */
  --foreground: 24 11% 9%;   /* #161413 espresso ink */
  --card: 40 100% 99%;       /* #FFFDF8 warm cream */
  --card-foreground: 24 11% 9%;
  --popover: 40 100% 99%;
  --popover-foreground: 24 11% 9%;
  --primary: 24 11% 9%;      /* deep ink black */
  --primary-foreground: 40 100% 99%;
  --secondary: 40 40% 95%;   /* #FAF6EE */
  --secondary-foreground: 24 11% 9%;
  --muted: 40 25% 92%;
  --muted-foreground: 24 8% 35%; /* #4E463E */
  --accent: 43 85% 65%;
  --accent-foreground: 24 11% 9%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 24 11% 9% / 0.12;
  --input: 24 11% 9% / 0.15;
  --ring: 24 11% 9%;
  --radius: 1rem;

  /* Expressive Chart Palette */
  --chart-1: 142 71% 45%; /* emerald */
  --chart-2: 347 77% 50%; /* coral */
  --chart-3: 217 91% 60%; /* blue */
  --chart-4: 262 83% 58%; /* violet */
  --chart-5: 38 92% 50%;  /* amber */

  /* Sidebar Palette */
  --sidebar-background: 40 100% 99%; /* cream */
  --sidebar-foreground: 24 11% 9%;
  --sidebar-primary: 24 11% 9%;
  --sidebar-primary-foreground: 40 100% 99%;
  --sidebar-accent: 43 90% 66%;     /* butter yellow */
  --sidebar-accent-foreground: 24 11% 9%;
  --sidebar-border: 24 11% 9% / 0.12;
  --sidebar-ring: 24 11% 9%;

  --sidebar-width: 16.5rem;
  --sidebar-width-icon: 3.5rem;
  --header-height: 3.75rem;
}

.dark {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 3.9%;
  --card-foreground: 0 0% 98%;
  --popover: 240 10% 3.9%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;

  --chart-1: 220 70% 50%;
  --chart-2: 160 60% 45%;
  --chart-3: 30 80% 55%;
  --chart-4: 280 65% 60%;
  --chart-5: 340 75% 55%;

  --sidebar-background: 240 5.9% 10%;
  --sidebar-foreground: 240 4.8% 95.9%;
  --sidebar-primary: 224.3 76.3% 48%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 240 3.7% 15.9%;
  --sidebar-accent-foreground: 240 4.8% 95.9%;
  --sidebar-border: 240 3.7% 15.9%;
  --sidebar-ring: 217.2 91.2% 59.8%;
}

*, *::before, *::after {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, [data-slot="card-title"] {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   OFFICIAL COMPONENT SLOTS & CLASSES
   ========================================================================== */

/* Layout / Sidebar Wrapper */
[data-slot="sidebar-wrapper"] {
  display: flex;
  min-height: 100vh;
  width: 100%;
  background-color: hsl(var(--background));
}

[data-slot="sidebar"] {
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  background-color: hsl(var(--sidebar-background));
  color: hsl(var(--sidebar-foreground));
  border-right: 1px solid hsl(var(--sidebar-border));
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 40;
  flex-shrink: 0;
}

[data-slot="sidebar-wrapper"][data-collapsed="true"] [data-slot="sidebar"] {
  width: var(--sidebar-width-icon);
}

[data-slot="sidebar-header"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  border-bottom: 1px solid hsl(var(--sidebar-border));
}

[data-slot="sidebar-content"] {
  display: flex;
  flex-direction: column;
  flex: 1 1 0%;
  min-height: 0;
  gap: 0.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem;
}

[data-slot="sidebar-group"] {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  padding: 0.25rem 0.25rem;
}

[data-slot="sidebar-group-label"] {
  display: flex;
  height: 2rem;
  align-items: center;
  border-radius: calc(var(--radius) - 2px);
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--sidebar-foreground) / 0.65);
  letter-spacing: 0.025em;
  transition: opacity 0.15s ease;
  user-select: none;
}

[data-slot="sidebar-wrapper"][data-collapsed="true"] [data-slot="sidebar-group-label"] {
  opacity: 0;
  pointer-events: none;
  height: 0.5rem;
  overflow: hidden;
}

[data-slot="sidebar-menu"] {
  display: flex;
  width: 100%;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

[data-slot="sidebar-menu-item"] {
  position: relative;
}

[data-slot="sidebar-menu-button"] {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 0.625rem;
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 400;
  color: hsl(var(--sidebar-foreground));
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  outline: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

[data-slot="sidebar-menu-button"]:hover {
  background-color: hsl(var(--sidebar-accent));
  color: hsl(var(--sidebar-accent-foreground));
}

[data-slot="sidebar-menu-button"][data-active="true"] {
  background-color: hsl(var(--sidebar-accent));
  color: hsl(var(--sidebar-accent-foreground));
  font-weight: 500;
}

[data-slot="sidebar-menu-button"] svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

[data-slot="sidebar-wrapper"][data-collapsed="true"] [data-slot="sidebar-menu-button"] span:last-child {
  display: none;
}

[data-slot="sidebar-footer"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid hsl(var(--sidebar-border));
}

[data-slot="sidebar-inset"] {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  flex: 1 1 0%;
  flex-direction: column;
  background-color: hsl(var(--background));
  overflow-y: auto;
}

/* Header */
header[data-slot="header"] {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: var(--header-height);
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
  background-color: hsl(var(--background) / 0.95);
  backdrop-filter: blur(8px);
  padding: 0 1.5rem;
}

/* Cards (Canvas 4 Tactile Brutalist) */
[data-slot="card"] {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border-radius: 1rem;
  border: 2.5px solid #161413;
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  padding: 1.5rem;
  box-shadow: 4px 4px 0px #161413;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

[data-slot="card"]:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px #161413;
}

[data-slot="card-header"] {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.375rem;
}

[data-slot="card-title"] {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

[data-slot="card-description"] {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

[data-slot="card-action"] {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
}

[data-slot="card-content"] {
  padding: 0;
}

[data-slot="card-footer"] {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
}

/* Buttons */
[data-slot="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  outline: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  text-decoration: none;
  height: 2.25rem;
  padding: 0 0.875rem;
}

[data-slot="button"][data-variant="default"] {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

[data-slot="button"][data-variant="default"]:hover {
  background-color: hsl(var(--primary) / 0.9);
}

[data-slot="button"][data-variant="secondary"] {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

[data-slot="button"][data-variant="secondary"]:hover {
  background-color: hsl(var(--secondary) / 0.8);
}

[data-slot="button"][data-variant="outline"] {
  border-color: hsl(var(--border));
  background-color: transparent;
  color: hsl(var(--foreground));
}

[data-slot="button"][data-variant="outline"]:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

[data-slot="button"][data-variant="ghost"] {
  background-color: transparent;
  color: hsl(var(--foreground));
}

[data-slot="button"][data-variant="ghost"]:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

[data-slot="button"][data-size="sm"] {
  height: 2rem;
  padding: 0 0.625rem;
  font-size: 0.8125rem;
}

[data-slot="button"][data-size="icon"] {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}

[data-slot="button"][data-size="icon-sm"] {
  width: 2rem;
  height: 2rem;
  padding: 0;
}

/* Badges */
[data-slot="badge"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  padding: 0.125rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

[data-slot="badge"][data-variant="default"] {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

[data-slot="badge"][data-variant="secondary"] {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

[data-slot="badge"][data-variant="outline"] {
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}

[data-slot="badge"][data-variant="destructive"] {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

[data-slot="badge"][data-variant="success"] {
  background-color: hsl(142 76% 36% / 0.15);
  color: hsl(142 76% 36%);
  border-color: hsl(142 76% 36% / 0.3);
}

.dark [data-slot="badge"][data-variant="success"] {
  background-color: hsl(142 76% 45% / 0.2);
  color: hsl(142 76% 60%);
}

/* Tables */
[data-slot="table-container"] {
  position: relative;
  width: 100%;
  overflow-x: auto;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
}

[data-slot="table"] {
  width: 100%;
  caption-side: bottom;
  font-size: 0.875rem;
  border-collapse: collapse;
}

[data-slot="table-header"] tr {
  border-bottom: 1px solid hsl(var(--border));
  background-color: hsl(var(--muted) / 0.5);
}

[data-slot="table-head"] {
  height: 2.5rem;
  padding: 0.5rem 1rem;
  text-align: left;
  vertical-align: middle;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

[data-slot="table-body"] tr {
  border-bottom: 1px solid hsl(var(--border));
  transition: background-color 0.15s ease;
}

[data-slot="table-body"] tr:last-child {
  border-bottom: 0;
}

[data-slot="table-body"] tr:hover {
  background-color: hsl(var(--muted) / 0.4);
}

[data-slot="table-cell"] {
  padding: 0.875rem 1rem;
  vertical-align: middle;
}

/* Tabs */
[data-slot="tabs"] {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

[data-slot="tabs-list"] {
  display: inline-flex;
  height: 2.375rem;
  align-items: center;
  justify-content: flex-start;
  border-radius: calc(var(--radius) - 2px);
  background-color: hsl(var(--muted));
  padding: 0.1875rem;
  color: hsl(var(--muted-foreground));
  width: fit-content;
}

[data-slot="tabs-trigger"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 4px);
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-slot="tabs-trigger"]:hover {
  color: hsl(var(--foreground));
}

[data-slot="tabs-trigger"][data-state="active"] {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

[data-slot="tabs-content"] {
  outline: none;
}

[data-slot="tabs-content"][data-state="inactive"] {
  display: none;
}

/* Breadcrumb */
[data-slot="breadcrumb-list"] {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  list-style: none;
  margin: 0;
  padding: 0;
}

[data-slot="breadcrumb-item"] {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

[data-slot="breadcrumb-link"] {
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: color 0.15s ease;
}

[data-slot="breadcrumb-link"]:hover {
  color: hsl(var(--foreground));
}

[data-slot="breadcrumb-page"] {
  font-weight: 500;
  color: hsl(var(--foreground));
}

[data-slot="breadcrumb-separator"] {
  color: hsl(var(--muted-foreground) / 0.6);
}

/* Separator */
[data-slot="separator"] {
  background-color: hsl(var(--border));
  flex-shrink: 0;
}

[data-slot="separator"][data-orientation="horizontal"] {
  height: 1px;
  width: 100%;
}

[data-slot="separator"][data-orientation="vertical"] {
  width: 1px;
  height: 1rem;
}

/* Avatar */
[data-slot="avatar"] {
  position: relative;
  display: flex;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 9999px;
  background-color: hsl(var(--muted));
}

[data-slot="avatar-fallback"] {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

/* Toggle Group */
[data-slot="toggle-group"] {
  display: inline-flex;
  align-items: center;
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) - 2px);
  padding: 2px;
  background-color: hsl(var(--background));
}

[data-slot="toggle-group-item"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: calc(var(--radius) - 4px);
  border: none;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.15s ease;
}

[data-slot="toggle-group-item"]:hover {
  color: hsl(var(--foreground));
}

[data-slot="toggle-group-item"][data-state="on"] {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

/* Input */
[data-slot="input"] {
  display: flex;
  height: 2rem;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background-color: transparent;
  padding: 0 0.625rem;
  font-size: 0.8125rem;
  outline: none;
  color: hsl(var(--foreground));
  transition: border-color 0.15s ease;
}

[data-slot="input"]:focus-visible {
  border-color: hsl(var(--ring));
}

/* Mobile Sidebar Drawer / Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 35;
}

@media (max-width: 768px) {
  [data-slot="sidebar"] {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  }
  
  [data-slot="sidebar-wrapper"][data-mobile-open="true"] [data-slot="sidebar"] {
    transform: translateX(0);
  }

  [data-slot="sidebar-wrapper"][data-mobile-open="true"] .sidebar-backdrop {
    display: block;
  }
}
