﻿/* ══════════════════════════════════════════════
   style.css — Shared Base Styles
   AgriMandi.Farm | Global Design System
   ══════════════════════════════════════════════ */

/* ── 1. CSS Variables (Design Tokens) ────────── */
:root {
  --lemon: #f7e03a;
  --lemon-dk: #d4b800;
  --green: #1b4d2e;
  --green-md: #2e7d4f;
  --green-lt: #4caf73;
  --white: #ffffff;
  --gold: #ffb800;
  --red: #e53935;
  --bg: #122b1a;
}

/* ── 2. Reset & Base ──────────────────────────── */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "DM Sans", sans-serif;
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── 2b. Instant "tap busy" feedback ──────────────
   Applied directly to individual interactive elements (crop tabs,
   period tabs, filter/pagination buttons) the instant a page's own
   isLoading flag flips true — independent of any delayed-spinner
   overlay. Without this, a tap during the pre-spinner window is
   silently swallowed by an `if (isLoading) return;` guard with no
   visual sign the tap was even received. Removed the instant
   isLoading flips back false. */
.tap-busy {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.15s;
}

/* ── 3. Bottom Navigation ─────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  display: flex;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 50;
}

.nav-btn {
  flex: 1;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: color 0.2s;
  color: white;
  border-radius: 20px;
}

.nav-btn:hover {
  color: var(--lemon);
  background: rgba(247, 224, 58, 0.15);
}

.nav-btn .nav-icon {
  font-size: 1.3rem;
}

/* ── 4. Form Elements ─────────────────────────── */
input,
select,
textarea {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 45, 24, 0.95);
  color: var(--white);
  font-family: inherit;
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

select option {
  background: #173821;
  color: var(--white);
}

/* ── 4b. Village Autocomplete (shared) ────────── */
.autocomplete-wrap {
  position: relative;
}

.autocomplete-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin-top: 4px;
  background: #173821;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  max-height: 180px;
  overflow-y: auto;
  list-style: none;
  padding: 4px 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}

.autocomplete-suggestions.hidden {
  display: none;
}

.autocomplete-suggestions li {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--white);
}

.autocomplete-suggestions li:hover {
  background: rgba(247, 224, 58, 0.15);
  color: var(--lemon);
}

/* Keyboard-highlighted suggestion (Arrow Up/Down) — attachBuyerAutocomplete
   in js/common/common.js only, the other autocomplete helpers are
   click-only and never add this class. Same highlight color as :hover
   above so keyboard and mouse selection look identical. */
.autocomplete-suggestions li.active {
  background: rgba(247, 224, 58, 0.15);
  color: var(--lemon);
}

/* ── 5. Card Component ────────────────────────── */
.card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
}

/* ── 6. Typography Utilities ──────────────────── */
.section-title {
  font-family: "Playfair Display", serif;
  color: var(--lemon);
  font-weight: 700;
}

.glass-effect {
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

/* ── 7. Toast Notifications ───────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  min-width: 260px;
  max-width: 320px;
  padding: 14px 16px;
  border-radius: 14px;
  color: white;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.25s ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.toast-success {
  background: rgba(46, 125, 79, 0.95);
  border: 1px solid rgba(76, 175, 115, 0.3);
}

.toast-error {
  background: rgba(180, 40, 40, 0.95);
  border: 1px solid rgba(255, 80, 80, 0.3);
}

.toast-info {
  background: rgba(27, 77, 46, 0.95);
  border: 1px solid rgba(247, 224, 58, 0.2);
}

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

/* ── 8. Page & Wrapper Layout ─────────────────── */

/* Space above fixed bottom nav */
.page,
.wrapper,
.landing-container {
  padding-bottom: 100px;
}

/* Standardized container width */
.page,
.wrapper {
  max-width: 480px;
  margin: 0 auto;
  padding-left: 18px;
  padding-right: 18px;
  box-sizing: border-box;
}

/* Landing-specific tweaks */
.landing-container .buttons-section {
  justify-items: center;
  align-items: center;
}
.landing-container .features .feature-item {
  display: flex;
  align-items: center;
}

/* ── 9. Dashboard Layout ──────────────────────── */
.dashboard-container {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  padding-bottom: 100px;
}

.dashboard-header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px 0;
  border-bottom: 1px solid rgba(247, 224, 58, 0.2);
}

.dashboard-header h1 {
  font-family: "Playfair Display", serif;
  font-size: 1.8rem;
  color: var(--lemon);
  margin-bottom: 8px;
}

.dashboard-header p {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
}

.dashboard-role-badge {
  display: inline-block;
  padding: 6px 14px;
  background: rgba(247, 224, 58, 0.15);
  border: 1px solid rgba(247, 224, 58, 0.4);
  border-radius: 20px;
  color: var(--lemon);
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── 10. Dashboard Grid & Cards ───────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.dashboard-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(
    135deg,
    rgba(76, 175, 115, 0.12),
    rgba(247, 224, 58, 0.08)
  );
  border: 1px solid rgba(247, 224, 58, 0.2);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: var(--white);
  min-height: 140px;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  background: linear-gradient(
    135deg,
    rgba(76, 175, 115, 0.18),
    rgba(247, 224, 58, 0.14)
  );
  border-color: rgba(247, 224, 58, 0.4);
  box-shadow: 0 8px 20px rgba(247, 224, 58, 0.15);
}

.dashboard-card-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  display: block;
}

.dashboard-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  letter-spacing: 0.3px;
}

/* Full-width card variant */
.dashboard-card-full {
  grid-column: 1 / -1;
  min-height: 100px;
  flex-direction: row;
  justify-content: flex-start;
  padding: 18px 22px;
}

.dashboard-card-full .dashboard-card-icon {
  margin-bottom: 0;
  margin-right: 16px;
  font-size: 2.2rem;
  flex-shrink: 0;
}

.dashboard-card-full .dashboard-card-title {
  text-align: left;
}

/* ── 11. User Info Block ──────────────────────── */
.user-info {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(247, 224, 58, 0.15);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 24px;
  text-align: center;
}

.user-info p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
}

.user-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--lemon);
  margin-bottom: 8px;
}

/* ── 12. Logout Button ────────────────────────── */
.btn-logout {
  width: 100%;
  padding: 14px 20px;
  background: rgba(229, 57, 53, 0.15);
  border: 1px solid rgba(229, 57, 53, 0.35);
  border-radius: 12px;
  color: #ff6b6b;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 10px;
  grid-column: 1 / -1;
}

.btn-logout:hover {
  background: rgba(229, 57, 53, 0.25);
  border-color: rgba(229, 57, 53, 0.5);
  transform: translateY(-2px);
}

/* ── 13. Admin Header ─────────────────────────── */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(247, 224, 58, 0.15);
}

.admin-header-logo {
  font-family: "Playfair Display", serif;
  font-size: 1.4rem;
  color: var(--lemon);
}

.admin-header-logo span {
  color: var(--white);
}

.header-spacer {
  width: 40px;
}

/* ── 14. Responsive Breakpoints ───────────────── */
@media (max-width: 420px) {
  .brand-name {
    font-size: 1.8rem;
  }
  .logo-large {
    font-size: 3rem;
  }
  .nav-btn {
    font-size: 0.65rem;
  }
  .bottom-nav {
    max-width: 100%;
    left: 0%;
    transform: none;
  }
}

@media (max-width: 480px) {
  .dashboard-grid {
    gap: 12px;
  }
  .dashboard-card {
    padding: 20px 14px;
    min-height: 130px;
    border-radius: 14px;
  }
  .dashboard-card-icon {
    font-size: 2.4rem;
    margin-bottom: 10px;
  }
  .dashboard-card-title {
    font-size: 0.88rem;
  }
  .dashboard-header h1 {
    font-size: 1.6rem;
  }
}
