@tailwind base;
@tailwind components;
@tailwind utilities;

/* Agronare Modern UI Base */
:root {
  --bg: #0b1221;
  --bg-soft: #0f172a;
  --card: #111b33;
  --card-2: #17223b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --brand: #6366f1;
  --brand-2: #22d3ee;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

/* Light theme variables */
[data-theme="light"] {
  --bg: #f8fafc;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --card-2: #f1f5f9;
  --text: #0f172a;
  --muted: #475569;
  --brand: #4f46e5;
  --brand-2: #0ea5e9;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
}

/* Dark theme variables */
[data-theme="dark"] {
  --bg: #0b1221;
  --bg-soft: #0f172a;
  --card: #0f172a;
  --card-2: #111827;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --brand: #818cf8;
  --brand-2: #22d3ee;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

/* Modern theme variables (vibrant) */
[data-theme="modern"] {
  --bg: #0e1326;
  --bg-soft: #0b1020;
  --card: #0f1830;
  --card-2: #152044;
  --text: #e6f0ff;
  --muted: #a5b4fc;
  --brand: #7c3aed; /* Purple */
  --brand-2: #06b6d4; /* Cyan */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #f43f5e;
}

html, body {
  height: 100%;
}

body {
  background: radial-gradient(1200px 600px at 50% -200px, rgba(34,211,238,0.15) 0%, rgba(99,102,241,0.25) 25%, transparent 60%),
              linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  color: var(--text);
}

/* Toast progress bar (auto-dismiss indicator) */
@keyframes toast-progress {
  from { transform: translateX(0%); }
  to { transform: translateX(-100%); }
}

.toast-progress {
  transform-origin: left;
  animation-name: toast-progress;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@media (prefers-reduced-motion: reduce) {
  .toast-progress {
    animation: none;
  }
}

/* Light body background simplification */
[data-theme="light"] body {
  background: var(--bg);
}

/* Modern theme body accent */
[data-theme="modern"] body {
  background: radial-gradient(900px 900px at 20% -200px, rgba(124,58,237,0.20) 0%, transparent 55%),
              radial-gradient(800px 600px at 80% -150px, rgba(6,182,212,0.20) 0%, transparent 60%),
              linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
}

/* Subtle container constraints */
.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Card base */
.card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(2,6,23,0.6), inset 0 1px 0 rgba(255,255,255,0.04);
}
[data-theme="light"] .card {
  background: var(--card);
  border: 1px solid #e2e8f0;
  box-shadow: 0 6px 20px rgba(15,23,42,0.08);
}
[data-theme="modern"] .card {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid rgba(124,58,237,0.35);
  box-shadow: 0 12px 28px rgba(124,58,237,0.20), 0 8px 22px rgba(6,182,212,0.14);
}

/* Fancy header bar */
.header-bar {
  backdrop-filter: saturate(140%) blur(8px);
  background: linear-gradient(90deg, rgba(99,102,241,0.25) 0%, rgba(34,211,238,0.25) 100%);
  border-bottom: 1px solid rgba(99,102,241,0.3);
}
[data-theme="light"] .header-bar {
  background: rgba(255,255,255,0.8);
  border-bottom: 1px solid #e2e8f0;
}
[data-theme="modern"] .header-bar {
  background: linear-gradient(90deg, rgba(124,58,237,0.25) 0%, rgba(6,182,212,0.25) 100%);
  border-bottom: 1px solid rgba(124,58,237,0.35);
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(99,102,241,0.4);
  color: var(--text);
  background: linear-gradient(180deg, rgba(99,102,241,0.25), rgba(34,211,238,0.15));
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(34,211,238,0.25);
  border-color: rgba(34,211,238,0.6);
}
[data-theme="light"] .button {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid #e2e8f0;
}
[data-theme="light"] .button:hover {
  box-shadow: 0 6px 18px rgba(79,70,229,0.18);
  border-color: #c7d2fe;
}
[data-theme="modern"] .button {
  background: linear-gradient(180deg, rgba(124,58,237,0.25), rgba(6,182,212,0.15));
  border: 1px solid rgba(124,58,237,0.45);
}
[data-theme="modern"] .button:hover {
  box-shadow: 0 10px 26px rgba(124,58,237,0.22);
  border-color: rgba(6,182,212,0.55);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--text);
  border: 1px solid rgba(99,102,241,0.45);
  background: linear-gradient(180deg, rgba(99,102,241,0.25), rgba(34,211,238,0.15));
}
[data-theme="light"] .badge {
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}
[data-theme="modern"] .badge {
  border: 1px solid rgba(124,58,237,0.45);
  background: linear-gradient(180deg, rgba(124,58,237,0.18), rgba(6,182,212,0.12));
}

/* Divider */
.hr {
  height: 1px;
  background: linear-gradient(90deg, rgba(99,102,241,0.3), rgba(34,211,238,0.3));
  border: none;
}

/* Glow titles */
.h1, .h2, .h3 {
  text-shadow: 0 0 22px rgba(99, 102, 241, 0.35);
}

/* Tables */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}
.table thead th {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .06em;
}
.table tbody tr {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid rgba(99,102,241,0.25);
}
.table tbody td {
  padding: 14px 16px;
}
[data-theme="modern"] .table tbody tr {
  border: 1px solid rgba(124,58,237,0.35);
}

/* Dropdowns & modals */
.dropdown, .modal {
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(99,102,241,0.25);
  box-shadow: 0 10px 30px rgba(2,6,23,0.6);
}
[data-theme="light"] .dropdown, [data-theme="light"] .modal {
  border: 1px solid #e2e8f0;
  box-shadow: 0 8px 24px rgba(15,23,42,0.10);
}
[data-theme="modern"] .dropdown, [data-theme="modern"] .modal {
  border: 1px solid rgba(124,58,237,0.35);
  box-shadow: 0 12px 28px rgba(124,58,237,0.20), 0 8px 22px rgba(6,182,212,0.14);
}

/* Inputs */
input, select, textarea {
  background: var(--card);
  color: var(--text);
  border: 1px solid rgba(99,102,241,0.25);
}
[data-theme="light"] input, [data-theme="light"] select, [data-theme="light"] textarea {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
[data-theme="modern"] input, [data-theme="modern"] select, [data-theme="modern"] textarea {
  border: 1px solid rgba(124,58,237,0.35);
}

/* Animations */
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.floaty {
  animation: floaty 3.5s ease-in-out infinite;
}

/* High Contrast overrides */
[data-theme="hc"] body {
  background: var(--bg);
}
[data-theme="hc"] .header-bar {
  background: #000;
  border-bottom: 2px solid #fff;
}
[data-theme="hc"] .card {
  background: var(--card);
  border: 2px solid #ffffff;
  box-shadow: none;
}
[data-theme="hc"] .button {
  background: #000;
  color: #fff;
  border: 2px solid #fff;
}
[data-theme="hc"] .button:hover {
  outline: 2px solid var(--brand);
}
[data-theme="hc"] .badge {
  border: 2px solid #fff;
  background: #000;
  color: #fff;
}
[data-theme="hc"] .dropdown, [data-theme="hc"] .modal {
  border: 2px solid #fff;
  box-shadow: none;
}
[data-theme="hc"] input, [data-theme="hc"] select, [data-theme="hc"] textarea {
  background: #000;
  color: #fff;
  border: 2px solid #fff;
}
