/*
 * Giant Phoenix desk theme
 * -------------------------
 * Ports the shadcn/Tailwind design tokens onto Frappe's OWN desk CSS variables,
 * plus structural polish (soft page bg, floating cards, shadows, radius) to bring
 * the ERPNext desk visually closer to the shadcn look. Literal shadcn parity is
 * NOT achievable (different component system); this is "meaningfully closer".
 *
 * Frappe scopes themes with [data-theme="light"] / [data-theme="dark"] on the root.
 * Colours are oklch verbatim from the source theme (fine for the desk; wkhtmltopdf
 * print formats get hex separately). Served via app_include_css (hooks.py); ships in
 * giant_phoenix so it is every tenant's default and survives migrate/rebuild.
 */

/* ===================================================== TOKENS — LIGHT === */
:root,
[data-theme="light"] {
  /* Brand / primary — shadcn --primary (was Frappe near-black gray-900) */
  --primary: oklch(0.4026 0.1374 261.3930);
  --brand-color: oklch(0.4026 0.1374 261.3930);
  --primary-color: oklch(0.4026 0.1374 261.3930);
  --btn-primary: oklch(0.4026 0.1374 261.3930);
  --border-primary: oklch(0.4026 0.1374 261.3930);

  /* Surfaces — the key shadcn move: cards float on a soft gray page */
  --bg-color: oklch(0.9683 0.0069 247.8956);     /* page background (shadcn --muted) */
  --fg-color: oklch(1 0 0);                        /* card / surface = white */
  --card-bg: oklch(1 0 0);
  --navbar-bg: oklch(1 0 0);
  --modal-bg: oklch(1 0 0);
  --popover-bg: oklch(1 0 0);
  --control-bg: oklch(1 0 0);                      /* inputs white w/ border (shadcn) */
  --subtle-accent: oklch(0.9842 0.0034 247.8575);
  --fg-hover-color: oklch(0.9683 0.0069 247.8956);
  --sidebar-select-color: oklch(0.9231 0.0280 263.4295);
  --awesomplete-hover-bg: oklch(0.9683 0.0069 247.8956);
  --highlight-color: oklch(0.9683 0.0069 247.8956);

  /* Text — shadcn --foreground / --muted-foreground */
  --text-color: oklch(0.2077 0.0398 265.7549);
  --text-muted: oklch(0.5544 0.0407 257.4166);

  /* Borders — shadcn --border (cool light gray) */
  --border-color: oklch(0.9288 0.0126 255.5078);
  --dark-border-color: oklch(0.9288 0.0126 255.5078);
  --table-border-color: oklch(0.9288 0.0126 255.5078);

  /* Radius — shadcn --radius: 0.5rem scale */
  --border-radius-tiny: 4px;
  --border-radius-sm: 6px;
  --border-radius: 8px;
  --border-radius-md: 8px;
  --border-radius-lg: 10px;
  --border-radius-xl: 14px;

  /* Shadows — shadcn shadow scale */
  --shadow-xs: 0px 1px 2px 0px hsl(0 0% 0% / 0.05);
  --shadow-sm: 0px 1px 3px 0px hsl(0 0% 0% / 0.08), 0px 1px 2px -1px hsl(0 0% 0% / 0.08);
  --shadow-md: 0px 4px 8px -2px hsl(0 0% 0% / 0.10), 0px 2px 4px -2px hsl(0 0% 0% / 0.06);
  --card-shadow: var(--shadow-sm);
  --btn-shadow: var(--shadow-xs);
  --modal-shadow: var(--shadow-md);

  --ring: oklch(0.4026 0.1374 261.3930);
}

/* ===================================================== TOKENS — DARK ==== */
/* Conservative dark: brand + accents + borders, keep Frappe's dark surfaces. */
[data-theme="dark"] {
  --primary: oklch(0.6231 0.1880 259.8145);
  --brand-color: oklch(0.6231 0.1880 259.8145);
  --primary-color: oklch(0.6231 0.1880 259.8145);
  --btn-primary: oklch(0.4026 0.1374 261.3930);
  --border-primary: oklch(0.6231 0.1880 259.8145);
  --sidebar-select-color: oklch(0.3717 0.0392 257.2870);
  --border-color: oklch(0.3717 0.0392 257.2870);
  --dark-border-color: oklch(0.3717 0.0392 257.2870);
  --ring: oklch(0.6231 0.1880 259.8145);
}

/* ================================================ STRUCTURAL POLISH ===== */
/* Cards float on a soft gray page (the core shadcn dashboard move).          */
.layout-main-section {
  background: var(--bg-color);
}
.widget,
.dashboard-widget-box {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--card-shadow);
}

/* Left sidebar: light shadcn surface, rounded selected item */
.layout-side-section .standard-sidebar,
.desk-sidebar {
  padding-right: 4px;
}
.standard-sidebar-item {
  border-radius: var(--border-radius);
  margin-bottom: 2px;
}
.standard-sidebar-item.selected {
  background-color: var(--sidebar-select-color);
  box-shadow: none;
}

/* Buttons: rounded, subtle shadow; primary keeps white text on blue */
.btn {
  border-radius: var(--border-radius);
}
.btn-primary {
  box-shadow: var(--btn-shadow);
}

/* Inputs: white with visible border (shadcn), rounded */
.form-control,
.input-with-feedback {
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  background: var(--control-bg);
}

/* Page header title a touch bolder, matching shadcn headings */
.page-title .title-text {
  font-weight: 650;
}
