/* ═══════════════════════════════════════════════════════════
   RaahDarshi AI – Global Stylesheet
   Theme: Warm Brown / Beige / White Enterprise Dashboard
   ═══════════════════════════════════════════════════════════ */

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

:root {
  --brown-primary:   #6B4226;
  --brown-mid:       #8B5A34;
  --brown-light:     #A0714F;
  --beige-bg:        #F5F0EB;
  --beige-card:      #FDFAF7;
  --beige-border:    #E8DDD4;
  --beige-input:     #F2EBE3;
  --white:           #FFFFFF;
  --text-dark:       #1A1008;
  --text-mid:        #4A3728;
  --text-muted:      #8A7060;
  --green:           #2D7A4F;
  --green-light:     #E8F5EE;
  --yellow:          #B8860B;
  --yellow-light:    #FFF8E1;
  --red:             #C0392B;
  --red-light:       #FDECEA;
  --shadow-sm:       0 2px 8px rgba(107,66,38,.08);
  --shadow-md:       0 6px 24px rgba(107,66,38,.12);
  --shadow-lg:       0 16px 48px rgba(107,66,38,.16);
  --radius-sm:       10px;
  --radius-md:       16px;
  --radius-lg:       24px;
  --radius-xl:       32px;
  --font-display:    'Playfair Display', serif;
  --font-body:       'DM Sans', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--beige-bg);
  color: var(--text-dark);
  line-height: 1.6;
  font-size: 15px;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--beige-bg); }
::-webkit-scrollbar-thumb { background: var(--beige-border); border-radius: 99px; }

/* ── Typography ────────────────────────────────────────── */
h1,h2,h3,h4,h5 { font-family: var(--font-display); color: var(--text-dark); line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); }
h3 { font-size: 1.3rem; }
p  { color: var(--text-mid); }
a  { color: var(--brown-primary); text-decoration: none; }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 50px; font-family: var(--font-body);
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .25s;
  border: none; outline: none; white-space: nowrap;
}
.btn-primary {
  background: var(--brown-primary); color: #fff;
  box-shadow: 0 4px 16px rgba(107,66,38,.3);
}
.btn-primary:hover { background: var(--brown-mid); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(107,66,38,.35); }
.btn-outline {
  background: transparent; color: var(--brown-primary);
  border: 2px solid var(--brown-primary);
}
.btn-outline:hover { background: var(--brown-primary); color: #fff; }
.btn-outline-white { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,.7); }
.btn-outline-white:hover { background: rgba(255,255,255,.15); }
.btn-sm { padding: 8px 18px; font-size: 13px; }
.btn-lg { padding: 16px 40px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--beige-card); border: 1px solid var(--beige-border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-body { padding: 24px; }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--beige-border); }

/* ── Form Elements ─────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-mid); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 12px 16px; background: var(--beige-input);
  border: 1.5px solid var(--beige-border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px; color: var(--text-dark);
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.form-control:focus { border-color: var(--brown-light); box-shadow: 0 0 0 3px rgba(107,66,38,.1); }
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: 50px; font-size: 12px; font-weight: 600;
}
.badge-high   { background: var(--red-light);    color: var(--red); }
.badge-medium { background: var(--yellow-light);  color: var(--yellow); }
.badge-low    { background: var(--green-light);   color: var(--green); }
.badge-info   { background: #EEF4FF; color: #3B5EAB; }

/* ── Top Navbar ────────────────────────────────────────── */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  background: rgba(253,250,247,.92); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--beige-border);
  padding: 0 32px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: var(--shadow-sm);
}
.navbar-brand {
  font-family: var(--font-display); font-size: 1.35rem; color: var(--brown-primary);
  font-weight: 700; display: flex; align-items: center; gap: 10px;
}
.navbar-brand .logo-dot { width: 10px; height: 10px; background: var(--brown-primary); border-radius: 50%; display: inline-block; }
.navbar-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 8px 14px; border-radius: var(--radius-sm); font-size: 14px;
  font-weight: 500; color: var(--text-mid); transition: all .2s;
}
.nav-link:hover, .nav-link.active { background: var(--beige-border); color: var(--brown-primary); }
.navbar-actions { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--brown-primary);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; cursor: pointer;
}
.navbar-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }

/* ── Sidebar (dashboard pages) ─────────────────────────── */
.layout { display: flex; min-height: 100vh; padding-top: 64px; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--beige-card);
  border-right: 1px solid var(--beige-border); padding: 24px 16px;
  position: fixed; top: 64px; left: 0; bottom: 0; overflow-y: auto;
  transition: transform .3s;
}
.sidebar-section { margin-bottom: 28px; }
.sidebar-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; padding: 0 12px; margin-bottom: 8px; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
  color: var(--text-mid); transition: all .2s; margin-bottom: 2px;
}
.sidebar-link svg { flex-shrink: 0; opacity: .7; }
.sidebar-link:hover { background: var(--beige-border); color: var(--brown-primary); }
.sidebar-link:hover svg { opacity: 1; }
.sidebar-link.active { background: var(--brown-primary); color: #fff; }
.sidebar-link.active svg { opacity: 1; }
.main-content { flex: 1; margin-left: 240px; padding: 32px; min-height: calc(100vh - 64px); }

/* ── Page Header ───────────────────────────────────────── */
.page-header { margin-bottom: 28px; }
.page-header h2 { font-size: 1.8rem; }
.page-header p { color: var(--text-muted); margin-top: 4px; }

/* ── Stat Cards ────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
  background: var(--beige-card); border: 1px solid var(--beige-border);
  border-radius: var(--radius-md); padding: 22px; box-shadow: var(--shadow-sm);
}
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--beige-bg); display: flex; align-items: center;
  justify-content: center; margin-bottom: 14px;
}
.stat-card .stat-value { font-family: var(--font-display); font-size: 2rem; color: var(--text-dark); font-weight: 600; }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.stat-card .stat-change { font-size: 12px; margin-top: 8px; }
.stat-card .stat-change.up   { color: var(--green); }
.stat-card .stat-change.down { color: var(--red); }

/* ── Table ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: 2px solid var(--beige-border); background: var(--beige-bg); }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--beige-border); color: var(--text-mid); }
tbody tr:hover { background: var(--beige-bg); }
tbody tr:last-child td { border-bottom: none; }

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,16,8,.45);
  backdrop-filter: blur(6px); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); max-width: 480px; width: 92%;
  overflow: hidden; transform: translateY(20px) scale(.97);
  transition: transform .3s;
}
.modal-overlay.open .modal { transform: none; }
.modal-split { display: flex; }
.modal-side {
  width: 180px; flex-shrink: 0; background: var(--brown-primary);
  padding: 40px 28px; display: flex; flex-direction: column;
  justify-content: center; gap: 20px;
}
.modal-side h3 { font-family: var(--font-display); color: #fff; font-size: 1.3rem; }
.modal-side p  { color: rgba(255,255,255,.75); font-size: 13px; }
.modal-body { flex: 1; padding: 36px 32px; }
.modal-body h2 { font-size: 1.4rem; margin-bottom: 4px; }
.modal-body p  { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 32px; height: 32px;
  border-radius: 50%; border: none; background: var(--beige-bg);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 16px; transition: background .2s;
}
.modal-close:hover { background: var(--beige-border); }
.modal-inner { position: relative; }

/* ── Alert / Notification ──────────────────────────────── */
.alert-item {
  background: var(--beige-card); border: 1px solid var(--beige-border);
  border-radius: var(--radius-md); padding: 18px 20px; margin-bottom: 12px;
  display: flex; gap: 14px; align-items: flex-start;
}
.alert-item.high   { border-left: 4px solid var(--red); }
.alert-item.medium { border-left: 4px solid var(--yellow); }
.alert-item.low    { border-left: 4px solid var(--green); }
.alert-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-icon.high   { background: var(--red-light);    color: var(--red); }
.alert-icon.medium { background: var(--yellow-light); color: var(--yellow); }
.alert-icon.low    { background: var(--green-light);  color: var(--green); }
.alert-content h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.alert-content p  { font-size: 13px; color: var(--text-muted); margin: 0; }
.alert-meta { margin-left: auto; text-align: right; font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ── Toast notifications ───────────────────────────────── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text-dark); color: #fff; padding: 14px 20px;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  font-size: 14px; max-width: 320px; animation: slideIn .3s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--yellow); color: var(--text-dark); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Loading spinner ───────────────────────────────────── */
.spinner {
  width: 20px; height: 20px; border: 2px solid transparent;
  border-top-color: currentColor; border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
  position: absolute; inset: 0; background: rgba(253,250,247,.8);
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit; z-index: 10;
}

/* ── Landing: Parcel tracking panel ───────────────────────────── */
.tracking-section {
  padding: 64px 32px;
  max-width: 1200px;
  margin: 0 auto;
}
.tracking-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
  align-items: start;
}
.track-card {
  position: relative;
  background: var(--beige-card);
  border: 1px solid var(--beige-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.track-card .card-header {
  background: linear-gradient(135deg, rgba(107,66,38,.10), rgba(253,250,247,1));
}
.track-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.track-card-title .muted {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}
.track-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.track-message {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--beige-border);
  background: var(--beige-bg);
  color: var(--text-mid);
  font-size: 13px;
  display: none;
}
.track-message.error { background: var(--red-light); border-color: rgba(192,57,43,.25); color: var(--red); }
.track-message.warning { background: var(--yellow-light); border-color: rgba(184,134,11,.25); color: var(--yellow); }

.track-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.track-kpi {
  background: var(--beige-bg);
  border: 1px solid var(--beige-border);
  border-radius: var(--radius-md);
  padding: 14px 14px;
}
.track-kpi .lbl {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.track-kpi .val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.track-details {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

/* Progress tracker */
.track-progress {
  margin-top: 14px;
  background: var(--beige-bg);
  border: 1px solid var(--beige-border);
  border-radius: var(--radius-md);
  padding: 14px 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.track-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  position: relative;
}
.track-step .dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--beige-border);
  box-shadow: inset 0 0 0 3px rgba(253,250,247,1);
}
.track-step .lbl {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--text-muted);
}
.track-step.done .dot {
  background: var(--green);
}
.track-step.active .dot {
  background: var(--brown-primary);
}
.track-step.done .lbl,
.track-step.active .lbl {
  color: var(--text-dark);
}
.track-step::after {
  content: "";
  position: absolute;
  top: 6px;
  left: calc(50% + 10px);
  right: calc(-50% + 10px);
  height: 2px;
  background: var(--beige-border);
}
.track-step:last-child::after { display: none; }
.track-step.done::after { background: rgba(45,122,79,.35); }

.track-detail {
  background: var(--beige-bg);
  border: 1px solid var(--beige-border);
  border-radius: var(--radius-md);
  padding: 14px 14px;
}
.track-detail .lbl {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.track-detail .val {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mid);
  line-height: 1.55;
}

@media (max-width: 900px) {
  .tracking-grid { grid-template-columns: 1fr; }
  .track-kpis { grid-template-columns: repeat(2, 1fr); }
  .track-progress { grid-template-columns: repeat(2, 1fr); }
  .track-step::after { display: none; }
}
@media (max-width: 540px) {
  .tracking-section { padding: 56px 16px; }
  .track-kpis { grid-template-columns: 1fr; }
  .track-input-row { grid-template-columns: 1fr; }
  .track-input-row .btn { width: 100%; justify-content: center; }
  .track-progress { grid-template-columns: 1fr; }
}

/* ── Gauge ─────────────────────────────────────────────── */
.gauge-container { text-align: center; }
.gauge-value { font-family: var(--font-display); font-size: 3rem; font-weight: 700; color: var(--text-dark); }
.gauge-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Chat UI ───────────────────────────────────────────── */
.chat-window { height: 420px; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.chat-bubble { max-width: 80%; }
.chat-bubble.user { align-self: flex-end; }
.chat-bubble.bot  { align-self: flex-start; }
.chat-bubble .bubble {
  padding: 12px 16px; border-radius: 18px; font-size: 14px; line-height: 1.5;
}
.chat-bubble.user .bubble { background: var(--brown-primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-bubble.bot  .bubble { background: var(--beige-input); color: var(--text-dark); border-bottom-left-radius: 4px; }
.chat-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; padding: 0 4px; }
.chat-input-row { display: flex; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--beige-border); }
.chat-input {
  flex: 1; padding: 12px 16px; background: var(--beige-input);
  border: 1.5px solid var(--beige-border); border-radius: 50px;
  font-family: var(--font-body); font-size: 14px; outline: none;
  transition: border-color .2s;
}
.chat-input:focus { border-color: var(--brown-light); }

/* ── Risk Map ──────────────────────────────────────────── */
#map { width: 100%; height: 460px; border-radius: var(--radius-md); z-index: 1; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .navbar-nav { display: none; }
  .navbar-toggle { display: flex; flex-direction: column; gap: 4px; }
  .navbar-toggle span { width: 22px; height: 2px; background: var(--text-dark); display: block; }
  .sidebar { transform: translateX(-100%); z-index: 800; }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .modal-side { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Utility ───────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-brown  { color: var(--brown-primary); }
.fw-600      { font-weight: 600; }
.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.gap-2 { gap: 8px; }
.flex  { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
@media (max-width: 640px) { .grid-2,.grid-3 { grid-template-columns: 1fr; } }
