/* ─────────────────────────────────────────────────────────
   CSA Vendor Portal — site.css  (Bootstrap 5 companion)
   All structural layout is self-contained here.
   Bootstrap is used only for form controls, badges, utilities.
───────────────────────────────────────────────────────── */

:root {
  --brand-dark:  #1a3a28;
  --brand-mid:   #2f6f44;
  --brand-light: #e8f5ec;
  --sidebar-w:   240px;
  --topbar-h:    58px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', Arial, sans-serif;
  background: #f4f6f8;
  color: #1f2937;
  margin: 0;
  padding: 0;
}

/* ── App shell ──────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-wrapper {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--brand-dark);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}

.brand-icon {
  width: 32px; height: 32px;
  background: var(--brand-mid);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: white;
  flex-shrink: 0;
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.4);
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 14px 16px 4px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,.07);
  color: white;
}

.sidebar-nav a.active {
  background: rgba(255,255,255,.09);
  color: white;
  border-left-color: var(--brand-mid);
}

.sidebar-nav a i {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: 11px;
  color: rgba(255,255,255,.4);
  flex-shrink: 0;
}

/* ── Top bar ────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand-mid);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}

/* ── Main content ───────────────────────────────────────── */
.main-content {
  padding: 24px;
  flex: 1;
}

/* ── Section heading ────────────────────────────────────── */
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-heading h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 2px;
}

.section-heading p {
  font-size: 13px;
  color: #6b7280;
  margin: 0;
}

/* ── Stat cards grid ────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: 10px;
  padding: 18px 20px;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

/* ── Panel ──────────────────────────────────────────────── */
.panel {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.panel-body {
  padding: 20px;
}

/* ── Data table ─────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  background: #f9fafb;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b7280;
  padding: 9px 16px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px;
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #fafafa; }

/* ── Status badges ──────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-status::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-completed  { background: #dcfce7; color: #166534; }
.badge-cancelled  { background: #fee2e2; color: #991b1b; }
.badge-pickup     { background: #ede9fe; color: #5b21b6; }
.badge-delivery   { background: #e0f2fe; color: #0c4a6e; }
.badge-refunded   { background: #f3f4f6; color: #374151; }

/* ── Action buttons ─────────────────────────────────────── */
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  background: none;
  line-height: 1.4;
  white-space: nowrap;
}

.btn-action.view   { color: #374151; border-color: #d1d5db; }
.btn-action.edit   { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }
.btn-action.delete { color: #dc2626; border-color: #fecaca; background: #fff5f5; }
.btn-action.save   { color: white;   background: var(--brand-mid); border-color: var(--brand-mid); }
.btn-action.primary { color: white;  background: var(--brand-mid); border-color: var(--brand-mid); font-size: 13px; padding: 7px 14px; }

.btn-action:hover { opacity: .82; }

/* ── Inline status form ─────────────────────────────────── */
.status-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-select {
  font-size: 12px;
  padding: 4px 7px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
}

/* ── Produce thumbnail ──────────────────────────────────── */
.thumb {
  width: 40px; height: 40px;
  border-radius: 7px;
  object-fit: cover;
  display: block;
}

.thumb-placeholder {
  width: 40px; height: 40px;
  border-radius: 7px;
  background: #f3f4f6;
  display: flex; align-items: center; justify-content: center;
  color: #9ca3af; font-size: 16px;
}

/* ── Flash / alert ──────────────────────────────────────── */
.flash-success {
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  color: #166534;
  border-radius: 8px;
  padding: 11px 15px;
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.flash-error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 8px;
  padding: 11px 15px;
  font-size: 13px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Profile two-column layout ──────────────────────────── */
.profile-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
}

/* ── Form grid ──────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .full-width { grid-column: 1 / -1; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  color: #1f2937;
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: var(--brand-mid);
  box-shadow: 0 0 0 3px rgba(47,111,68,.12);
}

textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Detail view ────────────────────────────────────────── */
.details {
  background: white;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  display: grid;
  grid-template-columns: 160px 1fr;
  max-width: 820px;
  overflow: hidden;
}

.details dt,
.details dd {
  border-bottom: 1px solid #e5e7eb;
  margin: 0;
  padding: 11px 15px;
  font-size: 13px;
}

.details dt {
  background: #f9fafb;
  font-weight: 600;
  color: #6b7280;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.detail-image {
  border-radius: 9px;
  max-height: 240px;
  max-width: 400px;
  object-fit: cover;
}

/* ── Checkbox row ───────────────────────────────────────── */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.checkbox-row input { width: auto; }

/* ── Action row ─────────────────────────────────────────── */
.action-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
