/* ═══════════════════════════════════════════════════════════
   ORDERS  —  Sunset Orange Brand
   ═══════════════════════════════════════════════════════════ */

/* ── Order Stats Grid ───────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.order-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 30px;
}

.order-stats-card {
  background: var(--white);
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-stats-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--brand-primary-soft); }

.order-stats-card .stat-top { display: flex; align-items: center; gap: 10px; }

.order-stats-card .stat-icon {
  font-size: 1.1rem;
  color: var(--brand-primary);
  background: var(--brand-primary-soft);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.order-stats-card .label { font-size: 0.85rem; color: var(--text-muted); font-weight: 700; }
.order-stats-card .count { font-size: 1.9rem; font-weight: 700; color: var(--text-main); display: block; }

.stat-card .label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; color: var(--text-muted); margin-top: 8px; display: block; }

/* ── Table Controls ─────────────────────────────────────── */
.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  background: var(--white);
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.filter-tabs { display: flex; gap: 8px; align-items: center; }

.filter-pill {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-pill span { background: var(--bg-main); padding: 2px 8px; border-radius: 6px; font-size: 0.75rem; }

.filter-pill.active {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: var(--glow-orange);
  border-color: transparent;
}

.table-controls .left { display: flex; align-items: center; gap: 10px; }

.table-search { display: flex; align-items: center; gap: 8px; background: var(--white); padding: 6px 8px; border-radius: 12px; border: 1px solid var(--border); }
.table-search .icon { color: var(--text-muted); font-size: 1rem; margin-left: 4px; }
.table-search input { border: none; outline: none; background: transparent; padding: 6px 8px; min-width: 220px; font-size: 0.95rem; color: var(--text-main); }

.view-toggle { display: flex; gap: 8px; align-items: center; }

.view-toggle .toggle-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: transparent; border: 1px solid transparent; cursor: pointer; transition: all .16s ease; }
.view-toggle .toggle-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.view-toggle .toggle-btn.active { background: var(--white); border-color: var(--border); box-shadow: var(--shadow-xs); }

.results-count { font-weight: 700; color: var(--text-muted); background: var(--bg-main); padding: 6px 10px; border-radius: 12px; margin-left: 8px; }

/* ── Orders Table ───────────────────────────────────────── */
.orders-table-wrapper { background: var(--white); border-radius: 24px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; }

.orders-table { width: 100%; border-collapse: collapse; }

.orders-table thead th {
  background: linear-gradient(135deg, var(--brand-secondary), var(--brand-secondary-light));
  color: rgba(255, 255, 255, 0.88);
  text-align: left;
  padding: 18px 24px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 800;
}

.orders-table tbody tr { transition: background 0.2s; }
.orders-table tbody tr:hover { background: var(--brand-primary-soft); }

.orders-table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.89rem;
  font-weight: 500;
  color: var(--text-muted);
}

.order-id {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--brand-primary);
  font-size: 0.9rem;
}

.product-info strong { display: block; font-weight: 600; font-size: 0.9rem; color: var(--text-main); margin-bottom: 1px; }
.product-info span   { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.price { font-weight: 600; color: var(--text-main); font-size: 1rem; }

/* Status Badges */
.status-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }

.status-badge.active {
  background: var(--brand-teal-soft);
  color: var(--brand-teal);
  border: 1px solid rgba(16,185,129,.22);
}

.status-badge.active::before { background: var(--brand-teal); }

.status-badge.expired { background: #FEF2F2; color: var(--text-muted); border: 1px solid rgba(220,38,38,.15); }
.status-badge.expired::before { background: #d14f4f; }

/* Action Buttons */
.action-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--brand-primary);
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-icon:hover { background: var(--brand-primary); color: var(--white); border-color: var(--brand-primary); transform: scale(1.1); box-shadow: var(--glow-orange); }

/* ── Support Banner ─────────────────────────────────────── */
.support-banner {
  margin-top: 40px;
  background: linear-gradient(90deg, var(--brand-primary-soft), var(--white));
  border: 1px dashed rgba(242, 166, 90, 0.4);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.banner-icon { width: 50px; height: 50px; background: var(--white); border-radius: 15px; display: flex; align-items: center; justify-content: center; color: var(--brand-primary); font-size: 1.5rem; box-shadow: var(--shadow-sm); }
.support-banner p      { font-size: 0.95rem; color: var(--text-muted); line-height: 1.6; }
.support-banner strong { color: var(--brand-primary); }

/* ── Modal ──────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 26, 46, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
  z-index: 1200;
}

.modal.open { opacity: 1; pointer-events: auto; }

.modal .modal-dialog {
  background: var(--white);
  border-radius: 18px;
  width: 600px;
  max-width: calc(100% - 40px);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(6px) scale(.995);
  animation: modalPop 180ms ease forwards;
}

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--bg-main); }
.modal-title-wrap { display: flex; align-items: center; }
.modal-header h2  { margin: 0; font-size: 18px; font-weight: 700; color: var(--brand-primary); }
.modal-body       { padding: 18px; color: var(--text-muted); line-height: 1.55; }
.modal-body p     { margin: 8px 0; }
.modal-footer     { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border-light); }
.modal-close      { background: transparent; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); transition: color .15s; }
.modal-close:hover { color: var(--brand-primary); }
.confirm-download { box-shadow: var(--glow-orange); }
.modal .btn       { padding: 8px 14px; border-radius: 10px; color: var(--text-main); font-weight: 600; transition: background 0.15s; }
body.modal-open   { overflow: hidden; }

@keyframes modalPop {
  from { transform: translateY(12px) scale(.98); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .orders-table-wrapper { overflow-x: auto; }
  .orders-table { min-width: 900px; }
}

@media (max-width: 820px) {
  .order-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .table-controls   { flex-direction: column; align-items: stretch; gap: 12px; }
  .table-controls .left { width: 100%; justify-content: space-between; }
  .table-search input   { min-width: 140px; }
}

@media (max-width: 600px) {
  .orders-table thead { display: none; }
  .orders-table { border-collapse: separate; }
  .orders-table tbody tr { display: block; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 14px; padding: 12px; background: #fff; }
  .orders-table td { display: flex; justify-content: space-between; padding: 10px 12px; border-bottom: none; }
  .orders-table td + td { margin-top: 6px; }
  .orders-table td:nth-child(1)::before { content: 'Order ID';  font-weight:700; color:var(--text-muted); margin-right:8px; }
  .orders-table td:nth-child(2)::before { content: 'Product';   font-weight:700; color:var(--text-muted); margin-right:8px; }
  .orders-table td:nth-child(3)::before { content: 'Purchased'; font-weight:700; color:var(--text-muted); margin-right:8px; }
  .orders-table td:nth-child(4)::before { content: 'Expires';   font-weight:700; color:var(--text-muted); margin-right:8px; }
  .orders-table td:nth-child(5)::before { content: 'Price';     font-weight:700; color:var(--text-muted); margin-right:8px; }
  .orders-table td:nth-child(6)::before { content: 'Status';    font-weight:700; color:var(--text-muted); margin-right:8px; }
  .orders-table td:nth-child(7)::before { content: 'Actions';   font-weight:700; color:var(--text-muted); margin-right:8px; }
  .product-info strong { font-size: 0.95rem; }
  .action-icon { width: 36px; height: 36px; }
  .modal .modal-dialog { width: 94%; border-radius: 14px; }
  .modal-body { padding: 12px; }
}

@media (max-width: 420px) { .order-stats-grid { grid-template-columns: 1fr; } .filter-tabs { flex-wrap: wrap; gap: 6px; } .table-search input { min-width: 100px; } }