/* ========== DASHBOARD PAGE ========== */

/* Morning Briefing Banner */
.morning-briefing-widget {
  background: linear-gradient(135deg, var(--surface2) 0%, var(--surface) 100%);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 24px; margin-bottom: 16px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 20px;
  border-left: 4px solid var(--primary);
}
.mb-left { flex: 1; min-width: 0; }
.mb-greeting { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.mb-date { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; }
.mb-quote {
  font-size: 12px; color: var(--text-dim); font-style: italic;
  border-left: 2px solid var(--primary-glow, var(--primary));
  padding-left: 10px; opacity: 0.7;
}
.mb-stats {
  display: flex; gap: 16px; align-items: center; flex-shrink: 0;
}
.mb-stat { text-align: center; }
.mb-stat-val { font-size: 18px; font-weight: 800; color: var(--primary); }
.mb-stat-label { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
/* Score ring */
.mb-score-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 18px; border-left: 1px solid var(--border); border-right: 1px solid var(--border); flex-shrink: 0; }
.mb-score-ring { width: 62px; height: 62px; border-radius: 50%; border: 3px solid var(--primary); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.mb-score-val { font-size: 20px; font-weight: 900; line-height: 1.1; }
.mb-score-pts { font-size: 9px; color: var(--text-dim); text-transform: uppercase; line-height: 1; }
.mb-score-tag { font-size: 10px; color: var(--text-dim); text-align: center; white-space: nowrap; }
@media (max-width: 600px) {
  .morning-briefing-widget { flex-direction: column; align-items: flex-start; }
  .mb-score-wrap { flex-direction: row; border: none; padding: 0; gap: 10px; }
  .mb-score-ring { width: 48px; height: 48px; }
  .mb-score-val { font-size: 16px; }
  .mb-stats { width: 100%; justify-content: space-around; }
  .mb-greeting { font-size: 16px; }
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}
.kpi-card:hover {
  border-color: var(--primary);
  box-shadow: 0 0 30px rgba(0,212,255,0.08);
  transform: translateY(-2px);
}
.kpi-card::after {
  content: '';
  position: absolute; top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.15;
}
.kpi-card.blue::after { background: var(--primary); }
.kpi-card.purple::after { background: var(--accent); }
.kpi-card.green::after { background: var(--success); }
.kpi-card.orange::after { background: var(--warning); }
.kpi-card.gold::after { background: #ffd700; }
.kpi-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.kpi-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.kpi-icon.blue { background: var(--primary-dim); }
.kpi-icon.purple { background: var(--accent-dim); }
.kpi-icon.green { background: var(--success-dim); }
.kpi-icon.orange { background: var(--warning-dim); }
.kpi-icon.gold { background: rgba(255, 215, 0, 0.1); color: #ffd700; }
.kpi-trend { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
.kpi-trend.up { background: var(--success-dim); color: var(--success); }
.kpi-trend.down { background: var(--error-dim); color: var(--error); }
.kpi-trend.neutral { background: rgba(156,163,175,0.15); color: var(--text-muted); }
.kpi-value {
  font-size: 32px; font-weight: 800; letter-spacing: -1px; line-height: 1;
  background: linear-gradient(135deg, var(--text) 40%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Quick Stats Row */
.dash-quick-stats {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px; align-items: center;
}
.dash-quick-stat {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 7px 12px; font-size: 12px;
  color: var(--text-muted); white-space: nowrap; transition: all 0.15s;
}
.dash-quick-stat:hover { border-color: var(--primary); color: var(--text); }
.dash-quick-stat.done { border-color: var(--success); background: var(--success-dim); color: var(--success); }
.dash-quick-stat.done .dash-quick-stat-val { color: var(--success); }
.dash-quick-stat-val {
  font-weight: 700; color: var(--primary); font-size: 13px;
}
.dash-quick-stat-icon { font-size: 14px; }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .kpi-value { font-size: 24px; }
  .dash-grid { grid-template-columns: 1fr; }
  .weather-temp { font-size: clamp(28px, 9vw, 36px); }
  .weather-main { flex-wrap: wrap; gap: 10px; }
}

/* Status items */
.status-list { display: flex; flex-direction: column; gap: 8px; }
.status-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--surface2);
  transition: all 0.15s;
}
.status-item:hover { background: var(--surface3); }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online { background: var(--success); box-shadow: 0 0 8px var(--success); }
.status-dot.offline { background: var(--error); box-shadow: 0 0 8px var(--error); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 8px var(--warning); }
.status-dot.checking { background: var(--text-dim); animation: blink-dot 1s ease-in-out infinite; }
@keyframes blink-dot { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.status-name { font-size: 13px; font-weight: 500; flex: 1; }
.status-badge {
  font-size: 10px; font-weight: 600; padding: 3px 8px;
  border-radius: 20px; white-space: nowrap;
}
.status-badge.online { background: var(--success-dim); color: var(--success); }
.status-badge.offline { background: var(--error-dim); color: var(--error); }
.status-badge.warning { background: var(--warning-dim); color: var(--warning); }
.status-badge.checking { background: rgba(107,114,128,0.2); color: var(--text-dim); }
.status-dot.neutral { background: var(--text-dim); box-shadow: none; }
.status-badge.neutral { background: rgba(107,114,128,0.2); color: var(--text-muted); }

/* Activity feed */
.activity-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 32px; height: 32px; min-width: 32px;
  border-radius: 8px; display: flex;
  align-items: center; justify-content: center;
  font-size: 14px;
}
.activity-text { font-size: 13px; line-height: 1.5; }
.activity-time { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* Weather widget — Enhanced (Current + Hourly + Weekly) */
.weather-tabs {
  display: flex; gap: 4px; margin-bottom: 12px;
  background: var(--surface2); border-radius: 10px; padding: 3px;
}
.weather-tab {
  flex: 1; padding: 6px 6px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-muted); font-size: 11px;
  font-weight: 600; cursor: pointer; transition: all 0.2s;
  text-align: center; white-space: nowrap;
}
.weather-tab:hover { color: var(--text); background: var(--surface3); }
.weather-tab.active {
  background: var(--primary); color: #fff;
  box-shadow: 0 2px 8px rgba(0,212,255,0.25);
}
.weather-panel { display: none; }
.weather-panel.active { display: block; animation: fadeInWeather 0.25s ease; }
@keyframes fadeInWeather { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.weather-main { display: flex; align-items: center; gap: 16px; }
.weather-temp { font-size: 48px; font-weight: 800; letter-spacing: -2px; white-space: nowrap; }
.weather-desc { font-size: 13px; color: var(--text-muted); }
.weather-feels { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.weather-updated { font-size: 10px; color: var(--text-dim); margin-top: 10px; text-align: right; opacity: 0.7; }

.weather-details-row {
  display: flex; gap: 10px; margin-top: 12px;
}
.weather-detail-card {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: 8px; border-radius: 10px; background: var(--surface2);
  gap: 2px;
}
.weather-detail-icon { font-size: 16px; }
.weather-detail-val { font-size: 14px; font-weight: 700; color: var(--text); }
.weather-detail-label { font-size: 10px; color: var(--text-dim); }

/* Hourly forecast */
.weather-hourly-scroll {
  display: flex; gap: 6px; overflow-x: auto; padding: 4px 0;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.weather-hourly-scroll::-webkit-scrollbar { height: 4px; }
.weather-hourly-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.weather-hour-card {
  flex: 0 0 auto; min-width: 56px; display: flex; flex-direction: column;
  align-items: center; gap: 4px; padding: 8px 6px; border-radius: 10px;
  background: var(--surface2); transition: all 0.15s; cursor: default;
}
.weather-hour-card:hover { background: var(--surface3); transform: translateY(-1px); }
.weather-hour-card.now {
  background: var(--primary-dim); border: 1px solid var(--primary);
}
.weather-hour-time { font-size: 10px; color: var(--text-dim); font-weight: 600; white-space: nowrap; }
.weather-hour-icon { font-size: 18px; }
.weather-hour-temp { font-size: 13px; font-weight: 700; color: var(--text); }
.weather-hour-precip { font-size: 9px; color: var(--info, #60a5fa); }

/* Weekly forecast */
.weather-weekly-list { display: flex; flex-direction: column; gap: 4px; }
.weather-day-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: 8px; transition: background 0.15s;
}
.weather-day-row:hover { background: var(--surface2); }
.weather-day-row.today {
  background: var(--primary-dim); border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}
.weather-day-name {
  width: 54px; font-size: 12px; font-weight: 600; color: var(--text);
  display: flex; flex-direction: column;
}
.weather-day-date { font-size: 9px; color: var(--text-dim); font-weight: 400; }
.weather-day-icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.weather-day-min { font-size: 12px; color: var(--text-dim); width: 30px; text-align: right; }
.weather-day-max { font-size: 12px; font-weight: 700; color: var(--text); width: 30px; text-align: left; }
.weather-day-bar-wrap {
  flex: 1; height: 4px; background: var(--surface2); border-radius: 2px;
  position: relative; min-width: 40px;
}
.weather-day-bar {
  position: absolute; top: 0; height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--info, #60a5fa), var(--warning, #f59e0b));
}
.weather-day-precip { font-size: 9px; color: var(--info, #60a5fa); width: 32px; text-align: right; }

@media (max-width: 600px) {
  .weather-temp { font-size: 36px; }
  .weather-hour-card { min-width: 48px; padding: 6px 4px; }
  .weather-day-name { width: 44px; font-size: 11px; }
  .weather-day-bar-wrap { min-width: 24px; }
}

/* ========== Rainfall Bar Chart ========== */
.rainfall-toggle {
  display: flex; gap: 4px; margin-bottom: 12px;
  background: var(--surface2); border-radius: 8px; padding: 2px;
}
.rainfall-toggle-btn {
  flex: 1; padding: 5px 8px; border: none; border-radius: 6px;
  background: transparent; color: var(--text-muted); font-size: 11px;
  font-weight: 600; cursor: pointer; transition: all 0.2s; text-align: center;
}
.rainfall-toggle-btn:hover { color: var(--text); background: var(--surface3); }
.rainfall-toggle-btn.active { background: var(--primary); color: #fff; }

.rainfall-chart-wrap { margin-bottom: 10px; }

.rainfall-bars-scroll {
  display: flex; gap: 3px; overflow-x: auto; padding: 4px 0;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  align-items: flex-end;
}
.rainfall-bars-scroll::-webkit-scrollbar { height: 4px; }
.rainfall-bars-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.rainfall-bars-daily {
  display: flex; gap: 8px; justify-content: space-between; padding: 4px 0;
  align-items: flex-end;
}

.rainfall-bar-col {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 28px; flex: 0 0 auto;
}
.rainfall-bar-col.daily {
  flex: 1; min-width: 40px;
}
.rainfall-bar-col.daily.today {
  background: var(--primary-dim); border-radius: 8px; padding: 4px 2px;
}

.rainfall-bar-value {
  font-size: 9px; font-weight: 600; color: var(--text-muted);
  height: 14px; line-height: 14px; white-space: nowrap;
}

.rainfall-bar-container {
  width: 18px; height: 80px; background: var(--surface2); border-radius: 4px 4px 2px 2px;
  position: relative; overflow: hidden; display: flex; align-items: flex-end;
}
.rainfall-bar-container.daily {
  width: 100%; max-width: 48px; height: 100px;
}

.rainfall-bar {
  width: 100%; border-radius: 3px 3px 0 0;
  transition: height 0.4s ease, background 0.3s ease;
  min-height: 0;
}

.rainfall-bar-label {
  font-size: 9px; color: var(--text-dim); font-weight: 600; white-space: nowrap;
}
.rainfall-bar-prob {
  font-size: 8px; color: var(--info, #60a5fa); height: 12px;
}
.rainfall-bar-date {
  font-size: 8px; color: var(--text-dim);
}

.rainfall-summary {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 6px 0; flex-wrap: wrap;
}
.rainfall-summary-item {
  display: flex; flex-direction: column; gap: 1px;
}
.rainfall-summary-val {
  font-size: 16px; font-weight: 700; color: var(--primary);
}
.rainfall-summary-label {
  font-size: 10px; color: var(--text-dim);
}
.rainfall-legend {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.rainfall-legend-item {
  display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-muted);
}
.rainfall-legend-dot {
  width: 8px; height: 8px; border-radius: 2px; display: inline-block;
}

/* ========== AgroVision Insights ========== */
.agro-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.agro-card {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px; background: var(--surface2); border-radius: 10px;
  transition: all 0.15s;
}
.agro-card:hover { background: var(--surface3); transform: translateY(-1px); }
.agro-card.alert {
  border: 1px solid var(--error); background: color-mix(in srgb, var(--error) 8%, var(--surface2));
}
.agro-card-icon { font-size: 24px; flex-shrink: 0; margin-top: 2px; }
.agro-card-body { flex: 1; min-width: 0; }
.agro-card-title {
  font-size: 10px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600; margin-bottom: 3px;
}
.agro-card-value { font-size: 14px; font-weight: 700; color: var(--text); }
.agro-card-detail { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.agro-progress-bar {
  height: 4px; background: var(--surface); border-radius: 2px;
  overflow: hidden; margin-top: 6px;
}
.agro-progress-fill {
  height: 100%; border-radius: 2px; transition: width 0.5s ease;
}

@media (max-width: 600px) {
  .rainfall-bar-container { height: 60px; width: 14px; }
  .rainfall-bar-container.daily { height: 70px; }
  .rainfall-bar-value { font-size: 8px; }
  .agro-grid { grid-template-columns: 1fr; }
  .agro-card { padding: 10px; }
}

/* Habit Tracker */
.habit-progress-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.habit-progress-bar-bg {
  flex: 1; height: 6px; background: var(--surface2);
  border-radius: 3px; overflow: hidden;
}
.habit-progress-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }
.habit-progress-label { font-size: 11px; color: var(--text-dim); min-width: 28px; text-align: right; }
.habit-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
  transition: opacity 0.2s;
}
.habit-item:last-child { border-bottom: none; }
.habit-item.done { opacity: 0.6; }
.habit-check {
  width: 30px; height: 30px; min-width: 30px; border-radius: 8px;
  border: 2px solid var(--border); background: transparent;
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.habit-check:hover { transform: scale(1.1); }
.habit-info { flex: 1; min-width: 0; }
.habit-name { font-size: 13px; color: var(--text); transition: text-decoration 0.2s; }
.habit-name.done { text-decoration: line-through; color: var(--text-dim); }
.habit-streak { font-size: 10px; color: var(--warning); font-weight: 700; }
.habit-delete {
  background: none; border: none; color: var(--text-dim);
  font-size: 14px; cursor: pointer; padding: 4px 6px;
  opacity: 0; transition: opacity 0.15s;
}
.habit-item:hover .habit-delete { opacity: 1; }
.habit-delete:hover { color: var(--error); }
