/* ==========================================================================
   Theme variables
   ========================================================================== */

:root {
  /* Brand colors (unchanged across themes) */
  --purple1: #7f56d9;
  --purple2: #42249e;
  --red: #ff3636;
  --yellow: #e2dd3a;
  --confirm: #00c853;
  --confirm-hover: #00b74a;
  --cancel: #ff3636;
  --cancel-hover: #e02f2f;

  /* Literal colors — NEVER swap these */
  --white: #ffffff;
  --black: #000000;

  /* Semantic colors — light mode */
  --bg-page: #f5f5f7;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f0f0f2;
  --bg-elevated: #ffffff;
  --bg-input: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.3);
  --bg-card: #f8f9fa;
  --bgHeader: #f0f0f2;
  --bgDefault: #f5f5f7;

  --text-primary: #1a1a2e;
  --text-secondary: #4a4a5a;
  --text-muted: #71717a;
  --text-on-primary: #ffffff;

  --border-color: #e0e0e6;
  --border-color-subtle: #ebebf0;

  --scrollbar-track: #f0f0f2;
  --scrollbar-thumb: #b0b0b8;
  --scrollbar-thumb-hover: #8a8a96;

  --disabled: #e0e0e6;
  --fontGray1: #71717a;
  --fontGray2: #a1a1aa;

  /* Legacy dark-N vars mapped to light equivalents */
  --dark0: #ebebf0;
  --dark1: #f0f0f2;
  --dark2: #e0e0e6;
  --dark3: #d0d0d8;
  --dark4: #b0b0b8;
  --dark5: #8a8a96;
  --dark6: #4a4a5a;
  --dark7: #2a2a3a;

  color-scheme: light;
}

.dark {
  --bg-page: #09090b;
  --bg-surface: #0f0f12;
  --bg-surface-hover: #1a1a1f;
  --bg-elevated: #1a1a1f;
  --bg-input: #1a1a1f;
  --bg-overlay: rgba(0, 0, 0, 0.75);
  --bg-card: #0f0f12;
  --bgHeader: #0f0f12;
  --bgDefault: #09090b;

  --text-primary: #ffffff;
  --text-secondary: #d1d5db;
  --text-muted: #9ca3af;
  --text-on-primary: #ffffff;

  --border-color: #252529;
  --border-color-subtle: #1a1a1f;

  --scrollbar-track: #09090b;
  --scrollbar-thumb: #3a3a42;
  --scrollbar-thumb-hover: #55555e;

  --disabled: #252529;
  --fontGray1: #9ca3af;
  --fontGray2: #6b7280;

  --dark0: #09090b;
  --dark1: #0f0f12;
  --dark2: #1a1a1f;
  --dark3: #1a1a1f;
  --dark4: #252529;
  --dark5: #6b7280;
  --dark6: #9ca3af;
  --dark7: #d1d5db;

  color-scheme: dark;
}

/* ==========================================================================
   Reset
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  color: var(--text-primary);
  background: var(--bg-page);
  font-family: Inter, Poppins, system-ui, Avenir, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root {
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  overflow-wrap: break-word;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input[type='button'],
input[type='submit'] {
  cursor: pointer;
}

input:focus,
button:focus,
textarea:focus,
select:focus {
  color: var(--text-primary);
}

input[type='color']::-moz-color-swatch,
input[type='color']::-webkit-color-swatch {
  border: none;
}

input[type='color']::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 0;
}

/* ==========================================================================
   Toaster (react-hot-toast)
   ========================================================================== */

.toasterContainer {
  z-index: 99999;
}

/* Ensure toast text isn't cropped by inherited tight line-heights */
[data-sonner-toaster],
.go2072408551,
.go3958317564 {
  line-height: 1.4;
}

/* ==========================================================================
   Scrollbar
   ========================================================================== */

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

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

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

/* ==========================================================================
   Mantine overrides
   ========================================================================== */

.mantine-Group-root button {
  width: unset;
}

.mantine-Input-rightSection {
  width: calc((1.5rem + 0.0625rem) * 2);
}

.mantine-Input-rightSection > * {
  flex-direction: row;
}

.mantine-Button-root[data-disabled] {
  background-color: var(--disabled);
  color: var(--fontGray1);
  cursor: not-allowed;
  opacity: 0.5;
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.highlight-help {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px #3b82f6;
  background-color: rgba(37, 99, 235, 0.1);
}
