/* PaddiSense Portal — light theme, mobile-first, two-mode design */

:root {
  --bg:        #ffffff;
  --bg-alt:    #f8fafc;
  --bg-card:   #ffffff;
  --bg-input:  #f1f5f9;
  --border:    #e2e8f0;
  --text:      #1f2937;
  --text-dim:  #64748b;
  --primary:   #16a34a;
  --primary-h: #15803d;
  --primary-light: #dcfce7;
  --accent:    #2563eb;
  --accent-light: #dbeafe;
  --success:   #22c55e;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --radius:    10px;
  --shadow:    0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --navbar-h:  56px;
  --tabbar-h:  56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg-alt);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ================================================================
   TOP NAVBAR (office mode)
   ================================================================ */

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--navbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  gap: 1rem;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.nav-logo { height: 28px; width: 28px; }
.nav-title { font-weight: 700; font-size: 1.1rem; white-space: nowrap; color: var(--primary); }

.nav-links {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
}

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  min-height: 44px;
  display: flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
  font-weight: 600;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.nav-email {
  font-size: 0.85rem;
  color: var(--text-dim);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ================================================================
   BOTTOM TAB BAR (field mode)
   ================================================================ */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  box-shadow: 0 -1px 3px rgba(0,0,0,0.06);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.7rem;
  font-weight: 500;
  flex: 1;
  min-height: 44px;
  padding: 4px 0;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.tab-item svg {
  width: 22px;
  height: 22px;
}

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

.tab-item.active svg {
  stroke: var(--primary);
}

/* Raised center "Record" button */
.tab-record {
  position: relative;
}

.tab-record-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -16px;
  box-shadow: 0 2px 8px rgba(22,163,74,0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.tab-record-btn svg {
  width: 24px;
  height: 24px;
  stroke: #fff;
}

.tab-record:active .tab-record-btn {
  transform: scale(0.95);
}

.tab-record.active .tab-record-btn {
  box-shadow: 0 2px 12px rgba(22,163,74,0.5);
}

/* Draft sync badge on tab */
.tab-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 20px);
  background: var(--warning);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ================================================================
   MAIN CONTENT AREA
   ================================================================ */

#app {
  min-height: 100vh;
}

/* Office mode: top navbar padding */
.mode-office #app {
  padding-top: calc(var(--navbar-h) + var(--safe-top));
  padding-bottom: 1rem;
}

/* Field mode: bottom tabbar padding */
.mode-field #app {
  padding-top: 0;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom));
}

/* Field mode hides navbar, office hides tabbar (JS handles .hidden) */

/* ================================================================
   AUTH PAGES (login, activate, OTP) — mode-independent
   ================================================================ */

.page-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--bg-alt);
}

.page-auth .auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.page-auth .auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.page-auth .auth-card .auth-subtitle {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.page-auth .auth-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.page-auth .auth-brand svg {
  width: 48px;
  height: 48px;
  margin-bottom: 0.5rem;
}

.page-auth .auth-brand .brand-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

/* ================================================================
   PAGE CONTENT (shared)
   ================================================================ */

.page-content {
  padding: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text);
}

/* ================================================================
   CARDS
   ================================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.1s;
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.card-clickable:active {
  transform: translateY(0);
}

/* Stat cards row */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}

/* ================================================================
   FARM GRID
   ================================================================ */

.farm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.farm-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, box-shadow 0.15s;
  min-height: 44px;
  box-shadow: var(--shadow);
}

.farm-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.farm-card:active {
  transform: translateY(0);
}

.farm-card .farm-name {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.farm-card .farm-stats {
  display: flex;
  gap: 1.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.farm-card .stat-value {
  font-weight: 600;
  color: var(--text);
}

/* ================================================================
   MAP
   ================================================================ */

.page-map {
  height: calc(100vh - var(--navbar-h) - var(--safe-top));
  position: relative;
  overflow: hidden;
}

.mode-field .page-map {
  height: calc(100vh - var(--tabbar-h) - var(--safe-bottom));
}

#portal-map {
  width: 100%;
  height: 100%;
}

/* --- Farm chips bar (bottom of map) --- */

.farm-chips {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.95);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 2rem);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mode-field .farm-chips {
  bottom: calc(1rem + var(--tabbar-h) + var(--safe-bottom));
}

.farm-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 40px;
}

.farm-chip:hover { border-color: var(--primary); }
.farm-chip.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-h);
}

.farm-chip .chip-count {
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg-alt);
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  color: var(--text-dim);
}

.farm-chip.active .chip-count {
  background: rgba(22,163,74,0.15);
  color: var(--primary);
}

/* --- Left panel (office — layers/controls) --- */

.map-panel-left {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  z-index: 1100;
  padding: 1rem;
  box-shadow: 2px 0 12px rgba(0,0,0,0.08);
  transition: opacity 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* Right panel gradient headers (GSM pattern) */
.map-panel-right .panel-header {
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  margin: -1.25rem -1.25rem 1rem -1.25rem;
  padding: 1rem 1.25rem;
  border-radius: 0;
}

.map-panel-right .panel-header h3 {
  color: #fff;
  font-size: 1.1rem;
}

.map-panel-right .panel-header .panel-close-btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
}

.map-panel-right .panel-header .panel-close-btn:hover {
  background: rgba(255,255,255,0.25);
}

.panel-collapse-btn,
.panel-close-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-alt);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: background 0.15s;
}

.panel-collapse-btn:hover,
.panel-close-btn:hover { background: var(--border); }

.panel-expand-btn {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 1100;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  color: var(--text-dim);
}

.panel-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

/* Layer toggles */
.layer-toggles {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.layer-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  cursor: pointer;
  font-size: 0.85rem;
}

.layer-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: auto;
  accent-color: var(--primary);
  cursor: pointer;
}

.layer-toggle-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.layer-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Paddock list in left panel — fills remaining space */
.paddock-list-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}

.paddock-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.1s;
}

.paddock-list-item:hover { background: var(--bg-alt); }
.paddock-list-item:last-child { border-bottom: none; }

/* --- Right panel (office — contextual detail) --- */

.map-panel-right {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  z-index: 1100;
  padding: 1.25rem;
  box-shadow: -4px 0 16px rgba(0,0,0,0.12);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.map-panel-right.open {
  transform: translateX(0);
}

.panel-detail-section {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.panel-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.panel-detail-row:last-child { border-bottom: none; }

.panel-detail-value {
  font-weight: 600;
  color: var(--text);
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Paddock name labels on map (matches GSM style) */
.paddock-label {
  background: rgba(255,255,255,0.92) !important;
  border: 1px solid rgba(0,0,0,0.15) !important;
  border-radius: 3px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
  padding: 1px 5px !important;
  text-align: center;
  pointer-events: none;
}

.paddock-label span {
  font-size: 11px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 16px;
}

/* Label toggle pill (GSM pattern) */
.lbl-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 28px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: #9ca3af;
  flex-shrink: 0;
  transition: all 0.15s;
  user-select: none;
}

.lbl-pill.on {
  background: #eff6ff;
  border-color: var(--accent);
  color: var(--accent);
}

/* Layer stack (GSM pattern) */
.layer-stack {
  border-top: 1px solid var(--border);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.layer-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.layer-toggle-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-height: auto;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.layer-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.layer-name {
  flex: 1;
}

.layer-detail-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  transition: transform 0.2s, background 0.15s;
}

.layer-detail-btn.open {
  background: #eff6ff;
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(90deg);
}

.layer-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  padding-left: 2rem;
}

.layer-details.open {
  max-height: 300px;
}

.layer-details-inner {
  padding: 0.5rem 0;
}

/* --- Field mode: simple sidebar --- */

.map-sidebar {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 320px;
  max-height: calc(100% - 5rem);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  z-index: 800;
  padding: 1rem;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 767px) {
  .map-sidebar {
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
    top: auto;
    bottom: calc(4.5rem + var(--tabbar-h) + var(--safe-bottom));
    max-height: 35vh;
    border-radius: 12px;
  }
  .map-panel-left { display: none; }
  .map-panel-right { width: 100%; }
  .farm-chips { bottom: calc(0.5rem + var(--tabbar-h) + var(--safe-bottom)); }
}

.map-sidebar h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--text);
}

/* ================================================================
   PLANTINGS TABLE
   ================================================================ */

.planting-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.planting-table th,
.planting-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.planting-table th {
  background: var(--bg-alt);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.planting-table tr:hover td {
  background: var(--bg-alt);
}

/* Stacked card variant for field mode */
.planting-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}

.planting-card .planting-paddock {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.planting-card .planting-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.planting-card .planting-detail {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

/* ================================================================
   FORMS
   ================================================================ */

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="tel"],
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  min-height: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.1);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ================================================================
   BUTTONS
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.6rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.1s;
  color: #fff;
  background: var(--primary);
  text-decoration: none;
  gap: 0.5rem;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover { background: var(--primary-h); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-sm { min-height: 36px; padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-lg { min-height: 52px; padding: 0.8rem 2rem; font-size: 1.1rem; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: #1d4ed8; }
.btn-block { width: 100%; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { background: var(--bg-alt); }

/* ================================================================
   ACTION TILES (field home)
   ================================================================ */

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.action-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 0.75rem;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
  min-height: 100px;
  transition: transform 0.1s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.action-tile:active { transform: scale(0.97); }

.action-tile svg {
  width: 32px;
  height: 32px;
  stroke: #fff;
  fill: none;
}

.action-tile.tile-green  { background: linear-gradient(135deg, #16a34a, #15803d); box-shadow: 0 4px 12px rgba(22,163,74,0.3); }
.action-tile.tile-blue   { background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.action-tile.tile-amber  { background: linear-gradient(135deg, #d97706, #b45309); box-shadow: 0 4px 12px rgba(217,119,6,0.3); }
.action-tile.tile-gray   { background: linear-gradient(135deg, #475569, #334155); box-shadow: 0 4px 12px rgba(71,85,105,0.3); }

/* ================================================================
   RECORD WIZARD
   ================================================================ */

.wizard-wrap {
  max-width: 600px;
  margin: 0 auto;
  padding: 1.25rem;
}

.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.wizard-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}

.wizard-dot.done { background: var(--primary); }
.wizard-dot.current { background: var(--accent); transform: scale(1.3); }

.wizard-step {
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.wizard-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.wizard-nav .btn { flex: 1; }

/* Event type grid */
.event-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}

.event-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  min-height: 80px;
  -webkit-tap-highlight-color: transparent;
}

.event-type-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.event-type-btn.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

.event-type-btn svg {
  width: 28px;
  height: 28px;
}

/* Photo capture */
.photo-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.photo-thumb {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.photo-add {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s;
}

.photo-add:hover { border-color: var(--primary); }

/* Review card */
.review-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.review-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.review-row:last-child { border-bottom: none; }
.review-label { color: var(--text-dim); }
.review-value { font-weight: 600; }

/* ================================================================
   PADDOCK LIST (field mode cards)
   ================================================================ */

.paddock-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.paddock-card:active { border-color: var(--primary); }

.paddock-card .paddock-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.paddock-card .paddock-info {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ================================================================
   PROFILE PAGE
   ================================================================ */

.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.profile-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.mode-toggle button {
  flex: 1;
  padding: 0.75rem;
  border: none;
  background: var(--bg-input);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mode-toggle button.active {
  background: var(--primary);
  color: #fff;
}

/* ================================================================
   TOAST NOTIFICATIONS
   ================================================================ */

.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease, toastOut 0.25s ease 2.75s forwards;
  pointer-events: auto;
  max-width: 90vw;
}

.toast-success { background: #16a34a; color: #fff; }
.toast-error   { background: #ef4444; color: #fff; }
.toast-info    { background: #2563eb; color: #fff; }
.toast-warning { background: #d97706; color: #fff; }

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

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

/* ================================================================
   UTILITIES
   ================================================================ */

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-ok   { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #854d0e; }
.badge-err  { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

.text-dim  { color: var(--text-dim); }
.text-sm   { font-size: 0.85rem; }
.text-xs   { font-size: 0.75rem; }
.mt-1      { margin-top: 0.5rem; }
.mt-2      { margin-top: 1rem; }
.mb-1      { margin-bottom: 0.5rem; }
.mb-2      { margin-bottom: 1rem; }
.gap-row   { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert-error { background: #fee2e2; border: 1px solid #fecaca; color: #991b1b; }
.alert-success { background: #dcfce7; border: 1px solid #bbf7d0; color: #166534; }
.alert-info { background: #dbeafe; border: 1px solid #bfdbfe; color: #1e40af; }

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

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

/* OTP input */
.otp-input {
  font-size: 2rem;
  letter-spacing: 0.5em;
  text-align: center;
  font-family: monospace;
  padding: 0.75rem;
}

/* Season selector bar */
.season-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.season-bar select {
  width: auto;
  min-width: 120px;
}

/* GPS proximity banner */
.gps-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--primary-light);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--primary-h);
  margin-bottom: 1rem;
}

.gps-banner svg {
  width: 16px;
  height: 16px;
  stroke: var(--primary);
  flex-shrink: 0;
}

/* Sync status bar */
.sync-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fef3c7;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #854d0e;
  margin-bottom: 1rem;
}

.sync-bar.synced {
  background: #dcfce7;
  color: #166534;
}

/* ================================================================
   LEAFLET OVERRIDES (light theme)
   ================================================================ */

/* Move zoom controls to avoid panel overlap */
.leaflet-top.leaflet-left {
  top: auto !important;
  bottom: 80px !important;
  left: 296px !important;
}

.mode-field .leaflet-top.leaflet-left {
  left: 10px !important;
}

.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  width: 40px !important;
  height: 40px !important;
  line-height: 40px !important;
  font-size: 20px !important;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-attribution {
  background: rgba(255,255,255,0.85) !important;
  color: var(--text-dim) !important;
  font-size: 0.7rem !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip { background: var(--bg-card) !important; }

/* ================================================================
   RESPONSIVE — hide elements by mode
   ================================================================ */

@media (max-width: 767px) {
  .nav-email { display: none; }
  .nav-links { gap: 0; }
  .nav-link { padding: 0.5rem 0.6rem; font-size: 0.85rem; }
  .page-title { font-size: 1.25rem; }
}

/* PWA install prompt */
.install-prompt {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.install-prompt .install-text {
  flex: 1;
  font-size: 0.9rem;
}

.install-prompt .install-text strong {
  display: block;
  margin-bottom: 0.15rem;
}
