/* ── Wurzel Tankstelle – Greehill-inspired Design System ──────────────────── */

:root {
  /* Greehill Forest Green palette */
  --wt-primary:       #2E7D32;
  --wt-primary-dark:  #1B5E20;
  --wt-primary-mid:   #388E3C;
  --wt-accent:        #4CAF50;
  --wt-pale:          #A5D6A7;
  --wt-surface:       #D4C9A0;
  --wt-bg:            #3D4A2E;
  --wt-border:        #B0A078;
  --wt-text-muted:    #5a7c5a;

  /* Logo-Blau als Akzent */
  --wt-blue:          #1B7EC2;
  --wt-blue-dark:     #155f96;
  --wt-blue-light:    #d0e8f7;

  /* Bootstrap-Overrides: primary → Forest Green */
  --bs-primary:             var(--wt-primary);
  --bs-primary-rgb:         46, 125, 50;
  --bs-primary-bg-subtle:   var(--wt-surface);
  --bs-primary-border-subtle: var(--wt-border);
  --bs-primary-text-emphasis: var(--wt-primary-dark);

  --bs-success:             var(--wt-accent);
  --bs-success-rgb:         76, 175, 80;
  --bs-success-bg-subtle:   var(--wt-surface);
  --bs-success-border-subtle: var(--wt-border);
  --bs-success-text-emphasis: var(--wt-primary);

  --bs-link-color:       var(--wt-primary);
  --bs-link-hover-color: var(--wt-primary-dark);

  --bs-card-border-color: var(--wt-border);
  --bs-border-radius:    0.5rem;
}

/* ── Global ─────────────────────────────────────────────────────────────── */
body {
  background-color: var(--wt-bg);
  font-size: 0.925rem;
  color: #1a2e1a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ── Navbar ──────────────────────────────────────────────────────────────── */
.navbar-wt {
  background: linear-gradient(135deg, var(--wt-primary-dark) 0%, var(--wt-primary) 55%, var(--wt-blue-dark) 100%) !important;
  border-bottom: 3px solid var(--wt-blue);
}

.navbar-wt .navbar-brand img {
  filter: brightness(1.1) drop-shadow(0 1px 3px rgba(0,0,0,.3));
}

.navbar-wt .nav-link {
  border-radius: 0.375rem;
  padding: 0.35rem 0.75rem !important;
  transition: background 0.15s ease;
}

.navbar-wt .nav-link:hover {
  background: rgba(255,255,255,.12);
}

.navbar-wt .nav-link.active {
  background: rgba(255,255,255,.2);
  font-weight: 600;
}

.navbar-brand {
  font-size: 1.05rem;
  letter-spacing: .02em;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  --bs-btn-bg:           var(--wt-primary);
  --bs-btn-border-color: var(--wt-primary);
  --bs-btn-hover-bg:     var(--wt-primary-dark);
  --bs-btn-hover-border-color: var(--wt-primary-dark);
  --bs-btn-active-bg:    var(--wt-primary-dark);
  --bs-btn-focus-shadow-rgb: 46, 125, 50;
}

.btn-outline-primary {
  --bs-btn-color:        var(--wt-primary);
  --bs-btn-border-color: var(--wt-primary);
  --bs-btn-hover-bg:     var(--wt-primary);
  --bs-btn-hover-border-color: var(--wt-primary);
  --bs-btn-active-bg:    var(--wt-primary-dark);
  --bs-btn-focus-shadow-rgb: 46, 125, 50;
}

.btn-success {
  --bs-btn-bg:           var(--wt-accent);
  --bs-btn-border-color: var(--wt-accent);
  --bs-btn-hover-bg:     var(--wt-primary);
  --bs-btn-hover-border-color: var(--wt-primary);
  --bs-btn-active-bg:    var(--wt-primary-dark);
  --bs-btn-focus-shadow-rgb: 76, 175, 80;
}

.btn-outline-success {
  --bs-btn-color:        var(--wt-primary);
  --bs-btn-border-color: var(--wt-primary);
  --bs-btn-hover-bg:     var(--wt-primary);
  --bs-btn-hover-border-color: var(--wt-primary);
  --bs-btn-active-bg:    var(--wt-primary-dark);
  --bs-btn-focus-shadow-rgb: 46, 125, 50;
}

/* ── Badges / Colors ─────────────────────────────────────────────────────── */
.bg-success        { background-color: var(--wt-accent)   !important; }
.bg-primary        { background-color: var(--wt-primary)  !important; }
.bg-success-subtle { background-color: var(--wt-surface)  !important; }
.bg-primary-subtle { background-color: var(--wt-surface)  !important; }

.text-success            { color: var(--wt-primary)      !important; }
.text-primary            { color: var(--wt-primary)      !important; }
.text-success-emphasis   { color: var(--wt-primary-dark) !important; }
.text-primary-emphasis   { color: var(--wt-primary-dark) !important; }

.border-success { border-color: var(--wt-accent)   !important; }
.border-primary { border-color: var(--wt-primary)  !important; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert-success {
  --bs-alert-color:      var(--wt-primary-dark);
  --bs-alert-bg:         var(--wt-surface);
  --bs-alert-border-color: var(--wt-pale);
}

/* ── Form focus ──────────────────────────────────────────────────────────── */
.form-control:focus,
.form-select:focus {
  border-color: var(--wt-primary);
  box-shadow: 0 0 0 .25rem rgba(46, 125, 50, .2);
}

/* ── Cards (global) ──────────────────────────────────────────────────────── */
.card {
  border-color: var(--wt-border);
  background-color: #fff;
}

.card-header.bg-white {
  border-bottom: 1px solid var(--wt-border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--wt-primary-dark);
}

/* ── Device Cards ────────────────────────────────────────────────────────── */
.device-card {
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  cursor: pointer;
  border: 1px solid var(--wt-border);
}

.device-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 .5rem 1.5rem rgba(46,125,50,.15) !important;
  border-color: var(--wt-primary);
}

/* ── Page Header ─────────────────────────────────────────────────────────── */
.page-header {
  background: linear-gradient(135deg, var(--wt-primary-dark) 0%, var(--wt-primary) 50%, var(--wt-blue-dark) 100%);
  color: white;
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 16px rgba(27,94,32,.3);
}

.page-header h4,
.page-header h5 {
  margin-bottom: 0;
  color: white;
  font-weight: 700;
}

.page-header .text-muted {
  color: rgba(255,255,255,.65) !important;
}

.page-header a {
  color: rgba(255,255,255,.85);
  text-decoration: none;
}

.page-header a:hover {
  color: white;
  text-decoration: underline;
}

.page-header .breadcrumb-item + .breadcrumb-item::before {
  color: rgba(255,255,255,.45);
}

.page-header .breadcrumb-item.active {
  color: rgba(255,255,255,.55);
}

/* ── Section Header ──────────────────────────────────────────────────────── */
.section-header {
  background: linear-gradient(90deg, var(--wt-primary) 0%, var(--wt-blue-dark) 100%);
  color: white;
  padding: 0.45rem 0.9rem;
  border-radius: 0.4rem;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Value Cards (Sensor readings) ───────────────────────────────────────── */
.value-card {
  border: 1px solid var(--wt-border);
  background: linear-gradient(145deg, #fff 0%, var(--wt-surface) 100%);
  border-radius: 0.6rem;
}

.value-card .value-label {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--wt-text-muted);
  font-weight: 600;
}

.value-card .value-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--wt-primary-dark);
  line-height: 1.1;
}

.value-card .value-unit {
  font-size: 0.85rem;
  color: var(--wt-text-muted);
}

/* ── Status Dot ──────────────────────────────────────────────────────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  flex-shrink: 0;
}

.status-dot.online  { background: var(--wt-accent); box-shadow: 0 0 0 3px rgba(76,175,80,.25); }
.status-dot.offline { background: #ef5350;          box-shadow: 0 0 0 3px rgba(239,83,80,.2); }
.status-dot.unknown { background: #9e9e9e; }

/* ── Moisture Progress Bar ───────────────────────────────────────────────── */
.moisture-bar {
  height: 5px;
  border-radius: 3px;
  background: #dceedd;
  overflow: hidden;
  margin-top: 6px;
}

.moisture-bar .fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--wt-primary) 0%, var(--wt-accent) 100%);
  transition: width 0.6s ease;
}

/* ── Table ───────────────────────────────────────────────────────────────── */
.table-light th {
  background-color: var(--wt-surface);
  border-color: var(--wt-border);
  color: var(--wt-primary-dark);
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

/* ── List Group ──────────────────────────────────────────────────────────── */
.list-group-item-action {
  border-left: 3px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.list-group-item-action:hover {
  background-color: var(--wt-surface);
  border-left-color: var(--wt-primary);
}

/* ── KPI Stat Cards (Admin) ──────────────────────────────────────────────── */
.kpi-card {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--wt-border);
}

.kpi-card .kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* ── Spinner in Value-Cards ──────────────────────────────────────────────── */
#current-values .h3 .spinner-border {
  width: 1.2rem;
  height: 1.2rem;
}

.font-monospace {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  font-size: 0.85em;
}

.dropdown-divider { border-color: rgba(0,0,0,.08); }
