/* ============================================================
   WahKart Distributor Dashboard — shared shell + component styles
   ============================================================ */

.wkdd { background: #f9fafb; }
.wkdd * { box-sizing: border-box; }

/* ---------- Topbar ---------- */
.wkdd-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.wkdd-topbar-left { display: flex; align-items: center; gap: 12px; }

.wkdd-menu-btn {
  display: none;
  background: none;
  border: none;
  color: #4b5563;
  cursor: pointer;
  padding: 4px;
}

.wkdd-topbar-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f97316, #dc2626);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(249, 115, 22, 0.28);
}

.wkdd-topbar-titles h1 { font-size: 1rem; font-weight: 800; color: #111827; margin: 0; line-height: 1.2; }
.wkdd-topbar-titles p { font-size: 0.75rem; color: #6b7280; margin: 0; }

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

.wkdd-bell {
  position: relative;
  background: none;
  border: none;
  color: #4b5563;
  cursor: pointer;
  padding: 4px;
  display: flex;
}

.wkdd-bell:hover { color: #111827; }

.wkdd-bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wkdd-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #dc2626);
  color: #fff;
  font-weight: 700;
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Body / Sidebar / Main ---------- */
.wkdd-body { display: flex; position: relative; min-height: calc(100vh - 64px - 260px); }

.wkdd-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 45;
}

.wkdd-sidebar {
  width: 256px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
}

.wkdd-nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }

.wkdd-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  color: #4b5563;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.wkdd-nav-link:hover { background: #fff7ed; color: #c2410c; text-decoration: none; }

.wkdd-nav-link.active {
  background: linear-gradient(90deg, #f97316, #dc2626);
  color: #fff;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.25);
}

.wkdd-nav-link-main { display: flex; align-items: center; gap: 12px; }

.wkdd-nav-badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: #ffedd5;
  color: #c2410c;
}

.wkdd-nav-link.active .wkdd-nav-badge { background: rgba(255, 255, 255, 0.25); color: #fff; }

.wkdd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wkdd-main-inner { flex: 1; padding: 24px; overflow-x: hidden; }

@media (min-width: 992px) {
  .wkdd-main-inner { padding: 32px; }
}

.wkdd-footer {
  border-top: 1px solid #e5e7eb;
  background: #fff;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.75rem;
  color: #9ca3af;
}

.wkdd-footer-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; }
.wkdd-footer-links a { color: #9ca3af; text-decoration: none; }
.wkdd-footer-links a:hover { color: #ea580c; }
.wkdd-footer-links span { color: #e5e7eb; }

@media (min-width: 576px) {
  .wkdd-footer { flex-direction: row; }
}

@media (max-width: 991.98px) {
  .wkdd-menu-btn { display: flex; }
  .wkdd-sidebar {
    position: fixed;
    top: 64px;
    left: 0;
    z-index: 46;
    height: calc(100vh - 64px);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .wkdd-sidebar.open { transform: translateX(0); }
  .wkdd-overlay.show { display: block; }
}

/* ---------- Page header ---------- */
.wkdd-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.wkdd-page-header h1 { font-size: 1.5rem; font-weight: 800; color: #111827; margin: 0; }
.wkdd-page-header p { color: #6b7280; margin: 4px 0 0; font-size: 0.9375rem; }

.wkdd-select {
  padding: 10px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  background: #fff;
  outline: none;
}

.wkdd-select:focus { border-color: #fb923c; box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.18); }

/* ---------- Buttons ---------- */
.wkdd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.15s;
  font-family: var(--wk-font, 'Inter', sans-serif);
}

.wkdd-btn:hover { text-decoration: none; }

.wkdd-btn-primary { background: linear-gradient(90deg, #ea580c, #dc2626); color: #fff; }
.wkdd-btn-primary:hover { box-shadow: 0 10px 20px rgba(234, 88, 12, 0.28); color: #fff; transform: translateY(-1px); }

.wkdd-btn-outline { background: #fff; border: 1px solid #e5e7eb; color: #374151; }
.wkdd-btn-outline:hover { background: #f9fafb; color: #111827; }

.wkdd-btn-danger { background: #fee2e2; color: #dc2626; }
.wkdd-btn-danger:hover { background: #fecaca; }

.wkdd-btn-success { background: #16a34a; color: #fff; }
.wkdd-btn-success:hover { background: #15803d; color: #fff; }

.wkdd-btn-sm { padding: 6px 12px; font-size: 0.75rem; border-radius: 8px; }
.wkdd-btn-block { width: 100%; justify-content: center; }

.wkdd-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.wkdd-icon-btn:hover { background: #f3f4f6; color: #111827; }

/* ---------- Cards ---------- */
.wkdd-card {
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.wkdd-card-sm { padding: 16px; border-radius: 12px; }

.wkdd-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wkdd-card-title svg { flex-shrink: 0; }

.wkdd-grid { display: grid; gap: 16px; }
.wkdd-grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.wkdd-grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.wkdd-grid-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

@media (min-width: 992px) {
  .wkdd-grid-cols-2 { grid-template-columns: 2fr 1fr; }
  .wkdd-grid-cols-2-even { grid-template-columns: 1fr 1fr; }
  .wkdd-grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Stat cards ---------- */
.wkdd-stat {
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 16px;
  padding: 20px;
  transition: box-shadow 0.15s;
}
.wkdd-stat:hover { box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06); }

.wkdd-stat-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }

.wkdd-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.wkdd-stat-trend { display: flex; align-items: center; gap: 4px; font-size: 0.8125rem; font-weight: 700; }
.wkdd-stat-trend.up { color: #16a34a; }
.wkdd-stat-trend.down { color: #dc2626; }

.wkdd-stat h3 { font-size: 1.5rem; font-weight: 800; color: #111827; margin: 0 0 2px; }
.wkdd-stat p { font-size: 0.8125rem; color: #6b7280; margin: 0; }

.wkdd-stat-simple {
  background: #fff;
  border: 1px solid #f3f4f6;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wkdd-stat-simple h3 { font-size: 1.375rem; font-weight: 800; color: #111827; margin: 4px 0 0; }
.wkdd-stat-simple p { font-size: 0.8125rem; color: #6b7280; margin: 0; }

/* Gradient icon presets (match tsx bg-*-500 utility colors) */
.grad-blue { background: #3b82f6; }
.grad-green { background: #22c55e; }
.grad-purple { background: #a855f7; }
.grad-orange { background: #f97316; }
.grad-yellow { background: #eab308; }
.grad-red { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ---------- Forms ---------- */
.wkdd-label { display: block; font-size: 0.875rem; font-weight: 600; color: #374151; margin-bottom: 8px; }
.wkdd-hint { font-size: 0.75rem; color: #9ca3af; margin: 4px 0 0; }

.wkdd-input, .wkdd-textarea, select.wkdd-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: var(--wk-font, 'Inter', sans-serif);
  color: #111827;
  background: #fff;
}

.wkdd-input:focus, .wkdd-textarea:focus, select.wkdd-input:focus {
  border-color: #fb923c;
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.18);
}

.wkdd-input:disabled, .wkdd-textarea:disabled { background: #f9fafb; color: #6b7280; }
.wkdd-textarea { resize: vertical; }

.wkdd-search-box { position: relative; flex: 1; }
.wkdd-search-box svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.wkdd-search-box .wkdd-input { padding-left: 44px; }

/* ---------- Badges ---------- */
.wkdd-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.wkdd-badge-green { background: #dcfce7; color: #15803d; }
.wkdd-badge-red { background: #fee2e2; color: #dc2626; }
.wkdd-badge-orange { background: #ffedd5; color: #c2410c; }
.wkdd-badge-amber { background: #fef3c7; color: #b45309; }
.wkdd-badge-blue { background: #dbeafe; color: #1d4ed8; }
.wkdd-badge-gray { background: #f3f4f6; color: #4b5563; }
.wkdd-badge-yellow { background: #fef9c3; color: #a16207; }

/* ---------- Table ---------- */
.wkdd-table-wrap { overflow-x: auto; }
.wkdd-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.wkdd-table thead tr { background: #f9fafb; border-bottom: 1px solid #e5e7eb; }
.wkdd-table th { text-align: left; padding: 14px 20px; font-weight: 600; color: #374151; white-space: nowrap; }
.wkdd-table td { padding: 14px 20px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.wkdd-table tbody tr:hover { background: #f9fafb; }
.wkdd-table tbody tr:last-child td { border-bottom: none; }

.wkdd-table-seller { display: flex; align-items: center; gap: 12px; }
.wkdd-table-seller img { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.wkdd-table-seller h4 { font-size: 0.875rem; font-weight: 600; color: #111827; margin: 0; }
.wkdd-table-seller p { font-size: 0.75rem; color: #6b7280; margin: 2px 0 0; }

.wkdd-table-actions { display: flex; align-items: center; gap: 4px; }

/* ---------- Tabs (pill / underline style) ---------- */
.wkdd-tabs { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.wkdd-tab-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.875rem;
  white-space: nowrap;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #4b5563;
  cursor: pointer;
  transition: all 0.15s;
}
.wkdd-tab-pill:hover { border-color: #fdba74; }
.wkdd-tab-pill.active { border: 2px solid #fed7aa; color: #ea580c; box-shadow: 0 4px 10px rgba(234, 88, 12, 0.12); }

.wkdd-tabs-underline { display: flex; overflow-x: auto; border-bottom: 1px solid #e5e7eb; }
.wkdd-tab-underline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.wkdd-tab-underline:hover { color: #111827; }
.wkdd-tab-underline.active { color: #ea580c; border-bottom-color: #ea580c; }

/* ---------- Progress bar ---------- */
.wkdd-progress { width: 100%; background: #e5e7eb; border-radius: 999px; height: 8px; overflow: hidden; }
.wkdd-progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #f97316, #dc2626); }
.wkdd-progress.thin { height: 6px; }

/* ---------- Modal ---------- */
.wkdd-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
}
.wkdd-modal-backdrop.show { display: flex; }

.wkdd-modal {
  background: #fff;
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  margin: auto;
  box-sizing: border-box;
  overflow: hidden;
}
.wkdd-modal.wkdd-modal-lg { max-width: 640px; }

@media (max-width: 575.98px) {
  .wkdd-modal-backdrop { padding: 0; align-items: flex-end; }
  .wkdd-modal { max-width: 100%; max-height: calc(100vh - 24px); border-radius: 20px 20px 0 0; }
}

.wkdd-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  gap: 12px;
}
.wkdd-modal-header h2 { font-size: 1.25rem; font-weight: 800; color: #111827; margin: 0; }
.wkdd-modal-close { background: none; border: none; color: #9ca3af; cursor: pointer; flex-shrink: 0; }
.wkdd-modal-close:hover { color: #4b5563; }
.wkdd-modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; flex: 1; min-height: 0; }
.wkdd-modal-footer { display: flex; gap: 12px; padding: 16px 24px; border-top: 1px solid #f3f4f6; flex-shrink: 0; flex-wrap: wrap; }

@media (max-width: 480px) {
  .wkdd-modal-body { padding: 16px; }
  .wkdd-modal-header { padding: 16px; }
  .wkdd-modal-footer { padding: 12px 16px; }
}

/* ---------- Chat (Messages page) ---------- */
.wkdd-chat-shell { display: flex; flex-direction: column; min-height: 560px; border: 1px solid #f3f4f6; border-radius: 16px; overflow: hidden; background: #fff; }
@media (min-width: 768px) { .wkdd-chat-shell { flex-direction: row; height: 640px; } }

.wkdd-chat-list { width: 100%; border-bottom: 1px solid #f3f4f6; display: flex; flex-direction: column; }
@media (min-width: 768px) { .wkdd-chat-list { width: 340px; flex-shrink: 0; border-bottom: none; border-right: 1px solid #f3f4f6; } }
.wkdd-chat-list.hide-mobile { display: none; }
@media (min-width: 768px) { .wkdd-chat-list.hide-mobile { display: flex; } }

.wkdd-chat-list-header { padding: 16px; border-bottom: 1px solid #f3f4f6; }
.wkdd-chat-list-items { flex: 1; overflow-y: auto; }

.wkdd-chat-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border: none;
  border-bottom: 1px solid #f9fafb;
  border-left: 4px solid transparent;
  background: #fff;
  cursor: pointer;
}
.wkdd-chat-item:hover { background: #f9fafb; }
.wkdd-chat-item.active { background: #fff7ed; border-left-color: #ea580c; }
.wkdd-chat-item img { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; }
.wkdd-chat-item-avatar-wrap { position: relative; flex-shrink: 0; }
.wkdd-chat-online-dot { position: absolute; bottom: 0; right: 0; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; }
.wkdd-chat-item-body { flex: 1; min-width: 0; }
.wkdd-chat-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wkdd-chat-item-top h4 { font-size: 0.875rem; font-weight: 600; margin: 0; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wkdd-chat-item-top span { font-size: 0.75rem; color: #9ca3af; flex-shrink: 0; }
.wkdd-chat-item-body p { font-size: 0.8125rem; color: #6b7280; margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wkdd-chat-unread { width: 22px; height: 22px; border-radius: 50%; background: #ea580c; color: #fff; font-size: 0.6875rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.wkdd-chat-window { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.wkdd-chat-window.hide-mobile { display: none; }
@media (min-width: 768px) { .wkdd-chat-window.hide-mobile { display: flex; } }

.wkdd-chat-window-header { padding: 14px 16px; border-bottom: 1px solid #f3f4f6; display: flex; align-items: center; justify-content: space-between; }
.wkdd-chat-window-header-left { display: flex; align-items: center; gap: 10px; }
.wkdd-chat-window-header img { width: 38px; height: 38px; border-radius: 50%; }
.wkdd-chat-window-header h3 { font-size: 0.9375rem; font-weight: 700; margin: 0; }
.wkdd-chat-back { display: none; background: none; border: none; font-size: 1.1rem; cursor: pointer; color: #4b5563; }

.wkdd-chat-messages { flex: 1; overflow-y: auto; padding: 16px; background: #f9fafb; display: flex; flex-direction: column; gap: 12px; }
.wkdd-chat-bubble-row { display: flex; }
.wkdd-chat-bubble-row.seller { justify-content: flex-start; }
.wkdd-chat-bubble-row.you { justify-content: flex-end; }
.wkdd-chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 16px; font-size: 0.875rem; }
.wkdd-chat-bubble-row.seller .wkdd-chat-bubble { background: #fff; border: 1px solid #e5e7eb; border-bottom-left-radius: 4px; color: #111827; }
.wkdd-chat-bubble-row.you .wkdd-chat-bubble { background: linear-gradient(90deg, #ea580c, #dc2626); color: #fff; border-bottom-right-radius: 4px; }
.wkdd-chat-bubble span { display: block; font-size: 0.6875rem; margin-top: 4px; opacity: 0.75; }

.wkdd-chat-input-row { padding: 14px 16px; border-top: 1px solid #f3f4f6; display: flex; align-items: flex-end; gap: 10px; background: #fff; }
.wkdd-chat-input-row textarea, .wkdd-chat-input-row input { flex: 1; border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 14px; resize: none; font-size: 0.875rem; outline: none; font-family: var(--wk-font, 'Inter', sans-serif); }
.wkdd-chat-input-row input:focus { border-color: #fb923c; }
.wkdd-chat-send-btn { width: 42px; height: 42px; border-radius: 12px; border: none; background: linear-gradient(90deg, #ea580c, #dc2626); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.wkdd-chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.wkdd-chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; text-align: center; color: #9ca3af; }

/* ---------- Toggle switch ---------- */
.wkdd-toggle-checkbox { width: 20px; height: 20px; accent-color: #ea580c; cursor: pointer; }

/* ---------- Misc helpers ---------- */
.wkdd-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wkdd-stack { display: flex; flex-direction: column; gap: 24px; }
.wkdd-stack-sm { display: flex; flex-direction: column; gap: 12px; }
.wkdd-muted { color: #6b7280; }
.wkdd-text-sm { font-size: 0.875rem; }
.wkdd-text-xs { font-size: 0.75rem; }
.wkdd-fw-600 { font-weight: 600; }
.wkdd-fw-800 { font-weight: 800; }
.wkdd-mb-0 { margin-bottom: 0 !important; }

.wkdd-info-row { display: flex; align-items: flex-start; gap: 10px; font-size: 0.875rem; color: #374151; margin-bottom: 10px; }
.wkdd-info-row:last-child { margin-bottom: 0; }
.wkdd-info-row svg { color: #9ca3af; flex-shrink: 0; margin-top: 2px; }

.d-none { display: none !important; }
