/* ====================================================
   HARVEST HARMONY - Mobile App CSS
   Material Design System for Garden Companion App
   ==================================================== */

/* CSS Variables */
:root {
  --primary: #4CAF50;
  --primary-dark: #388E3C;
  --primary-light: #C8E6C9;
  --secondary: #FFEB3B;
  --secondary-dark: #F9A825;
  --accent: #8BC34A;
  --accent-dark: #689F38;
  --surface: #FFFFFF;
  --surface-2: #F5F5F5;
  --surface-3: #EEEEEE;
  --background: #F1F5F0;
  --on-primary: #FFFFFF;
  --on-surface: #212121;
  --on-surface-med: #616161;
  --on-surface-low: #9E9E9E;
  --divider: #E0E0E0;
  --error: #E53935;
  --warning: #FF8F00;
  --success: #43A047;
  --info: #1E88E5;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  --shadow-md: 0 3px 6px rgba(0,0,0,0.10), 0 3px 6px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.12), 0 6px 6px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 40px rgba(0,0,0,0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --app-bar-height: 56px;
  --bottom-nav-height: 60px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-med: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--background);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  color: var(--on-surface);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================
   TOP APP BAR
   ============================ */
.app-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--app-bar-height);
  background: var(--primary);
  display: flex;
  align-items: center;
  padding: 0 4px;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.app-bar-title {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--on-primary);
  letter-spacing: 0.01em;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--on-primary);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: var(--on-primary);
}

.icon-btn:active {
  background: rgba(255,255,255,0.2);
}

.icon-btn-sm {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--on-surface-med);
  font-size: 16px;
  transition: background var(--transition-fast);
}

.icon-btn-sm:active {
  background: var(--surface-3);
}

/* ============================
   SIDE DRAWER
   ============================ */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-slow);
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--surface);
  z-index: 210;
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow-y: auto;
}

.side-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  padding: 48px 20px 24px;
}

.drawer-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawer-logo-icon {
  font-size: 36px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.drawer-app-name {
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.drawer-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  margin-top: 2px;
}

.drawer-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface-low);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 16px 20px 4px;
}

.drawer-nav {
  list-style: none;
  padding: 0 8px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  height: 48px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface-med);
  transition: background var(--transition-fast), color var(--transition-fast);
  margin-bottom: 2px;
}

.drawer-item:active, .drawer-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.drawer-item-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drawer-item-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.drawer-footer {
  margin-top: auto;
  padding: 20px;
  border-top: 1px solid var(--divider);
}

.drawer-version {
  font-size: 11px;
  color: var(--on-surface-low);
  text-align: center;
}

/* ============================
   MAIN CONTENT & SCREENS
   ============================ */
.main-content {
  position: fixed;
  top: var(--app-bar-height);
  left: 0;
  right: 0;
  bottom: var(--bottom-nav-height);
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

.screen-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 12px 16px 0;
}

.screen-scroll::-webkit-scrollbar {
  display: none;
}

/* Fade transitions */
.screen {
  opacity: 0;
  transition: opacity var(--transition-med);
}

.screen.active {
  opacity: 1;
}

/* ============================
   BOTTOM NAVIGATION
   ============================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--surface);
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--divider);
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--on-surface-low);
  padding: 4px 0;
  transition: color var(--transition-fast);
  position: relative;
  min-height: 44px;
}

.nav-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 3px 3px;
  transition: width var(--transition-med);
}

.nav-item.active {
  color: var(--primary);
}

.nav-item.active::before {
  width: 32px;
}

.nav-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
  transition: transform var(--transition-fast);
}

.nav-item.active .nav-icon {
  transform: scale(1.1);
}

.nav-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ============================
   DASHBOARD STATS
   ============================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--divider);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 10px;
  color: var(--on-surface-low);
  margin-top: 4px;
  font-weight: 500;
  line-height: 1.2;
}

/* ============================
   SECTION HEADERS
   ============================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  margin-top: 4px;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--on-surface);
}

.text-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  min-height: 44px;
}

/* ============================
   AI TIP CARD
   ============================ */
.ai-tip-card {
  background: linear-gradient(135deg, #E8F5E9, #F1F8E9);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  min-height: 72px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-tip-content {
  font-size: 13px;
  line-height: 1.6;
  color: var(--on-surface);
}

.ai-tip-icon {
  font-size: 20px;
  margin-bottom: 4px;
}

.ai-retry-btn {
  align-self: flex-start;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, var(--primary-light), #DCEDC8);
  color: var(--primary-dark);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

/* ============================
   HORIZONTAL SCROLL ROW
   ============================ */
.horizontal-scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}

.horizontal-scroll-row::-webkit-scrollbar {
  display: none;
}

.plant-mini-card {
  flex-shrink: 0;
  width: 120px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast);
  border: 1px solid var(--divider);
}

.plant-mini-card:active {
  transform: scale(0.97);
}

.plant-mini-img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--primary-light), #DCEDC8);
}

.plant-mini-emoji {
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: linear-gradient(135deg, #E8F5E9, #F1F8E9);
}

.plant-mini-info {
  padding: 8px 10px;
}

.plant-mini-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plant-mini-species {
  font-size: 10px;
  color: var(--on-surface-low);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================
   QUICK ACTIONS
   ============================ */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.quick-action-btn {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface);
  min-height: 80px;
}

.quick-action-btn:active {
  transform: scale(0.97);
  box-shadow: none;
}

.qa-icon {
  font-size: 26px;
}

/* ============================
   PLANT CARDS (Garden)
   ============================ */
.search-bar-container {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.search-bar {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--divider);
  border-radius: 28px;
  padding: 0 14px;
  height: 42px;
  gap: 8px;
  transition: border-color var(--transition-fast);
}

.search-bar:focus-within {
  border-color: var(--primary);
}

.search-icon {
  width: 18px;
  height: 18px;
  fill: var(--on-surface-low);
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: var(--on-surface);
  outline: none;
}

.search-bar input::placeholder {
  color: var(--on-surface-low);
}

.ai-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  border-radius: 20px;
  padding: 0 14px;
  height: 36px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.ai-action-btn:active {
  opacity: 0.85;
}

.plant-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--divider);
  margin-bottom: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.plant-card:active {
  transform: scale(0.99);
}

.plant-card-content {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 14px;
}

.plant-card-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #E8F5E9, #DCEDC8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  border: 2px solid var(--primary-light);
}

.plant-card-info {
  flex: 1;
  min-width: 0;
}

.plant-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.plant-card-species {
  font-size: 12px;
  color: var(--on-surface-med);
  margin-top: 2px;
}

.plant-card-meta {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.plant-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 500;
  color: var(--on-surface-med);
}

.plant-chip.water {
  background: #E3F2FD;
  color: #1565C0;
}

.plant-chip.overdue {
  background: #FFEBEE;
  color: #B71C1C;
}

.plant-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.card-action-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 16px;
}

.card-action-btn:active {
  background: var(--surface-2);
}

.card-chevron {
  color: var(--on-surface-low);
  font-size: 18px;
}

/* ============================
   AI RESULT CARDS
   ============================ */
.ai-result-card {
  background: linear-gradient(135deg, #F1F8E9, #E8F5E9);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
  animation: slideDown 0.25s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ai-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ai-result-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--on-surface);
  white-space: pre-wrap;
}

/* ============================
   TASK CARDS
   ============================ */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: none;
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
}

.chip-row::-webkit-scrollbar { display: none; }

.chip {
  display: flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1.5px solid var(--divider);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-med);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.ai-action-row {
  margin-bottom: 12px;
}

.ai-wide-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border: none;
  border-radius: var(--radius-md);
  height: 44px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.ai-wide-btn:active {
  opacity: 0.85;
}

.task-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--divider);
  margin-bottom: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.task-card:active {
  transform: scale(0.99);
}

.task-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--divider);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.task-check.done {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-size: 12px;
}

.task-info {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--on-surface);
  line-height: 1.3;
}

.task-title.done {
  text-decoration: line-through;
  color: var(--on-surface-low);
}

.task-meta {
  display: flex;
  gap: 8px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.task-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.tag-watering { background: #E3F2FD; color: #1565C0; }
.tag-fertilizing { background: #FFF9C4; color: #F57F17; }
.tag-pruning { background: #F3E5F5; color: #6A1B9A; }
.tag-repotting { background: #FBE9E7; color: #BF360C; }
.tag-other { background: var(--surface-2); color: var(--on-surface-med); }
.tag-overdue { background: #FFEBEE; color: #B71C1C; }

.task-ai-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  color: var(--primary-dark);
  border: none;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============================
   TIPS GRID
   ============================ */
.tips-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tip-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--divider);
  padding: 16px 14px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.tip-card:active {
  transform: scale(0.97);
}

.tip-card-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.tip-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 4px;
  line-height: 1.3;
}

.tip-card-text {
  font-size: 11px;
  color: var(--on-surface-med);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tip-category-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* ============================
   ANALYTICS SCREENS
   ============================ */
.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0 14px;
}

.analytics-header .back-btn {
  order: 1;
}

.analytics-header .analytics-title {
  order: 2;
  flex: 1;
  text-align: center;
}

.analytics-header .icon-btn {
  order: 3;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  color: var(--on-surface);
  background: transparent;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.analytics-header .icon-btn:active {
  background: var(--surface-2);
}

.analytics-header .icon-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.back-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: var(--surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.back-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--on-surface);
}

.analytics-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--on-surface);
}

.chart-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--divider);
  padding: 16px;
  margin-bottom: 14px;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
  margin-bottom: 16px;
}

.chart-container {
  width: 100%;
  overflow: hidden;
}

.chart-container svg {
  width: 100%;
}

/* Bar chart styles */
.bar-chart-bar {
  transition: opacity var(--transition-fast);
}

.bar-chart-bar:hover {
  opacity: 0.8;
}

/* Progress chart */
.progress-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.progress-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.progress-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface);
}

.progress-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}

.progress-track {
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Donut / Pie Legend */
.donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--on-surface-med);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================
   AI CHAT SCREEN
   ============================ */
.chat-screen {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-messages::-webkit-scrollbar { display: none; }

.chat-bubble {
  max-width: 82%;
  animation: bubbleIn 0.2s ease;
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble.user {
  align-self: flex-end;
}

.chat-bubble.ai {
  align-self: flex-start;
}

.bubble-content {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.chat-bubble.user .bubble-content {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.ai .bubble-content {
  background: var(--surface);
  color: var(--on-surface);
  border: 1px solid var(--divider);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.bubble-time {
  font-size: 10px;
  color: var(--on-surface-low);
  margin-top: 4px;
  padding: 0 4px;
}

.chat-bubble.user .bubble-time {
  text-align: right;
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--surface);
  border-top: 1px solid var(--divider);
}

.chat-input {
  flex: 1;
  height: 40px;
  border: 1.5px solid var(--divider);
  border-radius: 20px;
  padding: 0 16px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--on-surface);
  outline: none;
  transition: border-color var(--transition-fast);
}

.chat-input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
  fill: white;
}

.chat-send-btn:active {
  background: var(--primary-dark);
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--on-surface-low);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-6px); opacity: 1; }
}

/* ============================
   BOTTOM SHEETS
   ============================ */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
}

.sheet-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index: 310;
  transform: translateY(100%);
  transition: transform var(--transition-slow);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet-tall {
  max-height: 92vh;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.sheet-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--on-surface);
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 40px;
  -webkit-overflow-scrolling: touch;
}

.sheet-body::-webkit-scrollbar { display: none; }

/* ============================
   FORMS
   ============================ */
.form-field {
  position: relative;
  margin-bottom: 18px;
}

.form-input {
  width: 100%;
  height: 52px;
  border: 1.5px solid var(--divider);
  border-radius: var(--radius-md);
  padding: 20px 14px 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--on-surface);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.form-input:focus {
  border-color: var(--primary);
}

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
  top: 6px;
  font-size: 10px;
  color: var(--primary);
}

.form-textarea {
  height: auto;
  min-height: 80px;
  padding: 26px 14px 10px;
  resize: none;
}

.form-select {
  padding-right: 32px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%239E9E9E'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 14px;
  font-size: 14px;
  color: var(--on-surface-low);
  transition: all var(--transition-fast);
  pointer-events: none;
  background: transparent;
  white-space: nowrap;
}

.form-label-active {
  top: 6px;
  font-size: 10px;
  color: var(--primary);
  transform: none;
}

.form-textarea + .form-label {
  top: 20px;
  transform: none;
}

.form-textarea:focus + .form-label,
.form-textarea:not(:placeholder-shown) + .form-label {
  top: 6px;
  font-size: 10px;
}

.form-error {
  font-size: 11px;
  color: var(--error);
  margin-top: 4px;
  padding-left: 14px;
  display: none;
}

.form-error.visible {
  display: block;
}

.form-input.error {
  border-color: var(--error);
}

.date-input {
  padding-top: 20px;
}

/* Icon Selector */
.icon-selector-row {
  margin-bottom: 18px;
}

.icon-selector-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface-low);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  padding-left: 4px;
}

.icon-selector-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.icon-btn-select {
  aspect-ratio: 1;
  background: var(--surface-2);
  border: 2px solid var(--divider);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn-select:active {
  transform: scale(0.95);
}

.icon-btn-select.selected {
  background: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* Primary Button */
.primary-btn {
  width: 100%;
  height: 48px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition-fast), transform var(--transition-fast);
  margin-top: 8px;
  box-shadow: var(--shadow-sm);
}

.primary-btn:active {
  background: var(--primary-dark);
  transform: scale(0.99);
}

/* AI Suggestions */
.ai-suggest-row {
  margin-bottom: 12px;
}

.ai-suggest-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--primary-light), #DCEDC8);
  color: var(--primary-dark);
  border: none;
  border-radius: var(--radius-md);
  height: 40px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.ai-inline-card {
  background: linear-gradient(135deg, #F1F8E9, #E8F5E9);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--on-surface);
  animation: slideDown 0.2s ease;
}

/* ============================
   CONFIRMATION DIALOG
   ============================ */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
  padding: 24px;
}

.dialog-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.confirm-dialog {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 100%;
  max-width: 320px;
  box-shadow: var(--shadow-xl);
  transform: scale(0.9);
  transition: transform var(--transition-med);
}

.dialog-overlay.active .confirm-dialog {
  transform: scale(1);
}

.dialog-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--on-surface);
  margin-bottom: 8px;
}

.dialog-message {
  font-size: 14px;
  color: var(--on-surface-med);
  line-height: 1.5;
  margin-bottom: 20px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.dialog-btn-cancel {
  height: 40px;
  padding: 0 20px;
  background: transparent;
  color: var(--on-surface-med);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.dialog-btn-confirm {
  height: 40px;
  padding: 0 20px;
  background: var(--error);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* ============================
   SNACKBAR
   ============================ */
.snackbar {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 12px);
  left: 16px;
  right: 16px;
  background: #323232;
  color: white;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  z-index: 500;
  transform: translateY(100px);
  opacity: 0;
  transition: transform var(--transition-med), opacity var(--transition-med);
  pointer-events: none;
  text-align: center;
}

.snackbar.show {
  transform: translateY(0);
  opacity: 1;
}

/* ============================
   FAB
   ============================ */
.fab {
  position: absolute;
  right: 20px;
  bottom: calc(var(--bottom-nav-height) + 16px);
  width: 56px;
  height: 56px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(76, 175, 80, 0.45);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  font-size: 24px;
  font-family: 'Material Icons Round', sans-serif;
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  direction: ltr;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(76, 175, 80, 0.5);
}

.fab:active {
  transform: scale(0.95);
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

.fab .material-icons-round {
  font-size: 26px;
  font-family: 'Material Icons Round', sans-serif;
  color: white;
}

/* ============================
   SKELETON LOADING
   ============================ */
.skeleton-block {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================
   EMPTY STATES
   ============================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}

.empty-icon {
  font-size: 52px;
  opacity: 0.6;
}

.empty-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--on-surface);
}

.empty-subtitle {
  font-size: 13px;
  color: var(--on-surface-med);
  line-height: 1.5;
}

.empty-action-btn {
  margin-top: 8px;
  height: 40px;
  padding: 0 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* ============================
   AI LOADING
   ============================ */
.ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #F1F8E9, #E8F5E9);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--primary-dark);
  font-weight: 500;
}

.ai-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================
   RIPPLE EFFECT
   ============================ */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.3);
  opacity: 0;
  border-radius: inherit;
  transform: scale(0);
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.ripple:active::after {
  transform: scale(2.5);
  opacity: 1;
  transition: 0s;
}

/* ============================
   PLANT DETAIL SHEET CONTENT
   ============================ */
.detail-hero {
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, #E8F5E9, #DCEDC8);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  margin-bottom: 16px;
}

.detail-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--divider);
}

.detail-field:last-of-type {
  border-bottom: none;
}

.detail-field-icon {
  font-size: 16px;
  margin-top: 2px;
  width: 20px;
  flex-shrink: 0;
}

.detail-field-label {
  font-size: 11px;
  color: var(--on-surface-low);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-field-value {
  font-size: 14px;
  color: var(--on-surface);
  margin-top: 2px;
  line-height: 1.4;
}

.detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.detail-btn {
  flex: 1;
  height: 44px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.detail-btn-edit {
  background: var(--primary);
  color: white;
}

.detail-btn-delete {
  background: #FFEBEE;
  color: var(--error);
}

.detail-tasks-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
  margin: 16px 0 8px;
}

/* ============================
   TASK AI SUGGESTION INLINE
   ============================ */
.task-ai-inline {
  background: linear-gradient(135deg, #F1F8E9, #E8F5E9);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  animation: slideDown 0.2s ease;
}

/* ============================
   DASHBOARD TASK ITEMS
   ============================ */
.dash-task-item {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--divider);
  cursor: pointer;
}

.dash-task-icon {
  font-size: 18px;
  width: 36px;
  height: 36px;
  background: var(--surface-2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-task-title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-task-due {
  font-size: 11px;
  color: var(--on-surface-low);
  flex-shrink: 0;
}

.dash-task-due.overdue {
  color: var(--error);
  font-weight: 600;
}

/* Misc utilities */
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }

/* ============================
   RESPONSIVE ADJUSTMENTS
   ============================ */
@media (min-width: 480px) {
  .main-content {
    max-width: 480px;
    margin: 0 auto;
  }

  .app-bar, .bottom-nav, .side-drawer {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }

  .side-drawer {
    left: calc(50% - 240px);
    transform: translateX(-100%);
  }

  .side-drawer.open {
    transform: translateX(0);
  }

  .bottom-sheet, .snackbar {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    right: auto;
    width: 100%;
  }

  .bottom-sheet.open {
    transform: translateX(-50%) translateY(0);
  }

  .snackbar {
    left: 50%;
    right: auto;
    width: calc(480px - 32px);
  }

  .snackbar.show {
    transform: translateX(-50%) translateY(0);
  }

  .fab {
    right: calc(50% - 220px);
  }
}
