/* DairyFlow — Custom CSS (loaded after Tailwind CDN + Flowbite) */

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

:root {
  --dairy-50:  #f0fdf4;
  --dairy-100: #dcfce7;
  --dairy-200: #bbf7d0;
  --dairy-500: #22c55e;
  --dairy-600: #16a34a;
  --dairy-700: #15803d;
  --dairy-800: #166534;
}

* { box-sizing: border-box; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background-color: #f9fafb;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 {
  font-family: 'Sora', system-ui, sans-serif;
}

/* ─── Page sections ──────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ─── App Shell ──────────────────────────────────────────────────── */
#app-shell { display: none; }
#auth-shell { display: none; }
#landing-shell { display: block; }

/* ─── Bottom nav active ──────────────────────────────────────────── */
/* nav-item active state now handled via Tailwind classes in app.js */

/* ─── Card ───────────────────────────────────────────────────────── */
.dt-card {
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #f3f4f6;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ─── Input ──────────────────────────────────────────────────────── */
.dt-input {
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #111827;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff;
}
.dt-input:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.12);
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn-primary {
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}
.btn-primary:hover  { background: #15803d; }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: #fff;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}
.btn-secondary:hover { background: #f9fafb; }

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 0.75rem;
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
}

/* ─── Badge ──────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }

/* ─── Toast ──────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(90vw, 360px);
}
.toast {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  animation: toastIn 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }
.toast.info    { background: #2563eb; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Modal Overlay ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-box {
  background: #fff;
  width: 100%; max-width: 480px;
  border-radius: 1.5rem 1.5rem 0 0;
  padding: 1.5rem 1.5rem 2.5rem;
  animation: slideUp 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ─── Spinner ────────────────────────────────────────────────────── */
.spinner {
  width: 1.5rem; height: 1.5rem;
  border: 3px solid rgba(22,163,74,0.2);
  border-top-color: #16a34a;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Landing page hero gradient ────────────────────────────────── */
.hero-bg {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 50%, #f0fdf4 100%);
  position: relative;
  overflow: hidden;
}
.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 2px 2px, #16a34a22 1px, transparent 0);
  background-size: 28px 28px;
}

/* ─── Slider ─────────────────────────────────────────────────────── */
input[type=range] {
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #bbf7d0;
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  background: #16a34a;
  border-radius: 50%;
  cursor: pointer;
}

/* ─── Table ──────────────────────────────────────────────────────── */
.dt-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.dt-table th { background: #f9fafb; padding: 0.625rem 1rem; text-align: left; color: #6b7280; font-weight: 500; font-size: 0.75rem; }
.dt-table td { padding: 0.75rem 1rem; border-bottom: 1px solid #f3f4f6; color: #111827; }
.dt-table tr:hover td { background: #f9fafb; }

/* ─── Skeleton loader ────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 0.5rem;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* ─── Mobile safe bottom padding ────────────────────────────────── */
.pb-safe { padding-bottom: calc(5rem + env(safe-area-inset-bottom)); }

/* ─── Chart container ───────────────────────────────────────────── */
.chart-wrap { position: relative; width: 100%; height: 180px; }