/*
  Range Shoot Log: brand + style options
  ======================================
  Loaded last. Three looks, chosen in Settings → Appearance → Style
  (or with ?style=classic | studio | studio-navy in the address):

  A. classic      Current layout in Range colours (blue #287ABD, navy #10314C,
                  Optima headings like range.ae).
  B. studio       The colleague's suggestion: warm off-white, charcoal
                  buttons, white cards with fine borders, bold titles.
  C. studio-navy  The colleague's suggestion in Range navy, with the
                  terracotta accent from range.ae.

  Brand colours taken from range.ae:
    navy #10314C · blue #287ABD · slate #5A6A81 · terracotta #996759
    mist #F6F7F9 · line #C5CFDD
*/

:root {
  --range-navy: #10314c;
  --range-blue: #287abd;
  --range-slate: #5a6a81;
  --range-terracotta: #996759;
  --range-mist: #f6f7f9;
  --on-primary: #ffffff;
  --range-title-font: var(--app-font);
  --range-hero-bg: linear-gradient(135deg, #10314c 0%, #1b4a72 58%, #287abd 140%);
  --range-hero-pill-bg: rgba(255, 255, 255, 0.14);
  --range-hero-pill-text: #ffffff;
  --range-card-radius: 18px;
}

/* ---------- A. Classic (Range colours), light ---------- */
:root,
:root[data-style="classic"] {
  --color-bg: #f6f7f9;
  --color-surface-soft: #fafbfc;
  --color-surface-muted: #eef1f5;
  --color-border: #dfe5ee;
  --color-divider: #edf0f4;
  --color-divider-strong: #e6eaf0;
  --color-text: #10314c;
  --color-text-muted: #5a6a81;
  --color-text-light: #8998ae;
  --color-primary: #287abd;
  --color-primary-soft: #e8f1f9;
  --color-primary-soft-2: #e8f1f9;
  --color-primary-soft-3: #d6e6f4;
  --color-primary-bg: #eef5fb;
  --color-primary-border: rgba(40, 122, 189, 0.18);
  --color-primary-border-strong: rgba(40, 122, 189, 0.24);
  --color-primary-icon-border: rgba(40, 122, 189, 0.06);
  --color-primary-tint: rgba(40, 122, 189, 0.08);
  --color-primary-glow: rgba(40, 122, 189, 0.12);
  --focus-border: rgba(40, 122, 189, 0.55);
  --focus-border-strong: rgba(40, 122, 189, 0.72);
  --focus-ring: rgba(40, 122, 189, 0.14);
  --color-nav-bg: rgba(255, 255, 255, 0.9);
  --range-title-font: Optima, "Optima Nova", Candara, "Segoe UI", var(--app-font);
}

/* ---------- B. Studio (colleague's suggestion), light ---------- */
:root[data-style="studio"] {
  --color-bg: #f6f6f4;
  --color-surface: #ffffff;
  --color-surface-soft: #fafaf8;
  --color-surface-muted: #efefec;
  --color-border: #e7e6e1;
  --color-divider: #efeeea;
  --color-divider-strong: #e9e8e3;
  --color-text: #222222;
  --color-text-muted: #6d6d68;
  --color-text-light: #a3a39e;
  --color-primary: #2b2b2b;
  --color-primary-soft: #ededea;
  --color-primary-soft-2: #ededea;
  --color-primary-soft-3: #e2e2de;
  --color-primary-bg: #f1f1ee;
  --color-primary-border: rgba(0, 0, 0, 0.1);
  --color-primary-border-strong: rgba(0, 0, 0, 0.16);
  --color-primary-icon-border: rgba(0, 0, 0, 0.04);
  --color-primary-tint: rgba(0, 0, 0, 0.05);
  --color-primary-glow: rgba(0, 0, 0, 0.06);
  --focus-border: rgba(0, 0, 0, 0.5);
  --focus-border-strong: rgba(0, 0, 0, 0.7);
  --focus-ring: rgba(0, 0, 0, 0.08);
  --color-nav-bg: rgba(255, 255, 255, 0.94);
  --range-title-font: var(--app-font);
  --range-hero-bg: #2b2b2b;
  --range-card-radius: 20px;
}

/* ---------- C. Studio in Range navy, light ---------- */
:root[data-style="studio-navy"] {
  /* Studio layout in the Range logo blue (#287ABD) */
  --color-bg: #f6f7f9;
  --color-surface: #ffffff;
  --color-surface-soft: #fafbfc;
  --color-surface-muted: #eef2f7;
  --color-border: #e1e6ee;
  --color-divider: #edf0f4;
  --color-divider-strong: #e6eaf0;
  --color-text: #15293d;
  --color-text-muted: #5a6a81;
  --color-text-light: #8998ae;
  --color-primary: #287abd;
  --color-primary-soft: #e8f1f9;
  --color-primary-soft-2: #e8f1f9;
  --color-primary-soft-3: #d6e6f4;
  --color-primary-bg: #eef5fb;
  --color-primary-border: rgba(40, 122, 189, 0.18);
  --color-primary-border-strong: rgba(40, 122, 189, 0.26);
  --color-primary-icon-border: rgba(40, 122, 189, 0.06);
  --color-primary-tint: rgba(40, 122, 189, 0.08);
  --color-primary-glow: rgba(40, 122, 189, 0.12);
  --focus-border: rgba(40, 122, 189, 0.55);
  --focus-border-strong: rgba(40, 122, 189, 0.75);
  --focus-ring: rgba(40, 122, 189, 0.16);
  --color-nav-bg: rgba(255, 255, 255, 0.94);
  --range-title-font: var(--app-font);
  --range-hero-bg: #287abd;
  --range-hero-pill-bg: rgba(255, 255, 255, 0.18);
  --range-card-radius: 20px;
}

/* ---------- Dark versions ---------- */
:root[data-theme="dark"] {
  --color-primary: #4c9be0;
  --range-hero-bg: linear-gradient(135deg, #0b2236 0%, #10314c 60%, #1d5a8c 140%);
  --focus-ring: rgba(76, 155, 224, 0.2);
}
:root[data-theme="dark"][data-style="studio"] {
  --color-bg: #111111;
  --color-surface: #1c1c1c;
  --color-surface-soft: #222222;
  --color-surface-muted: #2a2a2a;
  --color-border: #333333;
  --color-divider: #2a2a2a;
  --color-text: #f2f2ef;
  --color-text-muted: #a6a6a1;
  --color-primary: #ececea;
  --color-primary-soft: rgba(255, 255, 255, 0.1);
  --color-primary-soft-2: rgba(255, 255, 255, 0.1);
  --color-primary-soft-3: rgba(255, 255, 255, 0.16);
  --color-primary-bg: rgba(255, 255, 255, 0.08);
  --on-primary: #151515;
  --range-hero-bg: #262626;
}
:root[data-theme="dark"][data-style="studio-navy"] {
  --color-bg: #07131e;
  --color-surface: #0f2133;
  --color-surface-soft: #13283d;
  --color-surface-muted: #183049;
  --color-border: #22405d;
  --color-divider: #183049;
  --color-text: #eef3f8;
  --color-text-muted: #9fb1c6;
  --color-primary: #3a8fd6;
  --color-primary-soft: rgba(58, 143, 214, 0.18);
  --color-primary-soft-2: rgba(58, 143, 214, 0.18);
  --color-primary-soft-3: rgba(58, 143, 214, 0.26);
  --color-primary-bg: rgba(58, 143, 214, 0.12);
  --on-primary: #ffffff;
  --range-hero-bg: #1f6aa8;
  --color-nav-bg: rgba(15, 33, 51, 0.92);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary: #4c9be0;
    --range-hero-bg: linear-gradient(135deg, #0b2236 0%, #10314c 60%, #1d5a8c 140%);
    --focus-ring: rgba(76, 155, 224, 0.2);
  }
  :root:not([data-theme="light"])[data-style="studio"] {
    --color-bg: #111111;
    --color-surface: #1c1c1c;
    --color-surface-soft: #222222;
    --color-surface-muted: #2a2a2a;
    --color-border: #333333;
    --color-divider: #2a2a2a;
    --color-text: #f2f2ef;
    --color-text-muted: #a6a6a1;
    --color-primary: #ececea;
    --color-primary-soft: rgba(255, 255, 255, 0.1);
    --color-primary-soft-2: rgba(255, 255, 255, 0.1);
    --color-primary-soft-3: rgba(255, 255, 255, 0.16);
    --color-primary-bg: rgba(255, 255, 255, 0.08);
    --on-primary: #151515;
    --range-hero-bg: #262626;
  }
  :root:not([data-theme="light"])[data-style="studio-navy"] {
    --color-bg: #07131e;
    --color-surface: #0f2133;
    --color-surface-soft: #13283d;
    --color-surface-muted: #183049;
    --color-border: #22405d;
    --color-divider: #183049;
    --color-text: #eef3f8;
    --color-text-muted: #9fb1c6;
    --color-primary: #3a8fd6;
    --color-primary-soft: rgba(58, 143, 214, 0.18);
    --color-primary-soft-2: rgba(58, 143, 214, 0.18);
    --color-primary-soft-3: rgba(58, 143, 214, 0.26);
    --color-primary-bg: rgba(58, 143, 214, 0.12);
    --on-primary: #ffffff;
    --range-hero-bg: #1f6aa8;
  --color-nav-bg: rgba(15, 33, 51, 0.92);
  }
}

/* ---------- Shared brand rules ---------- */

/* Text on the brand colour follows the style (white, or dark in Studio dark). */
.primary-btn,
.add-btn,
.bottom-nav button.active,
.view-toggle button.active,
.settings-toggle button.active,
.appearance-segment button.active {
  color: var(--on-primary) !important;
}

/* Page titles */
h1,
.report-header h1 {
  font-family: var(--range-title-font);
}
:root[data-style="classic"] h1,
:root:not([data-style]) h1 {
  font-weight: 500;
  letter-spacing: -0.01em;
}
:root[data-style="studio"] h1,
:root[data-style="studio-navy"] h1 {
  font-weight: 700;
  letter-spacing: -0.045em;
}

/* Brand mark above the Bookings title */
.range-brand {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 4px;
  line-height: 1;
  color: var(--range-blue);
  user-select: none;
}
.range-brand b {
  font: 900 21px/0.9 "Arial Black", "Helvetica Neue", var(--app-font);
  font-stretch: expanded;
  letter-spacing: 0.01em;
  transform: scaleX(1.18);
  transform-origin: left center;
}
.range-brand small {
  font: 500 7.6px/1 var(--app-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: inherit;
}
:root[data-style="studio"] .range-brand { color: var(--color-text); }
:root[data-style="studio-navy"] .range-brand { color: var(--range-blue); }
:root[data-theme="dark"] .range-brand { color: #8cc0ea; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .range-brand { color: #8cc0ea; }
}

/* Next Booking card in brand colours */
.booking-next-card,
.booking-next-card.has-banner-image {
  background: var(--range-hero-bg) !important;
  border-color: transparent !important;
  color: #ffffff;
}
.booking-next-card .booking-next-property,
.booking-next-card .booking-next-time-group strong,
.booking-next-card .booking-next-time-group,
.booking-next-card .booking-next-date {
  color: #ffffff !important;
}
.booking-next-card .booking-next-meta {
  color: rgba(255, 255, 255, 0.72) !important;
}
.booking-next-card .booking-next-pill {
  background: var(--range-hero-pill-bg) !important;
  color: var(--range-hero-pill-text) !important;
  border-color: transparent !important;
}
.booking-next-card::after {
  opacity: 0.5;
  filter: brightness(2.4) saturate(0);
}
/* Banner: the card's text side stays solid Range blue, fading into the image. */
.booking-next-image img { object-position: right center; }
.booking-next-image::after {
  background: linear-gradient(90deg, rgba(40, 122, 189, 0.95) 0%, rgba(40, 122, 189, 0.72) 40%, rgba(40, 122, 189, 0.08) 100%) !important;
}
:root[data-style="studio"] .booking-next-image::after {
  background: linear-gradient(90deg, rgba(30, 30, 30, 0.9) 0%, rgba(30, 30, 30, 0.6) 45%, rgba(30, 30, 30, 0.1) 100%) !important;
}

/* ---------- Studio shapes (B and C) ---------- */
:root[data-style="studio"] .booking-compact-card,
:root[data-style="studio"] .record-card,
:root[data-style="studio"] .card,
:root[data-style="studio"] .settings-menu-card,
:root[data-style="studio"] .stats > div,
:root[data-style="studio-navy"] .booking-compact-card,
:root[data-style="studio-navy"] .record-card,
:root[data-style="studio-navy"] .card,
:root[data-style="studio-navy"] .settings-menu-card,
:root[data-style="studio-navy"] .stats > div {
  border: 1px solid var(--color-border) !important;
  border-radius: var(--range-card-radius) !important;
  box-shadow: none !important;
}
:root[data-style="studio"] .bottom-nav,
:root[data-style="studio-navy"] .bottom-nav {
  border: 1px solid var(--color-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}
:root[data-style="studio"] .primary-btn,
:root[data-style="studio-navy"] .primary-btn {
  border-radius: 999px;
}
:root[data-style="studio"] input,
:root[data-style="studio"] select,
:root[data-style="studio-navy"] input,
:root[data-style="studio-navy"] select {
  border-radius: 14px;
}

/* ---------- Style picker in Settings → Appearance ---------- */
.range-style-picker {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.range-style-card {
  margin-top: 10px;
}
.range-style-picker button {
  display: grid;
  gap: 6px;
  justify-items: start;
  padding: 10px;
  border: 1.5px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  font: 600 12px/1.2 var(--app-font);
  text-align: left;
  cursor: pointer;
}
.range-style-picker button small {
  font-weight: 400;
  color: var(--color-text-muted);
}
.range-style-picker button[aria-checked="true"] {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.range-style-swatch {
  display: flex;
  gap: 3px;
}
.range-style-swatch i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
