/* ═══════════════════════════════════════════════════════════
   IntraEats Vendor Panel — full stylesheet
   Dark theme matching the admin panel.
═══════════════════════════════════════════════════════════ */

:root {
  --bg: #0f1220;
  --bg-2: #171a2c;
  --bg-3: #1e2338;
  --bg-input: #232842;
  --border: #2a2f4a;
  --text: #e5e7f0;
  --text-secondary: #9ba1b8;
  --text-muted: #656b85;
  --primary: #ff8a3d;
  --primary-hover: #ff9a52;
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.15);
  --red: #ef4444;
  --red-bg: rgba(239,68,68,0.15);
  --orange: #f59e0b;
  --orange-bg: rgba(245,158,11,0.15);
  --blue: #3b82f6;
  --blue-bg: rgba(59,130,246,0.15);
  --purple: #a855f7;
  --purple-bg: rgba(168,85,247,0.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ── Login ───────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f1220 0%, #232842 100%);
  padding: 20px;
}
.login-card {
  background: var(--bg-2);
  border-radius: 20px;
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.logo-badge {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin-bottom: 12px;
}
.login-brand h1 { font-size: 24px; margin-bottom: 4px; }
.login-brand p { color: var(--text-secondary); font-size: 13px; }
.login-error {
  color: var(--red);
  background: var(--red-bg);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 12px;
  display: none;
}
.login-error.show { display: block; }
.login-help {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 20px;
}

/* ── App shell ───────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 24px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 16px;
}
.sidebar-brand .logo-badge {
  width: 40px; height: 40px;
  font-size: 20px;
  border-radius: 10px;
  margin: 0;
}
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--text-secondary); font-size: 11px; letter-spacing: 0.5px; }

.vendor-name-label {
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.nav-section-title {
  padding: 12px 12px 6px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}
.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
  gap: 10px;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active {
  background: var(--primary);
  color: white;
}
.nav-item .fas { width: 16px; text-align: center; }
.badge {
  margin-left: auto;
  background: var(--red);
  color: white;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
  display: none;
}
.badge.show { display: inline-block; }
.badge-warn { background: var(--orange); }

.content-wrap {
  flex: 1;
  min-width: 0;
}
.topbar {
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title { font-size: 18px; font-weight: 700; }
.topbar-actions { display: flex; gap: 8px; }
.topbar-btn {
  background: var(--bg-3);
  color: var(--text);
  border: 0;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  font-size: 14px;
}
.topbar-btn:hover { background: var(--bg-input); }
.main {
  padding: 24px;
  min-height: calc(100vh - 60px);
}

/* ── Layout blocks ───────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h2 {
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-2);
  border-radius: 14px;
  padding: 18px;
  border: 1px solid var(--border);
}
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  font-size: 16px;
}
.stat-icon.orange  { background: var(--orange-bg); color: var(--orange); }
.stat-icon.green   { background: var(--green-bg);  color: var(--green);  }
.stat-icon.red     { background: var(--red-bg);    color: var(--red);    }
.stat-icon.blue    { background: var(--blue-bg);   color: var(--blue);   }
.stat-icon.purple  { background: var(--purple-bg); color: var(--purple); }
.stat-value {
  font-size: 22px;
  font-weight: 700;
}
.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.table-card {
  background: var(--bg-2);
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 16px;
}
.table-card table {
  width: 100%;
  border-collapse: collapse;
}
.table-card th, .table-card td {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.table-card th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-3);
}
.table-card tr:last-child td { border-bottom: 0; }
.table-card tr:hover { background: var(--bg-3); }

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-secondary);
}
.empty-state i {
  font-size: 40px;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: block;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  padding: 10px 18px;
  border-radius: 10px;
  border: 0;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-input); }
.btn-danger {
  background: var(--red-bg);
  color: var(--red);
}
.btn-danger:hover:not(:disabled) { background: var(--red); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
}
.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card {
  background: var(--bg-2);
  border-radius: 16px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Toasts ─────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: var(--bg-3);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  min-width: 240px;
  animation: slide-in 0.2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.info    { border-left: 3px solid var(--blue); }
@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Utility ────────────────────────────────────────────── */
.badge-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.pill-in-stock { background: var(--green-bg);  color: var(--green); }
.pill-low      { background: var(--orange-bg); color: var(--orange); }
.pill-out      { background: var(--red-bg);    color: var(--red); }
.pill-pending  { background: var(--blue-bg);   color: var(--blue); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.mono { font-family: Menlo, Monaco, "Courier New", monospace; }

/* ── Mobile responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -240px;
    z-index: 20;
    transition: left 0.2s;
  }
  .sidebar.open { left: 0; }
  .content-wrap { width: 100%; }
  .main { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
