/*
 * GiGa brand palette for the worker-facing web pages (GIG-78).
 *
 * The Around theme (public/assets/css/theme.min.css) ships a forest-green
 * primary. This sheet is linked right after it in app/layout.tsx and redefines the Bootstrap primary
 * tokens, plus the few components that hard-code the green, for light and
 * dark mode. The values match the mobile app
 * (apps/mobile/constants/Colors.ts: BrandColors.blue = #4371FF).
 *
 * Success, info, warning and danger keep the theme's semantic colours: a
 * green tick still means done, amber still means heads-up.
 *
 * The --giga-* tokens are the surface palette for the hand-written .gig-*
 * rules in globals.css, so those rules read the same in both colour modes.
 */

:root,
[data-bs-theme=light] {
  --ar-primary: #4371FF;
  --ar-primary-rgb: 67, 113, 255;
  --ar-primary-text-emphasis: #2448BF;
  --ar-primary-bg-subtle: #EEF3FF;
  --ar-primary-border-subtle: #C9D7FF;
  --ar-link-color: #2F5BE6;
  --ar-link-color-rgb: 47, 91, 230;
  --ar-link-hover-color: #2448BF;
  --ar-link-hover-color-rgb: 36, 72, 191;
  --ar-focus-ring-color: rgba(67, 113, 255, 0.25);

  --giga-accent: #4371FF;
  --giga-accent-text: #2448BF;
  --giga-accent-soft: #EEF3FF;
  --giga-surface: #ffffff;
  --giga-surface-muted: #f4f6fa;
  --giga-surface-muted-hover: #e9edf4;
  --giga-border: #dfe4ec;
  --giga-text: #121519;
  --giga-text-secondary: #434a57;
  --giga-text-muted: #5b6472;
  --giga-chip-bg: rgba(18, 21, 25, 0.08);
  --giga-shadow-rgb: 18, 21, 25;
}

[data-bs-theme=dark] {
  --ar-primary-text-emphasis: #7C9BFF;
  --ar-primary-bg-subtle: #0E1838;
  --ar-primary-border-subtle: #1F2F66;
  --ar-link-color: #7C9BFF;
  --ar-link-color-rgb: 124, 155, 255;
  --ar-link-hover-color: #9DB4FF;
  --ar-link-hover-color-rgb: 157, 180, 255;

  --giga-accent: #4371FF;
  --giga-accent-text: #7C9BFF;
  --giga-accent-soft: #15214D;
  --giga-surface: #1b2028;
  --giga-surface-muted: #171c23;
  --giga-surface-muted-hover: #1f252e;
  --giga-border: #2a313c;
  --giga-text: #f6f9fc;
  --giga-text-secondary: #d7dde2;
  --giga-text-muted: #a3acba;
  --giga-chip-bg: rgba(255, 255, 255, 0.1);
  --giga-shadow-rgb: 0, 0, 0;
}

/* Buttons: the theme writes the green into the button variables directly. */
.btn-primary {
  --ar-btn-bg: #4371FF;
  --ar-btn-border-color: #4371FF;
  --ar-btn-hover-bg: #2F5BE6;
  --ar-btn-hover-border-color: #2A52D6;
  --ar-btn-focus-shadow-rgb: 95, 141, 255;
  --ar-btn-active-bg: #2448BF;
  --ar-btn-active-border-color: #2040AD;
  --ar-btn-disabled-bg: #4371FF;
  --ar-btn-disabled-border-color: #4371FF;
}

.btn-outline-primary {
  --ar-btn-color: #4371FF;
  --ar-btn-border-color: #4371FF;
  --ar-btn-hover-bg: #4371FF;
  --ar-btn-hover-border-color: #4371FF;
  --ar-btn-focus-shadow-rgb: 67, 113, 255;
  --ar-btn-active-bg: #4371FF;
  --ar-btn-active-border-color: #4371FF;
  --ar-btn-disabled-color: #4371FF;
  --ar-btn-disabled-border-color: #4371FF;
}

[data-bs-theme=dark] .btn-outline-primary {
  --ar-btn-color: #7C9BFF;
  --ar-btn-border-color: #7C9BFF;
  --ar-btn-disabled-color: #7C9BFF;
  --ar-btn-disabled-border-color: #7C9BFF;
}

/* Accordion: the open-state chevron is an inline SVG with the green baked in. */
.accordion,
[data-bs-theme=dark] .accordion-button::after {
  --ar-accordion-btn-active-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234371FF'%3e%3cpath d='M.5 6.3c.6-.6 1.6-.6 2.3 0l9.3 9.3 9.3-9.3c.6-.6 1.6-.6 2.3 0 .6.6.6 1.6 0 2.3L13.3 18.8c-.6.6-1.6.6-2.3 0L.8 8.5c-.9-.8-.9-1.6-.3-2.2z'/%3e%3c/svg%3e");
}

.pagination {
  --ar-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(67, 113, 255, 0.25);
  --ar-pagination-active-border-color: #4371FF;
}

.form-check-input[type=checkbox]:indeterminate {
  background-color: #4371FF;
  border-color: #4371FF;
}

.bg-primary .form-check-input:checked {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%234371FF' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e") !important;
}

.flatpickr-day.selected.startRange + .endRange:not(:nth-child(7n+1)),
.flatpickr-day.startRange.startRange + .endRange:not(:nth-child(7n+1)),
.flatpickr-day.endRange.startRange + .endRange:not(:nth-child(7n+1)) {
  box-shadow: -10px 0 0 #4371FF;
}

/* Focus rings and the link-button focus shadow carry the green as literal RGB. */
.form-select:focus {
  box-shadow: 0 0 0 0 rgba(67, 113, 255, 0.25);
}

.form-check-input:focus,
.nav-link:focus-visible {
  box-shadow: 0 0 0 0.25rem rgba(67, 113, 255, 0.25);
}

.btn-link {
  --ar-btn-focus-shadow-rgb: 95, 141, 255;
}

div.code-toolbar > .toolbar .toolbar-item > span {
  background-color: rgba(67, 113, 255, 0.12);
}

[data-bs-theme=dark] .alert-primary {
  --ar-alert-bg: rgba(67, 113, 255, 0.05);
  --ar-alert-border-color: rgba(67, 113, 255, 0.25);
}
