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

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

@theme inline {
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --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-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --font-sans: "Bricolage Grotesque", "Google Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

:root {
  --radius: 0.625rem;
  --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);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
}

.dark {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.922 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.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }

  body {
    @apply bg-background text-foreground;
    font-family: var(--font-sans);
  }

  code,
  pre,
  .font-mono {
    font-family: "Google Sans Code", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !important;
  }
}

@theme inline {
  --font-mono: "Google Sans Code", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Sonner Toast Styling */
[data-sonner-toast] {
  @apply rounded-lg shadow-lg border;
}

[data-sonner-toast][data-type="success"] {
  @apply bg-green-50 border-green-200 text-green-900;
}

[data-sonner-toast][data-type="success"] [data-icon] {
  @apply text-green-600;
}

[data-sonner-toast][data-type="error"] {
  @apply bg-red-50 border-red-200 text-red-900;
}

[data-sonner-toast][data-type="error"] [data-icon] {
  @apply text-red-600;
}

[data-sonner-toast][data-type="warning"] {
  @apply bg-yellow-50 border-yellow-200 text-yellow-900;
}

[data-sonner-toast][data-type="warning"] [data-icon] {
  @apply text-yellow-600;
}

[data-sonner-toast][data-type="info"] {
  @apply bg-blue-50 border-blue-200 text-blue-900;
}

[data-sonner-toast][data-type="info"] [data-icon] {
  @apply text-blue-600;
}

/* Ensure description text uses same color as title */
[data-sonner-toast] [data-description],
[data-sonner-toast] [data-description] * {
  opacity: 1 !important;
}

/* Specific color for each toast type - match icon color */
[data-sonner-toast][data-type="success"] [data-description],
[data-sonner-toast][data-type="success"] [data-description] * {
  color: rgb(22 163 74) !important;
  /* green-600 - same as icon */
}

[data-sonner-toast][data-type="error"] [data-description],
[data-sonner-toast][data-type="error"] [data-description] * {
  color: rgb(220 38 38) !important;
  /* red-600 - same as icon */
}

[data-sonner-toast][data-type="warning"] [data-description],
[data-sonner-toast][data-type="warning"] [data-description] * {
  color: rgb(202 138 4) !important;
  /* yellow-600 - same as icon */
}

[data-sonner-toast][data-type="info"] [data-description],
[data-sonner-toast][data-type="info"] [data-description] * {
  color: rgb(37 99 235) !important;
  /* blue-600 - same as icon */
}

/* Dark mode - use same icon colors */
.dark [data-sonner-toast][data-type="success"] [data-description],
.dark [data-sonner-toast][data-type="success"] [data-description] * {
  color: rgb(22 163 74) !important;
  /* green-600 */
}

.dark [data-sonner-toast][data-type="error"] [data-description],
.dark [data-sonner-toast][data-type="error"] [data-description] * {
  color: rgb(220 38 38) !important;
  /* red-600 */
}

.dark [data-sonner-toast][data-type="warning"] [data-description],
.dark [data-sonner-toast][data-type="warning"] [data-description] * {
  color: rgb(202 138 4) !important;
  /* yellow-600 */
}

.dark [data-sonner-toast][data-type="info"] [data-description],
.dark [data-sonner-toast][data-type="info"] [data-description] * {
  color: rgb(37 99 235) !important;
  /* blue-600 */
}

/* Dark mode toast styling */
.dark [data-sonner-toast][data-type="success"] {
  @apply bg-green-950 border-green-800 text-green-100;
}

.dark [data-sonner-toast][data-type="success"] [data-icon] {
  @apply text-green-400;
}

.dark [data-sonner-toast][data-type="error"] {
  @apply bg-red-950 border-red-800 text-red-100;
}

.dark [data-sonner-toast][data-type="error"] [data-icon] {
  @apply text-red-400;
}

.dark [data-sonner-toast][data-type="warning"] {
  @apply bg-yellow-950 border-yellow-800 text-yellow-100;
}

.dark [data-sonner-toast][data-type="warning"] [data-icon] {
  @apply text-yellow-400;
}

.dark [data-sonner-toast][data-type="info"] {
  @apply bg-blue-950 border-blue-800 text-blue-100;
}

.dark [data-sonner-toast][data-type="info"] [data-icon] {
  @apply text-blue-400;
}

/* Custom Scrollbar - mengikuti primary color theme */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
  opacity: 0.7;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
  filter: brightness(1.2);
}

/* Firefox scrollbar support */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--secondary);
}

/* Custom scrollbar class untuk komponen tertentu */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--muted);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  filter: brightness(1.2);
}