/*
 * RVMSES White-Label Override for Documenso
 * Overrides the default Documenso green theme with RVMSES gold/navy branding
 * Injected via nginx sub_filter
 */

/* ── Light Mode ──────────────────────────────────────── */
:root,
.dark-mode-disabled {
  /* Primary: gold instead of green */
  --primary: 45 50% 48%;
  --primary-foreground: 45 50% 98%;
  --ring: 45 50% 48%;

  /* Backgrounds */
  --background: 40 20% 97%;
  --foreground: 222 49% 11%;

  /* Cards */
  --card: 40 15% 98%;
  --card-border: 40 20% 88%;
  --card-border-tint: 184 154 62;
  --card-foreground: 222 49% 11%;

  /* Field cards: gold tint */
  --field-card: 45 40% 92%;
  --field-card-border: 45 50% 48%;
  --field-card-foreground: 222 49% 11%;

  /* Secondary */
  --secondary: 40 15% 94%;
  --secondary-foreground: 222 49% 11%;

  /* Accent */
  --accent: 40 15% 94%;
  --accent-foreground: 222 49% 11%;

  /* Muted */
  --muted: 40 12% 94%;
  --muted-foreground: 222 10% 46%;

  /* Popover */
  --popover: 40 15% 99%;
  --popover-foreground: 222 49% 11%;

  /* Borders / inputs */
  --border: 40 18% 88%;
  --input: 40 18% 88%;

  /* Widget */
  --widget: 40 10% 96%;
  --widget-foreground: 40 10% 94%;

  /* Gold constant */
  --gold: 45 50% 48%;

  /* Documenso color palette → gold */
  --documenso-50: #FFF9E6;
  --documenso-100: #FFF3CC;
  --documenso-200: #FFE799;
  --documenso-300: #FFDB66;
  --documenso-400: #D4B44E;
  --documenso-500: #B89A3E;
  --documenso-600: #9A7E2E;
  --documenso-700: #7C6424;
  --documenso-800: #5E4C1B;
  --documenso-900: #403412;
  --documenso-950: #2A220C;
  --documenso: #B89A3E;
}

/* ── Dark Mode ───────────────────────────────────────── */
.dark:not(.dark-mode-disabled) {
  /* Primary: gold */
  --primary: 45 55% 55%;
  --primary-foreground: 222 49% 8%;
  --ring: 45 55% 55%;

  /* Navy backgrounds */
  --background: 222 49% 10%;
  --foreground: 40 15% 90%;

  /* Cards: slightly lighter navy */
  --card: 222 40% 12%;
  --card-border: 222 30% 22%;
  --card-border-tint: 184 154 62;
  --card-foreground: 40 12% 92%;

  /* Muted */
  --muted: 222 30% 18%;
  --muted-foreground: 40 10% 72%;

  /* Secondary: navy variants */
  --secondary: 222 30% 18%;
  --secondary-foreground: 45 55% 55%;

  /* Accent */
  --accent: 222 30% 22%;
  --accent-foreground: 45 55% 55%;

  /* Popover */
  --popover: 222 45% 10%;
  --popover-foreground: 40 12% 88%;

  /* Borders */
  --border: 222 25% 22%;
  --input: 222 25% 22%;
  --field-border: 45 40% 60%;

  /* Widget */
  --widget: 222 45% 10%;
  --widget-foreground: 222 35% 14%;

  /* Destructive */
  --destructive: 0 87% 62%;
  --destructive-foreground: 0 87% 95%;

  /* Gold */
  --gold: 45 55% 55%;
  --warning: 54 96% 45%;
}

/* ── Override hardcoded documenso green colors ────────── */

/* bg-documenso (was green #A2E771) → gold */
.bg-documenso,
.dark\:bg-documenso:is(.dark:not(.dark-mode-disabled) *) {
  background-color: #B89A3E !important;
}

/* text-documenso (was green) → gold */
.text-documenso,
.group:hover .group-hover\:text-documenso {
  color: #B89A3E !important;
}

.text-documenso-700 {
  color: #7C6424 !important;
}

.text-documenso-800 {
  color: #5E4C1B !important;
}

/* text-[#7AC455] (hardcoded green) → gold */
.text-\[\#7AC455\] {
  color: #B89A3E !important;
}

/* bg-documenso-200 → gold light */
.bg-documenso-200 {
  background-color: #FFE799 !important;
}

/* bg-documenso-500 → gold */
.bg-documenso-500 {
  background-color: #B89A3E !important;
}

/* Hover states */
.hover\:text-documenso-600:hover {
  color: #9A7E2E !important;
}

/* Group hover bg-documenso */
.group:hover .group-hover\:bg-documenso {
  background-color: #B89A3E !important;
}

/* Checkbox checked state: was green → gold */
[data-state="checked"].data-\[state\=checked\]\:bg-documenso {
  background-color: #B89A3E !important;
}

/* Border hover: was green → gold */
.group:hover .group-hover\:border-documenso\/80 {
  border-color: rgba(184, 154, 62, 0.8) !important;
}

/* Green tinted elements → gold tint */
.dark\:border-green-400\/30:is(.dark:not(.dark-mode-disabled) *) {
  border-color: rgba(184, 154, 62, 0.3) !important;
}
.dark\:border-green-500\/20:is(.dark:not(.dark-mode-disabled) *) {
  border-color: rgba(184, 154, 62, 0.2) !important;
}
.dark\:bg-green-400\/10:is(.dark:not(.dark-mode-disabled) *) {
  background-color: rgba(184, 154, 62, 0.1) !important;
}
.dark\:bg-green-500\/10:is(.dark:not(.dark-mode-disabled) *) {
  background-color: rgba(184, 154, 62, 0.1) !important;
}
.dark\:text-green-300:is(.dark:not(.dark-mode-disabled) *) {
  color: #D4B44E !important;
}
.dark\:text-green-400:is(.dark:not(.dark-mode-disabled) *) {
  color: #B89A3E !important;
}

/* Light mode green overrides */
.bg-green-50 { background-color: #FFF9E6 !important; }
.bg-green-100 { background-color: #FFF3CC !important; }
.bg-green-500 { background-color: #B89A3E !important; }
.text-green-500 { color: #B89A3E !important; }
.text-green-600 { color: #9A7E2E !important; }
.text-green-700 { color: #7C6424 !important; }
.text-green-800 { color: #5E4C1B !important; }
.text-green-900 { color: #403412 !important; }
.border-green-200 { border-color: #FFE799 !important; }
.ring-green-600\/20 { --tw-ring-color: rgba(154, 126, 46, 0.2) !important; }
.dark\:ring-green-500\/20:is(.dark:not(.dark-mode-disabled) *) {
  --tw-ring-color: rgba(184, 154, 62, 0.2) !important;
}
.stroke-green-600 { stroke: #9A7E2E !important; }

/* New-primary variables: green → gold */
:root,
.dark-mode-disabled {
  --new-primary-50: 45, 80%, 97%;
  --new-primary-100: 45, 70%, 94%;
  --new-primary-200: 45, 60%, 87%;
  --new-primary-300: 45, 55%, 78%;
  --new-primary-400: 45, 52%, 68%;
  --new-primary-500: 45, 50%, 48%;
  --new-primary-600: 45, 55%, 40%;
  --new-primary-700: 45, 55%, 32%;
  --new-primary-800: 45, 55%, 23%;
  --new-primary-900: 45, 55%, 14%;
  --new-primary-950: 45, 55%, 7%;
}

/* ── Logo Replacement ────────────────────────────────── */
/* Replicate RVMSES hero-brand style from the main site */

/* Hide all Documenso SVG logos and logo images */
a[href="/"] > svg[viewBox="0 0 2248 320"],
a[href="/documents"] > svg[viewBox="0 0 2248 320"],
a[href="/"] > svg[viewBox="0 0 84 84"],
a[href="/documents"] > svg[viewBox="0 0 84 84"],
header svg[viewBox="0 0 2248 320"],
header svg[viewBox="0 0 84 84"],
a[href="/"] > img[alt*="Logo"],
a[href="/"] > img[alt*="logo"],
a[href="/"] > img[alt*="RVMSES"],
a[href="/"] > img[alt*="Documenso"] {
  display: none !important;
}

/* ── Shared RVMSES brand text style (matches hero-brand) ── */
/* Desktop: full "RVMSES" with decorative lines */
a[href="/"]:has(> svg[viewBox="0 0 2248 320"]),
a[href="/documents"]:has(> svg[viewBox="0 0 2248 320"]),
header a:has(> svg[viewBox="0 0 2248 320"]),
a[href="/"]:has(> img[alt*="Logo"]),
a[href="/"]:has(> img[alt*="logo"]),
a[href="/"]:has(> img[alt*="RVMSES"]) {
  display: inline-flex !important;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none !important;
}
a[href="/"]:has(> svg[viewBox="0 0 2248 320"])::before,
a[href="/documents"]:has(> svg[viewBox="0 0 2248 320"])::before,
header a:has(> svg[viewBox="0 0 2248 320"])::before,
a[href="/"]:has(> img[alt*="Logo"])::before,
a[href="/"]:has(> img[alt*="logo"])::before,
a[href="/"]:has(> img[alt*="RVMSES"])::before {
  content: "";
  display: block;
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #B89A3E);
  opacity: 0.55;
  flex-shrink: 0;
}
a[href="/"]:has(> svg[viewBox="0 0 2248 320"])::after,
a[href="/documents"]:has(> svg[viewBox="0 0 2248 320"])::after,
header a:has(> svg[viewBox="0 0 2248 320"])::after,
a[href="/"]:has(> img[alt*="Logo"])::after,
a[href="/"]:has(> img[alt*="logo"])::after,
a[href="/"]:has(> img[alt*="RVMSES"])::after {
  content: "RVMSES";
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #B89A3E;
  text-shadow: 0 0 12px rgba(184,154,62,0.25), 0 0 32px rgba(184,154,62,0.1);
  flex-shrink: 0;
}

/* Mobile: icon-only → single "R" with gold styling */
a[href="/"]:has(> svg[viewBox="0 0 84 84"])::after,
a[href="/documents"]:has(> svg[viewBox="0 0 84 84"])::after,
header a:has(> svg[viewBox="0 0 84 84"])::after {
  content: "R";
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  color: #B89A3E;
  text-shadow: 0 0 12px rgba(184,154,62,0.25);
}

/* Dark mode: brighter gold */
.dark:not(.dark-mode-disabled) a[href="/"]::after,
.dark:not(.dark-mode-disabled) a[href="/documents"]::after,
.dark:not(.dark-mode-disabled) header a::after {
  color: #D4B44E !important;
  text-shadow: 0 0 14px rgba(212,180,78,0.3), 0 0 36px rgba(212,180,78,0.12) !important;
}
.dark:not(.dark-mode-disabled) a[href="/"]::before,
.dark:not(.dark-mode-disabled) a[href="/documents"]::before,
.dark:not(.dark-mode-disabled) header a::before {
  background: linear-gradient(90deg, transparent, #D4B44E) !important;
}

/* ── Favicon override ─────────────────────────────────── */
/* Applied via nginx sub_filter in <head> */

/* ── Footer / branding text tweaks ────────────────────── */
/* Hide any "Powered by Documenso" or similar footers */
[class*="powered-by"],
footer a[href*="documenso.com"],
a[href="https://documenso.com"] {
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
}

/* ── Focus ring gold ──────────────────────────────────── */
*:focus-visible {
  outline-color: #B89A3E !important;
}

/* ── Button primary overrides ─────────────────────────── */
.bg-primary {
  background-color: hsl(45 50% 48%) !important;
}
.hover\:bg-primary\/90:hover {
  background-color: hsl(45 50% 43%) !important;
}
.text-primary {
  color: hsl(45 50% 48%) !important;
}
.border-primary {
  border-color: hsl(45 50% 48%) !important;
}
