/* ===== DASHBOARD THEME ===== */
/* Extends the brand palette for the inventory/orders dashboard */

/* Dashboard layout */
.dashboard-shell {
  min-height: 100vh;
  background: var(--bg);
}

.dash-header {
  padding: 16px 32px;
  background: var(--charcoal);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.dash-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-logo {
  width: 24px;
  height: 24px;
  background: var(--green);
  border-radius: 5px;
}
.dash-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}
.dash-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-left: 12px;
}
.dash-back {
  font-size: 13px;
  color: var(--green-light);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.dash-back:hover { opacity: 1; }

/* Tab navigation */
.dash-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-alt);
  border-bottom: 1px solid rgba(107, 143, 113, 0.12);
  padding: 0 32px;
}
.dash-tab {
  padding: 14px 24px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  letter-spacing: 0.02em;
  user-select: none;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-body);
}
.dash-tab:hover {
  color: var(--text);
}
.dash-tab.active {
  color: var(--green-dark);
  border-bottom-color: var(--green);
}
.dash-tab .tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  margin-left: 6px;
}
.tab-badge-alert {
  background: #dc3545;
  color: #fff;
}

/* Content area */
.dash-content {
  padding: 28px 32px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px 24px;
  border: 1px solid rgba(107, 143, 113, 0.08);
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--charcoal);
  line-height: 1;
}
.stat-value.alert {
  color: #dc3545;
}

/* Tables */
.table-wrap {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid rgba(107, 143, 113, 0.08);
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  overflow: hidden;
  margin-bottom: 24px;
}
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(107, 143, 113, 0.08);
}
.table-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--charcoal);
}
.table-actions {
  display: flex;
  gap: 8px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
}
table.data-table thead th {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid rgba(107, 143, 113, 0.08);
}
table.data-table tbody td {
  font-size: 13px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(107, 143, 113, 0.05);
  color: var(--text);
  vertical-align: middle;
}
table.data-table tbody tr:last-child td {
  border-bottom: none;
}
table.data-table tbody tr:hover {
  background: rgba(107, 143, 113, 0.03);
}

/* Stock quantity badges */
.qty-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.qty-ok {
  background: rgba(107, 143, 113, 0.1);
  color: var(--green-dark);
}
.qty-low {
  background: rgba(200, 145, 58, 0.12);
  color: #96690d;
}
.qty-critical {
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}
.status-pending {
  background: rgba(200, 145, 58, 0.12);
  color: #96690d;
}
.status-shipped {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}
.status-delivered {
  background: rgba(107, 143, 113, 0.12);
  color: var(--green-dark);
}
.status-cancelled {
  background: rgba(220, 53, 69, 0.08);
  color: #dc3545;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-pending .status-dot { background: #c8913a; }
.status-shipped .status-dot { background: #2563eb; }
.status-delivered .status-dot { background: var(--green); }
.status-cancelled .status-dot { background: #dc3545; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  font-family: var(--font-body);
}
.btn-primary {
  background: var(--green);
  color: #fff;
}
.btn-primary:hover {
  background: var(--green-dark);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(107, 143, 113, 0.2);
}
.btn-ghost:hover {
  background: rgba(107, 143, 113, 0.06);
  color: var(--text);
}

/* Forms / Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--white);
  border-radius: 14px;
  padding: 28px;
  width: 90%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  transform: translateY(8px);
  transition: transform 0.2s;
}
.modal-overlay.open .modal {
  transform: translateY(0);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 20px;
}
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.form-input,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(107, 143, 113, 0.2);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}
.form-input:focus,
.form-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(107, 143, 113, 0.1);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* Low-stock alert row */
.alert-row {
  background: rgba(220, 53, 69, 0.03) !important;
}

/* Inventory matrix */
.matrix-product {
  font-weight: 600;
  color: var(--charcoal);
}
.matrix-sku {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.filter-select {
  padding: 6px 12px;
  border: 1px solid rgba(107, 143, 113, 0.2);
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--white);
  outline: none;
}

/* Editable stock cell */
.stock-cell {
  cursor: pointer;
  position: relative;
}
.stock-cell:hover {
  background: rgba(107, 143, 113, 0.05);
}
.stock-input {
  width: 70px;
  padding: 4px 8px;
  border: 1px solid var(--green);
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-body);
  text-align: center;
  outline: none;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.4;
}
.empty-state-text {
  font-size: 14px;
}

/* Section within tab */
.tab-section {
  display: none;
}
.tab-section.active {
  display: block;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  background: var(--charcoal);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}
.toast-success { background: var(--green-dark); }
.toast-error { background: #dc3545; }

/* Loading shimmer */
.loading-shimmer {
  position: relative;
  overflow: hidden;
  min-height: 60px;
}
.loading-shimmer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(107, 143, 113, 0.06), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Responsive */
/* Overview two-column grid */
#tab-overview .stats-row {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

@media (max-width: 900px) {
  .dash-header { padding: 12px 16px; }
  .dash-tabs { padding: 0 16px; overflow-x: auto; }
  .dash-tab { white-space: nowrap; padding: 12px 16px; }
  .dash-content { padding: 20px 16px; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  #tab-overview > div[style] { grid-template-columns: 1fr !important; }
  table.data-table { font-size: 12px; }
  table.data-table thead th,
  table.data-table tbody td { padding: 8px 10px; }
  .form-row { grid-template-columns: 1fr; }
}
/* Order detail meta row */
.order-detail-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.order-detail-meta .status-badge {
  font-size: 12px;
}

/* Form readonly display */
.form-readonly {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 8px;
  min-height: 40px;
  display: flex;
  align-items: center;
}

/* Pagination bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}
.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Order row hover effect for clickability */
table.data-table tbody tr.row-clickable {
  cursor: pointer;
}
table.data-table tbody tr.row-clickable:hover {
  background: rgba(107, 143, 113, 0.06) !important;
}

@media (max-width: 600px) {
  .stats-row { grid-template-columns: 1fr; }
  .dash-subtitle { display: none; }
}
