/* ============================================================
   Sandhu Super - design system
   Warm "golden harvest" theme: deep green-charcoal surfaces,
   amber/gold accents, serif display type.
   ============================================================ */

:root {
  --bg: #0c110d;
  --bg-elevated: #11181310;
  --bg-card: #121a14;
  --bg-card-hover: #16201a;
  --bg-input: #0a0e0b;
  --border: #263129;
  --border-soft: #1d271f;
  --border-strong: #3a4a3d;
  --text: #ede6d6;
  --text-dim: #9aaa9c;
  --text-faint: #6e7f71;
  --primary: #e2a33c;
  --primary-hover: #f0b654;
  --primary-soft: rgba(226, 163, 60, 0.12);
  --primary-ink: #241605;
  --danger: #e26a55;
  --danger-soft: rgba(226, 106, 85, 0.12);
  --success: #8fc48a;
  --success-soft: rgba(143, 196, 138, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Outfit", -apple-system, "Segoe UI", sans-serif;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -12px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 20px 50px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(226, 163, 60, 0.06);
}

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

html { color-scheme: dark; }

/* Touch behaviour: no tap-highlight flash, no double-tap zoom delay */
body { -webkit-tap-highlight-color: transparent; }
button, a, input, select, textarea, label { touch-action: manipulation; }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1100px 520px at 88% -12%, rgba(226, 163, 60, 0.09), transparent 60%),
    radial-gradient(900px 520px at -12% 112%, rgba(110, 160, 110, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(226, 163, 60, 0.3); }

h1, h2, h3, .brand { font-family: var(--font-display); font-weight: 600; letter-spacing: 0; }

/* ---------- motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-dots {
  0%, 20% { content: "."; }
  40% { content: ".."; }
  60%, 100% { content: "..."; }
}

.center-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ---------- brand ---------- */

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 13px;
  background: #ffffff; /* the logo is designed on white */
  border: 1px solid var(--border);
  box-shadow: 0 0 24px -6px rgba(255, 222, 0, 0.35);
  flex: none;
  overflow: hidden;
}
.logo svg, .logo img { display: block; width: 30px; height: 30px; object-fit: contain; }
.auth-card .logo svg, .auth-card .logo img { width: 38px; height: 38px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  color: var(--text);
}
.brand span { color: var(--primary); font-style: italic; }
.brand .badge { font-family: var(--font-body); font-style: normal; }

/* ---------- auth screens ---------- */

.auth-card {
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 40%), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 44px 40px 38px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-pop);
  animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.auth-card .logo { width: 52px; height: 52px; border-radius: 17px; margin-bottom: 20px; }
.auth-card h1 { font-size: 30px; margin-bottom: 6px; }
.auth-card h1 span { color: var(--primary); font-style: italic; }
.auth-card .subtitle { color: var(--text-dim); font-size: 14.5px; line-height: 1.55; margin-bottom: 28px; }

/* ---------- forms ---------- */

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-body);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(226, 163, 60, 0.16);
}

/* "Remember me" checkbox row on the login form */
.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -4px 0 20px;
}
.remember-row label {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  margin: 0;
}
.remember-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  flex: none;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--primary-hover), var(--primary));
  color: var(--primary-ink);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 6px 18px -8px rgba(226, 163, 60, 0.55), 0 1px 0 rgba(255, 255, 255, 0.25) inset;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.15s;
}
@media (hover: hover) {
  .btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 10px 24px -8px rgba(226, 163, 60, 0.6), 0 1px 0 rgba(255, 255, 255, 0.25) inset; }
}
.btn:active { transform: translateY(0); filter: brightness(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.full { width: 100%; }
.btn.secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  color: var(--text);
  box-shadow: none;
}
@media (hover: hover) {
  .btn.secondary:hover { border-color: var(--primary); color: var(--primary); filter: none; }
}
.btn.danger {
  background: transparent;
  border: 1px solid rgba(226, 106, 85, 0.5);
  color: var(--danger);
  box-shadow: none;
}
@media (hover: hover) {
  .btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); filter: none; }
}
.btn.small { padding: 7px 13px; font-size: 13px; border-radius: 9px; }

/* ---------- alerts ---------- */

.error-box, .success-box {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  animation: rise 0.3s ease;
}
.error-box { background: var(--danger-soft); border: 1px solid rgba(226, 106, 85, 0.45); color: #f0a294; }
.success-box { background: var(--success-soft); border: 1px solid rgba(143, 196, 138, 0.4); color: var(--success); }

/* ---------- app shell ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 28px;
  background: rgba(12, 17, 13, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.topbar nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.topbar nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.045); }
.topbar nav a.active { color: var(--primary); background: var(--primary-soft); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 24px 80px;
  animation: rise 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.page-title { font-size: 32px; margin-bottom: 8px; }
.page-sub { color: var(--text-dim); font-size: 15px; margin-bottom: 30px; max-width: 640px; line-height: 1.55; }

/* ---------- program grid ---------- */

.program-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}
.program-card {
  position: relative;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0) 45%), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 24px 22px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, box-shadow 0.25s;
  overflow: hidden;
}
.program-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(320px 140px at 20% 0%, rgba(226, 163, 60, 0.1), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
@media (hover: hover) {
  .program-card:hover { transform: translateY(-4px); border-color: rgba(226, 163, 60, 0.45); box-shadow: var(--shadow-pop); }
  .program-card:hover::after { opacity: 1; }
}
.program-icon {
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  font-size: 23px;
  border-radius: 14px;
  background: var(--primary-soft);
  border: 1px solid rgba(226, 163, 60, 0.25);
  margin-bottom: 16px;
}
.program-card h3 { font-size: 19px; margin-bottom: 8px; }
.program-card p { color: var(--text-dim); font-size: 14px; line-height: 1.6; }
.program-card .open-hint {
  color: var(--primary);
  font-size: 13.5px;
  font-weight: 600;
  margin-top: 18px;
  transition: transform 0.2s;
  display: inline-block;
}
@media (hover: hover) {
  .program-card:hover .open-hint { transform: translateX(4px); }
}

.empty-state { text-align: center; padding: 70px 20px; color: var(--text-dim); font-size: 15px; line-height: 1.7; }

/* ---------- cards & tables ---------- */

.card {
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0) 45%), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}
.card h2 { font-size: 19px; margin-bottom: 18px; }

.table-wrap { overflow-x: auto; margin: 0 -6px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border-soft); }
th {
  color: var(--text-faint);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.badge.admin { background: var(--primary-soft); color: var(--primary); border: 1px solid rgba(226, 163, 60, 0.3); }
.badge.user { background: rgba(148, 178, 210, 0.1); color: #a8c4de; border: 1px solid rgba(148, 178, 210, 0.22); }
.badge.active { background: var(--success-soft); color: var(--success); border: 1px solid rgba(143, 196, 138, 0.28); }
.badge.inactive { background: var(--danger-soft); color: #f0a294; border: 1px solid rgba(226, 106, 85, 0.3); }

.row-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.checkbox-list { display: flex; flex-direction: column; gap: 9px; margin: 8px 0 6px; }
.checkbox-list label {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; cursor: pointer; color: var(--text);
}
.checkbox-list input { width: 17px; height: 17px; accent-color: var(--primary); }

.muted { color: var(--text-dim); font-size: 13px; }
.mt { margin-top: 14px; }

/* ---------- modal ---------- */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 8, 6, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 40%), var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 30px;
  width: 100%; max-width: 470px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-pop);
  animation: rise 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal h2 { font-size: 21px; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------- Chicken Health AI chat ---------- */

.ai-list-head, .ai-chat-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.ai-credits {
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--primary-soft);
  border: 1px solid rgba(226, 163, 60, 0.25);
  color: var(--primary);
  font-weight: 600;
}

.ai-chat-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 17px 18px; margin-bottom: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.18s, transform 0.18s, background 0.18s;
}
@media (hover: hover) {
  .ai-chat-item:hover { border-color: rgba(226, 163, 60, 0.45); transform: translateX(3px); background: var(--bg-card-hover); }
}

.ai-messages {
  min-height: 260px; max-height: 56vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
  padding: 6px 4px 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.ai-messages::-webkit-scrollbar { width: 8px; }
.ai-messages::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
.ai-messages::-webkit-scrollbar-track { background: transparent; }

.ai-msg {
  max-width: 82%;
  border-radius: 18px;
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.62;
  animation: rise 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.ai-msg.user {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--primary-hover), var(--primary));
  color: var(--primary-ink);
  font-weight: 500;
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 20px -10px rgba(226, 163, 60, 0.5);
}
.ai-msg.assistant {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-card);
}
.ai-msg.ai-thinking { color: var(--text-dim); }
.ai-msg.ai-thinking .ai-msg-text::after {
  content: "...";
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: pulse-dots 1.2s infinite;
}
.ai-msg-images { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 8px; }
.ai-msg-images img {
  width: 116px; height: 116px;
  object-fit: cover;
  border-radius: 12px;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-previews { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.ai-preview { position: relative; animation: rise 0.25s ease; }
.ai-preview img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
}
.ai-preview button {
  position: absolute; top: -7px; right: -7px;
  width: 21px; height: 21px; border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.4);
  background: var(--danger); color: #fff;
  font-size: 12px; cursor: pointer; line-height: 1;
}

.ai-input-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 10px; }
.ai-attach { cursor: pointer; padding: 11px 14px; font-size: 17px; }
.ai-text {
  flex: 1; resize: none;
  padding: 12px 15px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-body);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.ai-text::placeholder { color: var(--text-faint); }
.ai-text:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(226, 163, 60, 0.16); }

/* ---------- Feed Orders ---------- */

.fo-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.fo-product {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}
.fo-product:last-of-type { border-bottom: none; }
.fo-product input.fo-qty {
  width: 90px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  text-align: center;
}
.fo-product input.fo-qty:focus { outline: none; border-color: var(--primary); }

.fo-order { padding: 20px 22px; }
.fo-order-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.fo-item {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 14px; color: var(--text-dim);
  padding: 3px 0;
}
.fo-total {
  display: flex; justify-content: space-between; gap: 10px;
  font-weight: 700; font-size: 15px;
  border-top: 1px solid var(--border-soft);
  margin-top: 8px; padding-top: 10px;
  color: var(--primary);
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .topbar nav a { padding: 7px 11px; font-size: 13px; }
  .container { padding: 24px 16px 60px; }
  .page-title { font-size: 26px; }
  .auth-card { padding: 34px 26px 30px; }
  .ai-msg { max-width: 92%; }
  .ai-msg-images img { width: 96px; height: 96px; }

  /* Phones zoom the page when focusing inputs smaller than 16px - avoid it */
  .field input, .field select, .field textarea, .ai-text, .fo-product input.fo-qty {
    font-size: 16px;
  }

  /* Chat: let the page scroll naturally and keep the input bar reachable */
  .ai-messages { max-height: none; overflow-y: visible; }
  .ai-input-row {
    position: sticky;
    bottom: 10px;
    z-index: 20;
    background: rgba(18, 26, 20, 0.96);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px;
    margin: 10px -6px 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .ai-attach { padding: 12px 14px; }
  .ai-send { padding: 12px 18px; }
}
