/*
 * HyperFlow shared design system.
 *
 * Loaded before custom.css / admin.css on every page (signin, signup,
 * dashboard, admin/*). Overrides Bootstrap 5's own CSS variables so existing
 * .btn-primary / .card / .badge / .table markup picks up the new look for
 * free, without touching component JS that depends on Bootstrap's classes
 * and JS API.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* --- Brand: two-tone - green for the plant/leaf side, blue for water/
         irrigation. Both are real, distinct, confidently-used brand colors,
         not one accent plus neutral grays. --- */
  --hf-primary: #0f7a54;
  --hf-primary-dark: #0b5d40;
  --hf-primary-light: #2fa57a;
  --hf-primary-tint: #eaf6f0;

  --hf-water: #0284c7;
  --hf-water-dark: #026aa3;
  --hf-water-light: #38bdf8;
  --hf-water-tint: #e6f6fd;

  /* --- Neutrals --- */
  --hf-bg: #f7f8fa;
  --hf-surface: #ffffff;
  --hf-border: #e5e8ec;
  --hf-text: #1a2027;
  --hf-text-muted: #6b7280;
  --hf-text-subtle: #9aa1ac;

  /* --- Semantic --- */
  --hf-success: #0f7a54;
  --hf-warning: #b45309;
  --hf-warning-bg: #fef3e2;
  --hf-danger: #b3261e;
  --hf-danger-bg: #fdecea;
  --hf-info: var(--hf-water);
  --hf-info-bg: var(--hf-water-tint);

  /* --- Elevation: neutral-tinted, not brand-tinted --- */
  --hf-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --hf-shadow-md: 0 2px 8px rgba(16, 24, 40, 0.08);
  --hf-shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.10);

  --hf-radius-sm: 6px;
  --hf-radius: 10px;
  --hf-radius-lg: 14px;

  /* --- Map onto Bootstrap 5.3's own variables so unstyled components
         (badges, alerts, form controls, buttons) inherit automatically --- */
  --bs-primary: var(--hf-primary);
  --bs-primary-rgb: 15, 122, 84;
  --bs-success: var(--hf-success);
  --bs-success-rgb: 15, 122, 84;
  --bs-warning: var(--hf-warning);
  --bs-danger: var(--hf-danger);
  --bs-danger-rgb: 179, 38, 30;
  --bs-info: var(--hf-info);
  --bs-info-rgb: 2, 132, 199;
  --bs-body-bg: var(--hf-bg);
  --bs-body-color: var(--hf-text);
  --bs-border-color: var(--hf-border);
  --bs-border-radius: var(--hf-radius-sm);
  --bs-border-radius-lg: var(--hf-radius);
  --bs-link-color: var(--hf-primary);
  --bs-link-hover-color: var(--hf-primary-dark);
  --bs-font-sans-serif: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

body {
  font-family: var(--bs-font-sans-serif);
  color: var(--hf-text);
  /* A faint green-blue wash instead of flat gray - felt on every page (this
     is the color of the page itself, not a decoration on top of it), while
     staying light enough that white cards/tables still read as the primary
     surface. */
  background: linear-gradient(160deg, #f4faf7 0%, #f1f8fb 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* --- Cards / panels: colored top edge + tinted header, quiet border.
       A single consistent green top-edge (not an alternating pattern -
       :nth-of-type can't reliably target "every other .card" once cards
       sit inside varying grid/column wrappers, so this stays predictable
       rather than randomly two-toning unrelated cards). The water tone
       shows up elsewhere instead - icons, badges, water-specific tiles,
       .card-header-water below for pages that want to mark a card as the
       "water side" explicitly. --- */
.card {
  background: var(--hf-surface);
  border: 1px solid var(--hf-border);
  border-top: 3px solid var(--hf-primary-light);
  border-radius: var(--hf-radius);
  box-shadow: var(--hf-shadow-sm);
}

.card-header {
  background: var(--hf-primary-tint) !important;
  color: var(--hf-primary-dark);
  border-bottom: 1px solid var(--hf-border);
  font-weight: 700;
}

/* Opt-in water-toned variant, e.g. an irrigation/water-status card next to
   an agriculture/crop one, so the two-tone identity still shows up when a
   page genuinely has both kinds of content side by side. */
.card-header-water {
  background: var(--hf-water-tint) !important;
  color: var(--hf-water-dark) !important;
}

.card.card-water {
  border-top-color: var(--hf-water-light);
}

/* --- Buttons: flat fills, no gradients, gentle lift on hover --- */
.btn {
  border-radius: var(--hf-radius-sm);
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.btn-primary,
.btn-agriculture {
  background: var(--hf-primary);
  border-color: var(--hf-primary);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-agriculture:hover,
.btn-agriculture:focus {
  background: var(--hf-primary-dark);
  border-color: var(--hf-primary-dark);
  color: #fff;
}

.btn-outline-primary {
  border: 1.5px solid var(--hf-primary);
  color: var(--hf-primary);
  background: transparent;
}

.btn-outline-primary:hover {
  background: var(--hf-primary-tint);
  color: var(--hf-primary-dark);
  border-color: var(--hf-primary);
}

.btn:active {
  transform: translateY(1px);
}

/* --- Navbar: solid brand color, not a loud gradient - the platform's one
       constant colored anchor, quiet everywhere else. --- */
.navbar {
  background: var(--hf-primary-dark) !important;
  border-bottom: 1px solid var(--hf-primary-dark);
  box-shadow: var(--hf-shadow-sm);
}

.navbar-brand {
  color: #ffffff !important;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* Brand icon (droplet/water-drop, used throughout as the brand mark) picks
   up the lighter water tone for contrast against the dark navbar. */
.navbar-brand i {
  color: var(--hf-water-light) !important;
}

/* --- Water/leaf utility classes: same pattern as Bootstrap's text-*/bg-*,
       for the two-tone identity anywhere markup wants it explicitly. --- */
.text-agriculture { color: var(--hf-primary) !important; }
.text-water { color: var(--hf-water) !important; }
.bg-agriculture { background: var(--hf-primary) !important; }
.bg-water { background: var(--hf-water) !important; }
.bg-agriculture-tint { background: var(--hf-primary-tint) !important; }
.bg-water-tint { background: var(--hf-water-tint) !important; }
.border-agriculture { border-color: var(--hf-primary) !important; }
.border-water { border-color: var(--hf-water) !important; }

/* Two-tone brand accent (green -> blue): reserved for actual brand
   touchpoints (auth-card top edge, dashboard header) - not overused
   elsewhere, so it reads as an identity mark, not decoration. */
.hf-brand-accent {
  background: linear-gradient(90deg, var(--hf-primary), var(--hf-water));
}

.navbar .nav-link {
  color: rgba(255, 255, 255, 0.82) !important;
  font-weight: 500;
}

.navbar .nav-link.active,
.navbar .nav-link:hover,
.navbar .nav-link:focus {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--hf-radius-sm);
}

/* Secondary text (identity labels, etc.) inside the dark navbar needs a
   lighter tone than the default gray .text-muted, or it disappears. */
.navbar .text-muted {
  color: rgba(255, 255, 255, 0.75) !important;
}

/* --- Tables: quiet header, no harsh borders --- */
.table {
  --bs-table-bg: transparent;
}

.table th {
  background: var(--hf-primary-tint);
  color: var(--hf-primary-dark);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--hf-border);
}

.table td {
  vertical-align: middle;
  border-color: var(--hf-border);
}

.table-hover > tbody > tr:hover > * {
  background: var(--hf-water-tint);
}

/* --- Badges / status pills: tinted background instead of solid saturated fill --- */
.badge {
  font-weight: 600;
  padding: 0.35em 0.65em;
  border-radius: var(--hf-radius-sm);
}

.status-online, .status-success, .bg-success {
  background: var(--hf-primary-tint) !important;
  color: var(--hf-primary-dark) !important;
}

.status-offline, .status-danger, .bg-danger {
  background: var(--hf-danger-bg) !important;
  color: var(--hf-danger) !important;
}

.status-maintenance, .status-warning, .bg-warning {
  background: var(--hf-warning-bg) !important;
  color: var(--hf-warning) !important;
}

.status-error {
  background: var(--hf-danger-bg) !important;
  color: var(--hf-danger) !important;
}

/* --- Forms --- */
.form-control, .form-select {
  border-color: var(--hf-border);
  border-radius: var(--hf-radius-sm);
}

.form-control:focus, .form-select:focus {
  border-color: var(--hf-primary);
  box-shadow: 0 0 0 3px var(--hf-primary-tint);
}

.form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--hf-text);
}

/* --- Alerts: tinted, quiet left border, no gradient --- */
.alert {
  border: 1px solid transparent;
  border-radius: var(--hf-radius-sm);
}

.alert-success { background: var(--hf-primary-tint); color: var(--hf-primary-dark); border-left: 3px solid var(--hf-primary); }
.alert-info { background: var(--hf-info-bg); color: var(--hf-info); border-left: 3px solid var(--hf-info); }
.alert-warning { background: var(--hf-warning-bg); color: var(--hf-warning); border-left: 3px solid var(--hf-warning); }
.alert-danger { background: var(--hf-danger-bg); color: var(--hf-danger); border-left: 3px solid var(--hf-danger); }

/* --- Scrollbar: a muted green tint rather than plain gray - still quiet,
       just not colorless. --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hf-primary-light); opacity: 0.4; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--hf-primary); }

/* --- Page/section titles: a short two-tone underline, the same brand
       accent already used on the auth-card top edge, so page headers read
       as designed rather than a bare heading on white. Opt-in via
       .page-title-accent (applied by admin_layout_header() and the main
       dashboard's view headers) rather than every h1/h2 on the page, so it
       stays a deliberate touchpoint, not decoration on every heading. --- */
.page-title-accent {
  position: relative;
  padding-bottom: 0.6rem;
  margin-bottom: 1.1rem;
}

.page-title-accent::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--hf-primary), var(--hf-water));
}
