@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');
@import "tailwindcss";
@import "tw-animate-css";
@plugin "@tailwindcss/typography";

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

@theme inline {
  --color-background: hsl(var(--background));
  --color-foreground: hsl(var(--foreground));
  --color-border: hsl(var(--border));
  --color-input: hsl(var(--input));
  --color-ring: hsl(var(--ring));

  --color-card: hsl(var(--card));
  --color-card-foreground: hsl(var(--card-foreground));
  --color-card-border: hsl(var(--card-border));

  --color-popover: hsl(var(--popover));
  --color-popover-foreground: hsl(var(--popover-foreground));
  --color-popover-border: hsl(var(--popover-border));

  --color-primary: hsl(var(--primary));
  --color-primary-foreground: hsl(var(--primary-foreground));
  --color-primary-border: var(--primary-border);

  --color-secondary: hsl(var(--secondary));
  --color-secondary-foreground: hsl(var(--secondary-foreground));
  --color-secondary-border: var(--secondary-border);

  --color-muted: hsl(var(--muted));
  --color-muted-foreground: hsl(var(--muted-foreground));
  --color-muted-border: var(--muted-border);

  --color-accent: hsl(var(--accent));
  --color-accent-foreground: hsl(var(--accent-foreground));
  --color-accent-border: var(--accent-border);

  --color-destructive: hsl(var(--destructive));
  --color-destructive-foreground: hsl(var(--destructive-foreground));
  --color-destructive-border: var(--destructive-border);

  --color-chart-1: hsl(var(--chart-1));
  --color-chart-2: hsl(var(--chart-2));
  --color-chart-3: hsl(var(--chart-3));
  --color-chart-4: hsl(var(--chart-4));
  --color-chart-5: hsl(var(--chart-5));

  --color-sidebar: hsl(var(--sidebar));
  --color-sidebar-foreground: hsl(var(--sidebar-foreground));
  --color-sidebar-border: hsl(var(--sidebar-border));
  --color-sidebar-primary: hsl(var(--sidebar-primary));
  --color-sidebar-primary-foreground: hsl(var(--sidebar-primary-foreground));
  --color-sidebar-primary-border: var(--sidebar-primary-border);
  --color-sidebar-accent: hsl(var(--sidebar-accent));
  --color-sidebar-accent-foreground: hsl(var(--sidebar-accent-foreground));
  --color-sidebar-accent-border: var(--sidebar-accent-border);
  --color-sidebar-ring: hsl(var(--sidebar-ring));

  --font-sans: var(--app-font-sans);
  --font-serif: var(--app-font-serif);
  --font-mono: var(--app-font-mono);

  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
}

:root {
  --button-outline: rgba(0,0,0, .10);
  --badge-outline: rgba(0,0,0, .05);

  --opaque-button-border-intensity: -8; 

  --elevate-1: rgba(0,0,0, .03);
  --elevate-2: rgba(0,0,0, .08);

  --background: 0 0% 98%;
  --foreground: 143 50% 10%;
  --border: 143 20% 88%;
  --card: 0 0% 100%;
  --card-foreground: 143 50% 10%;
  --card-border: 143 20% 90%;
  
  --sidebar: 0 0% 100%;
  --sidebar-foreground: 143 50% 10%;
  --sidebar-border: 143 20% 90%;
  --sidebar-primary: 143 60% 26%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 143 20% 94%;
  --sidebar-accent-foreground: 143 50% 10%;
  --sidebar-ring: 143 60% 26%;

  --popover: 0 0% 100%;
  --popover-foreground: 143 50% 10%;
  --popover-border: 143 20% 90%;

  --primary: 143 60% 26%;
  --primary-foreground: 0 0% 100%;

  --secondary: 143 20% 94%;
  --secondary-foreground: 143 60% 26%;

  --muted: 143 20% 94%;
  --muted-foreground: 143 15% 45%;

  --accent: 143 30% 92%;
  --accent-foreground: 143 60% 26%;

  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;

  --input: 143 20% 84%;
  --ring: 143 60% 26%;
  
  --chart-1: 143 60% 26%;
  --chart-2: 143 40% 40%;
  --chart-3: 143 30% 60%;
  --chart-4: 143 20% 80%;
  --chart-5: 143 10% 90%;

  --app-font-sans: 'Tajawal', sans-serif;
  --app-font-serif: Georgia, serif;
  --app-font-mono: Menlo, monospace;
  --radius: 0.5rem; 

  --shadow-2xs: 0px 2px 0px 0px hsl(143 60% 26% / 0.05);
  --shadow-xs: 0px 2px 0px 0px hsl(143 60% 26% / 0.05);
  --shadow-sm: 0px 2px 0px 0px hsl(143 60% 26% / 0.05), 0px 1px 2px -1px hsl(143 60% 26% / 0.05);
  --shadow: 0px 2px 0px 0px hsl(143 60% 26% / 0.05), 0px 1px 2px -1px hsl(143 60% 26% / 0.05);
  --shadow-md: 0px 2px 0px 0px hsl(143 60% 26% / 0.05), 0px 2px 4px -1px hsl(143 60% 26% / 0.05);
  --shadow-lg: 0px 2px 0px 0px hsl(143 60% 26% / 0.05), 0px 4px 6px -1px hsl(143 60% 26% / 0.05);
  --shadow-xl: 0px 2px 0px 0px hsl(143 60% 26% / 0.05), 0px 8px 10px -1px hsl(143 60% 26% / 0.05);
  --shadow-2xl: 0px 2px 0px 0px hsl(143 60% 26% / 0.05);
  
  --tracking-normal: 0em;
  --spacing: 0.25rem;

  --sidebar-primary-border: hsl(from hsl(var(--sidebar-primary)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);
  --sidebar-accent-border: hsl(from hsl(var(--sidebar-accent)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);
  --primary-border: hsl(from hsl(var(--primary)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);
  --secondary-border: hsl(from hsl(var(--secondary)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);
  --muted-border: hsl(from hsl(var(--muted)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);
  --accent-border: hsl(from hsl(var(--accent)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);
  --destructive-border: hsl(from hsl(var(--destructive)) h s calc(l + var(--opaque-button-border-intensity)) / alpha);
}

.dark {
  --button-outline: rgba(255,255,255, .10);
  --badge-outline: rgba(255,255,255, .05);

  --opaque-button-border-intensity: 9;  

  --elevate-1: rgba(255,255,255, .04);
  --elevate-2: rgba(255,255,255, .09);

  --background: 143 50% 5%;
  --foreground: 0 0% 98%;
  --border: 143 30% 15%;
  --card: 143 40% 8%;
  --card-foreground: 0 0% 98%;
  --card-border: 143 30% 15%;

  --sidebar: 143 40% 8%;
  --sidebar-foreground: 0 0% 98%;
  --sidebar-border: 143 30% 15%;
  --sidebar-primary: 143 60% 26%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 143 30% 15%;
  --sidebar-accent-foreground: 0 0% 98%;
  --sidebar-ring: 143 60% 26%;

  --popover: 143 40% 8%;
  --popover-foreground: 0 0% 98%;
  --popover-border: 143 30% 15%;

  --primary: 143 60% 40%;
  --primary-foreground: 0 0% 100%;

  --secondary: 143 30% 15%;
  --secondary-foreground: 143 60% 40%;

  --muted: 143 30% 15%;
  --muted-foreground: 143 20% 60%;

  --accent: 143 40% 20%;
  --accent-foreground: 143 60% 40%;

  --destructive: 0 84% 60%;
  --destructive-foreground: 0 0% 100%;

  --input: 143 30% 20%;
  --ring: 143 60% 40%;
  
  --chart-1: 143 60% 40%;
  --chart-2: 143 40% 50%;
  --chart-3: 143 30% 60%;
  --chart-4: 143 20% 70%;
  --chart-5: 143 10% 80%;

  --shadow-2xs: 0px 2px 0px 0px hsl(0 0% 0% / 0.5);
  --shadow-xs: 0px 2px 0px 0px hsl(0 0% 0% / 0.5);
  --shadow-sm: 0px 2px 0px 0px hsl(0 0% 0% / 0.5), 0px 1px 2px -1px hsl(0 0% 0% / 0.5);
  --shadow: 0px 2px 0px 0px hsl(0 0% 0% / 0.5), 0px 1px 2px -1px hsl(0 0% 0% / 0.5);
  --shadow-md: 0px 2px 0px 0px hsl(0 0% 0% / 0.5), 0px 2px 4px -1px hsl(0 0% 0% / 0.5);
  --shadow-lg: 0px 2px 0px 0px hsl(0 0% 0% / 0.5), 0px 4px 6px -1px hsl(0 0% 0% / 0.5);
  --shadow-xl: 0px 2px 0px 0px hsl(0 0% 0% / 0.5), 0px 8px 10px -1px hsl(0 0% 0% / 0.5);
  --shadow-2xl: 0px 2px 0px 0px hsl(0 0% 0% / 0.5);
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply font-sans antialiased bg-background text-foreground;
  }
}

@layer utilities {
  input[type="search"]::-webkit-search-cancel-button {
    @apply hidden;
  }

  [contenteditable][data-placeholder]:empty::before {
    content: attr(data-placeholder);
    color: hsl(var(--muted-foreground));
    pointer-events: none;
  }

  .no-default-hover-elevate {}
  .no-default-active-elevate {}

  .toggle-elevate::before,
  .toggle-elevate-2::before {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0px;
    border-radius: inherit;
    z-index: -1;
  }

  .toggle-elevate.toggle-elevated::before {
    background-color: var(--elevate-2);
  }

  .border.toggle-elevate::before {
    inset: -1px;
  }

  .hover-elevate:not(.no-default-hover-elevate),
  .active-elevate:not(.no-default-active-elevate),
  .hover-elevate-2:not(.no-default-hover-elevate),
  .active-elevate-2:not(.no-default-active-elevate) {
    position: relative;
    z-index: 0;
  }

  .hover-elevate:not(.no-default-hover-elevate)::after,
  .active-elevate:not(.no-default-active-elevate)::after,
  .hover-elevate-2:not(.no-default-hover-elevate)::after,
  .active-elevate-2:not(.no-default-active-elevate)::after {
    content: "";
    pointer-events: none;
    position: absolute;
    inset: 0px;
    border-radius: inherit;
    z-index: 999;
  }

  .hover-elevate:hover:not(.no-default-hover-elevate)::after,
  .active-elevate:active:not(.no-default-active-elevate)::after {
    background-color: var(--elevate-1);
  }

  .hover-elevate-2:hover:not(.no-default-hover-elevate)::after,
  .active-elevate-2:active:not(.no-default-active-elevate)::after {
    background-color: var(--elevate-2);
  }

  .border.hover-elevate:not(.no-hover-interaction-elevate)::after,
  .border.active-elevate:not(.no-active-interaction-elevate)::after,
  .border.hover-elevate-2:not(.no-hover-interaction-elevate)::after,
  .border.active-elevate-2:not(.no-active-interaction-elevate)::after,
  .border.hover-elevate:not(.no-hover-interaction-elevate)::after {
    inset: -1px;
  }
}
