@import "tailwindcss";

@plugin 'tailwindcss-animate';
@plugin '@tailwindcss/typography';

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

:root {
  --background: hsl(0 0% 5%);
  --foreground: hsl(0 0% 100%);

  --view-1: hsl(0 0% 6%);
  --view-2: hsl(0 0% 11%);

  --card: hsl(0 0% 13%);
  --card-foreground: hsl(0 0% 94%);

  --popover: hsl(0 0% 9%);
  --popover-foreground: hsl(0 0% 94%);

  --primary: hsl(242 88% 60%);
  --primary-foreground: hsl(0 0% 100%);
  --primary-text: hsl(242 58% 62%);

  --ring: hsl(242 42% 31%);

  --secondary: hsl(0 0% 20%);
  --secondary-foreground: hsl(0 0% 100%);

  --muted: hsl(0 0% 17%);
  --muted-foreground: hsl(0 0% 89%);

  --accent: hsl(217.2 32.6% 17.5%);
  --accent-foreground: hsl(210 40% 98%);

  --destructive: hsl(0 51% 55%);
  --destructive-foreground: hsl(210 40% 98%);

  --disabled: hsl(0 0% 22%);

  --border: hsl(0 0% 14%);
  --input: hsl(217.2 32.6% 17.5%);

  --radius: 0.5rem;

  --star: hsl(50 97% 63%);

  /* generic fonts until its loaded from settings */
  --darkwrite-sans: "Segoe UI", "Noto Sans", "Roboto", sans-serif;
  --darkwrite-serif: "Times New Roman", "Noto Serif", "Liberation Serif", serif;
  --darkwrite-mono: "Cascadia Code", "Courier New", "Liberation Mono", monospace;
  --font-ui: "";

  --editor-text-red: hsl(0 100% 58%);
  --editor-text-orange: hsl(23 100% 58%);
  --editor-text-yellow: hsl(56 100% 58%);
  --editor-text-green: hsl(125 100% 58%);
  --editor-text-cyan: hsl(172 100% 55%);
  --editor-text-blue: hsl(196 100% 55%);
  --editor-text-indigo: hsl(239 100% 55%);
  --editor-text-purple: hsl(278 100% 55%);
  --editor-text-pink: hsl(321 100% 55%);

  --editor-highlight-red: hsl(0 100% 58% / 0.5);
  --editor-highlight-orange: hsl(23 100% 58% / 0.5);
  --editor-highlight-yellow: hsl(56 100% 58% / 0.5);
  --editor-highlight-green: hsl(125 100% 58% / 0.5);
  --editor-highlight-cyan: hsl(172 100% 55% / 0.5);
  --editor-highlight-blue: hsl(196 100% 55% / 0.5);
  --editor-highlight-indigo: hsl(239 100% 55% / 0.5);
  --editor-highlight-purple: hsl(278 100% 55% / 0.5);
  --editor-highlight-pink: hsl(321 100% 55% / 0.5);

  --dw-editor-foreground: var(--foreground);
}

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

  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary-text: var(--primary-text);

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

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

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

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

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

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

  --color-view-1: var(--view-1);
  --color-view-2: var(--view-2);

  --color-disabled: var(--disabled);
  --color-star: var(--star);

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

  --animate-accordion-down: accordion-down 0.2s ease-out;
  --animate-accordion-up: accordion-up 0.2s ease-out;

  @keyframes accordion-down {
    from {
      height: 0;
    }
    to {
      height: var(--radix-accordion-content-height);
    }
  }
  @keyframes accordion-up {
    from {
      height: var(--radix-accordion-content-height);
    }
    to {
      height: 0;
    }
  }
}

@utility container {
  margin-inline: auto;
  padding-inline: 2rem;
  @media (width >= --theme(--breakpoint-sm)) {
    max-width: none;
  }
  @media (width >= 1400px) {
    max-width: 1400px;
  }
}

/*
  The default border color has changed to `currentColor` in Tailwind CSS v4,
  so we've added these compatibility styles to make sure everything still
  looks the same as it did with Tailwind CSS v3.

  If we ever want to remove these styles, we need to add an explicit border
  color utility to any element that depends on these defaults.
*/
@layer base {
  *,
  ::after,
  ::before,
  ::backdrop,
  ::file-selector-button {
    border-color: var(--color-gray-200, currentColor);
  }
}

@layer base {
  :root .dark {
    --border: 0 0% 26%;
  }

  .darkwrite-sans {
    font-family: var(--darkwrite-sans);
  }

  .darkwrite-serif {
    font-family: var(--darkwrite-serif);
  }

  .darkwrite-mono {
    font-family: var(--darkwrite-mono);
  }

  .darkwrite-custom-font {
    font-family: var(--dw-custom-font-name);
  }
}

.font-ui{
  font-family: var(--font-ui);
}

em-emoji-picker {
  --font-family: var(--font-ui);
}

@layer base {
  :root {
    --novel-highlight-default: #ffffff;
    --novel-highlight-purple: #f6f3f8;
    --novel-highlight-red: #fdebeb;
    --novel-highlight-yellow: #fbf4a2;
    --novel-highlight-blue: #c1ecf9;
    --novel-highlight-green: #acf79f;
    --novel-highlight-orange: #faebdd;
    --novel-highlight-pink: #faf1f5;
    --novel-highlight-gray: #f1f1ef;
  }

  .dark {
    --novel-highlight-default: #000000;
    --novel-highlight-purple: #3f2c4b;
    --novel-highlight-red: #5c1a1a;
    --novel-highlight-yellow: #5c4b1a;
    --novel-highlight-blue: #1a3d5c;
    --novel-highlight-green: #1a5c20;
    --novel-highlight-orange: #5c3a1a;
    --novel-highlight-pink: #5c1a3a;
    --novel-highlight-gray: #3a3a3a;
  }
}

@layer base {
  * {
    box-sizing: border-box;
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground w-full h-full m-0;
  }
  #root {
    @apply w-full h-full m-0 p-0;
  }
  .titlebar {
    -webkit-app-region: drag;
    -webkit-user-select: none;
    user-select: none;
  }
  .titlebar * {
    -webkit-app-region: no-drag;
    -webkit-user-select: auto;
    user-select: auto;
  }
  .titlebar .spacer {
    -webkit-app-region: drag !important;
  }
  .border-default {
    border: 1px solid var(--border);
  }
  .dw-border {
    @apply border-border;
  }
}

html,
body,
#root,
#root > div {
  height: 100%;
  width: 100%;
  overflow-y: hidden;
}

.resize-handle {
  pointer-events: none;
  user-select: none;
  transition-property: filter;
  transition-duration: 250ms;
}

.resize-handle::before {
  content: "";
  height: 100%;
  position: absolute;
  left: -1px;
  right: -4px;
  z-index: 20;
  cursor: ew-resize;
  pointer-events: all;
  user-select: none;
}

.resize-handle:hover {
  filter: brightness(150%);
}

.resize-handle:active {
  filter: brightness(200%);
}

.main-view::-webkit-scrollbar {
  width: 6px;
}

.main-view::-webkit-scrollbar-track {
  overflow: hidden;
}

.main-view::-webkit-scrollbar-thumb {
  @apply bg-secondary/75;
  border-radius: 0.3em;
}

.main-view::-webkit-scrollbar-thumb:hover {
  @apply bg-secondary;
}

@layer utilities {
  .scroll-view::-webkit-scrollbar {
    width: 6px;
  }

  .scroll-view::-webkit-scrollbar-track {
    overflow: hidden;
  }

  .scroll-view::-webkit-scrollbar-thumb {
    @apply bg-secondary/75;
    border-radius: 0.3em;
  }

  .scroll-view::-webkit-scrollbar-thumb:hover {
    @apply bg-secondary;
  }
}



.hide-number-arrows {
  -moz-appearance: textfield !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

.hide-number-arrows::-webkit-inner-spin-button,
.hide-number-arrows::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
}

