/* 
  Orders Section — Modern Glass Grid Design
  Matches dashboard dark theme: #0f1115 bg, #13B5F3 accent, Tajawal font
*/

/* ═══════════════════════════════════════════
   STATS ROW — Compact Stat Chips
   ═══════════════════════════════════════════ */

.orders-stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.orders-stat-chip {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.orders-stat-chip::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  border-radius: 0 16px 16px 0;
}

.orders-stat-chip.stat-all::before {
  background: var(--accent-color);
}
.orders-stat-chip.stat-pending::before {
  background: #f59e0b;
}
.orders-stat-chip.stat-in-progress::before {
  background: #8b5cf6;
}
.orders-stat-chip.stat-completed::before {
  background: #10b981;
}
.orders-stat-chip.stat-cancelled::before {
  background: #ef4444;
}

.orders-stat-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

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

.stat-all .stat-chip-icon {
  background: rgba(19, 181, 243, 0.12);
  color: var(--accent-color);
}
.stat-pending .stat-chip-icon {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}
.stat-in-progress .stat-chip-icon {
  background: rgba(139, 92, 246, 0.12);
  color: #8b5cf6;
}
.stat-completed .stat-chip-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.stat-cancelled .stat-chip-icon {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.stat-chip-info {
  display: flex;
  flex-direction: column;
}

.stat-chip-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
}

.stat-chip-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════
   STATUS FILTER — Segmented Chips
   One chip per order state (incl. accepted / on-my-way) so no
   order is ever unfilterable. Each chip carries its own accent via
   the --chip-accent / --chip-bg-active custom properties.
   ═══════════════════════════════════════════ */

.orders-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 30px 22px;
}

.orders-filter-chip {
  --chip-accent: var(--accent-color);
  --chip-bg-active: rgba(19, 181, 243, 0.14);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease,
    border-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.orders-filter-chip i {
  font-size: 12px;
  color: var(--chip-accent);
  opacity: 0.85;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.orders-filter-chip:hover {
  border-color: var(--chip-accent);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.orders-filter-chip:hover i {
  opacity: 1;
}

.orders-filter-chip:focus-visible {
  outline: 2px solid var(--chip-accent);
  outline-offset: 2px;
}

.orders-filter-chip.is-active {
  background: var(--chip-bg-active);
  border-color: var(--chip-accent);
  color: var(--chip-accent);
  box-shadow: 0 4px 14px -6px var(--chip-accent);
}

.orders-filter-chip.is-active i {
  opacity: 1;
}

/* Per-status accents (match the stat chips + status pills) */
.orders-filter-chip.ofc-all {
  --chip-accent: var(--accent-color);
  --chip-bg-active: rgba(19, 181, 243, 0.14);
}
.orders-filter-chip.ofc-pending {
  --chip-accent: #f59e0b;
  --chip-bg-active: rgba(245, 158, 11, 0.14);
}
.orders-filter-chip.ofc-accepted {
  --chip-accent: #14b8a6;
  --chip-bg-active: rgba(20, 184, 166, 0.14);
}
.orders-filter-chip.ofc-on-my-way {
  --chip-accent: #0ea5e9;
  --chip-bg-active: rgba(14, 165, 233, 0.14);
}
.orders-filter-chip.ofc-in-progress {
  --chip-accent: #8b5cf6;
  --chip-bg-active: rgba(139, 92, 246, 0.14);
}
.orders-filter-chip.ofc-completed {
  --chip-accent: #10b981;
  --chip-bg-active: rgba(16, 185, 129, 0.14);
}
.orders-filter-chip.ofc-cancelled {
  --chip-accent: #ef4444;
  --chip-bg-active: rgba(239, 68, 68, 0.14);
}

/* On narrow screens the chips become a single swipeable row so the
   filter never wraps into a tall block that pushes the list down. */
@media (max-width: 640px) {
  .orders-filter {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 4px 18px 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .orders-filter::-webkit-scrollbar {
    display: none;
  }
  .orders-filter-chip {
    flex: 0 0 auto;
  }
}

/* ═══════════════════════════════════════════
   TOOLBAR — Filter Bar
   ═══════════════════════════════════════════ */

.orders-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 24px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 16px;
}

.orders-toolbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.orders-toolbar-title i {
  color: var(--accent-color);
  font-size: 18px;
}

.orders-filter-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.orders-filter-select {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-family: "Tajawal", sans-serif;
  min-width: 160px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 36px;
}

.orders-filter-select:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(19, 181, 243, 0.12);
}

/* ═══════════════════════════════════════════
   ORDERS GRID — Responsive Card Grid
   ═══════════════════════════════════════════ */

.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
  width: 100%;
}

/* ═══════════════════════════════════════════
   ORDER CARD — Glass Morphism Medium Card
   ═══════════════════════════════════════════ */

.order-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  opacity: 0;
  animation: orderCardIn 0.5s ease forwards;
}

.order-card:hover {
  transform: translateY(-4px);
  border-color: rgba(19, 181, 243, 0.3);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(19, 181, 243, 0.1);
}

/* Locked card (completed/cancelled) — subtle visual cue */
.order-card.order-locked {
  opacity: 0.85;
}

.order-card.order-locked:hover {
  transform: translateY(-2px);
  border-color: var(--border-color);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ── Card Header ── */
.order-card-header {
  padding: 20px 22px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.order-card-id-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-card-icon {
  width: 42px;
  height: 42px;
  background: rgba(19, 181, 243, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-color);
  font-size: 17px;
  flex-shrink: 0;
}

.order-card-ref {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.order-card-date {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.order-card-date i {
  font-size: 11px;
}

/* Status Pill */
.order-status-pill {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.order-status-pill.pill-pending {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.order-status-pill.pill-in-progress {
  background: rgba(139, 92, 246, 0.12);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.order-status-pill.pill-completed {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.order-status-pill.pill-cancelled {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ── Card Body ── */
.order-card-body {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

/* Info Row — 2-col layout inside card */
.order-info-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.order-info-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.order-info-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.order-info-value {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-info-value i {
  color: var(--accent-color);
  font-size: 12px;
  opacity: 0.7;
}

/* Divider */
.order-card-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  margin: 2px 0;
}

/* ── Card Footer — Total + Action ── */
.order-card-footer {
  padding: 16px 22px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-total-block {
  display: flex;
  flex-direction: column;
}

.order-total-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.order-total-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.order-total-value small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-right: 4px;
}

/* Action Button */
.order-action-btn {
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  font-family: "Tajawal", sans-serif;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}

.order-action-btn.btn-change-status {
  background: rgba(19, 181, 243, 0.1);
  color: var(--accent-color);
  border-color: rgba(19, 181, 243, 0.2);
}

.order-action-btn.btn-change-status:hover {
  background: rgba(19, 181, 243, 0.2);
  border-color: rgba(19, 181, 243, 0.4);
  transform: scale(1.04);
}

.order-action-btn.btn-locked {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: default;
  opacity: 0.6;
  border-color: transparent;
}

.order-action-btn.btn-locked:hover {
  transform: none;
}

/* Payment badge inline */
.order-payment-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.order-payment-badge.badge-paid {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
}

.order-payment-badge.badge-unpaid {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */

.orders-empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}

.empty-state-icon {
  font-size: 56px;
  opacity: 0.2;
  margin-bottom: 16px;
  color: var(--accent-color);
}

.orders-empty-state h3 {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 8px;
  font-weight: 700;
}

.orders-empty-state p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════
   ORDER STATUS MODAL — Redesigned
   ═══════════════════════════════════════════ */

.order-modal-content {
  background: var(--surface-color) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6) !important;
  border-radius: 20px !important;
  max-width: 440px !important;
  padding: 0 !important;
  overflow: hidden;
  animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
  position: relative;
}

.order-modal-content::before {
  display: none;
}

.order-modal-header {
  padding: 20px 24px !important;
  border-bottom: 1px solid var(--border-color) !important;
  margin-bottom: 0 !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.order-modal-header .modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.order-modal-close {
  background: transparent !important;
  border: none !important;
  border-radius: 8px !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary) !important;
  transition: all 0.2s ease;
  cursor: pointer;
}

.order-modal-close:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text-primary) !important;
}

.order-modal-body {
  padding: 20px 24px 24px !important;
}

/* ── New Order Status Modal (osm-*) ─────────────── */

.osm-header-strip {
  background: var(--bg-color);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--border-color);
}

.osm-ref-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.osm-ref {
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-color);
}

.osm-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
}

.osm-total {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.osm-total small {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.osm-info-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.osm-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-color);
  border: 1px solid var(--border-color);
}

.osm-chip i {
  font-size: 11px;
  opacity: 0.6;
}

.osm-divider {
  height: 1px;
  background: var(--border-color);
  margin-bottom: 18px;
}

.osm-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.osm-status-options {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.osm-status-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 14px;
  border: 2px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.osm-status-btn i:first-child {
  font-size: 18px;
}

.osm-lock-icon {
  font-size: 9px !important;
  opacity: 0.4;
}

.osm-status-btn:hover {
  border-color: var(--st-color);
  background: var(--st-bg);
  color: var(--st-color);
}

.osm-status-btn.active {
  border-color: var(--st-color);
  background: var(--st-bg);
  color: var(--st-color);
  box-shadow: 0 0 0 1px var(--st-color);
}

.osm-status-btn.active .osm-lock-icon {
  opacity: 0.8;
}

.osm-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.15);
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.osm-warning i {
  color: #f59e0b;
  font-size: 14px;
  flex-shrink: 0;
}

.osm-save-btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-main);
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s ease;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
}

.osm-save-btn:hover {
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.osm-save-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: var(--text-secondary);
}

/* Legacy classes kept for compat but no longer used in new modal */
.status-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.status-choice-tile {
  background: rgba(19, 181, 243, 0.03);
  border: 1.5px solid rgba(19, 181, 243, 0.2);
  border-radius: 14px;
  padding: 22px 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
  text-align: center;
  box-shadow: none;
}

.status-choice-tile:hover {
  background: rgba(19, 181, 243, 0.08);
  transform: translateY(-2px);
  border-color: rgba(19, 181, 243, 0.3);
}

.status-choice-tile .choice-icon {
  font-size: 26px;
  color: rgba(255, 255, 255, 0.3);
  transition: all 0.3s ease;
}

.status-choice-tile .choice-label {
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.5);
  transition: all 0.3s ease;
}

/* Active / Selected */
.status-choice-tile.selected {
  background: rgba(255, 255, 255, 0.06);
}

.status-choice-tile.selected .choice-label {
  color: #fff;
}

.status-choice-tile.selected .choice-icon {
  transform: scale(1.15);
}

/* Checkmark on selected */
.status-choice-tile.selected::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: -8px;
  left: -8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: checkPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* In Progress tile colors */
.status-choice-tile[data-value="in_progress"]:hover {
  border-color: rgba(139, 92, 246, 0.3);
}
.status-choice-tile[data-value="in_progress"].selected {
  border-color: #8b5cf6;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.12);
}
.status-choice-tile[data-value="in_progress"].selected .choice-icon {
  color: #8b5cf6;
}
.status-choice-tile[data-value="in_progress"].selected::after {
  background: #8b5cf6;
}

/* Completed tile colors */
.status-choice-tile[data-value="completed"]:hover {
  border-color: rgba(16, 185, 129, 0.3);
}
.status-choice-tile[data-value="completed"].selected {
  border-color: #10b981;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.12);
}
.status-choice-tile[data-value="completed"].selected .choice-icon {
  color: #10b981;
}
.status-choice-tile[data-value="completed"].selected::after {
  background: #10b981;
}

/* Cancelled tile colors */
.status-choice-tile[data-value="order_cancelled"]:hover {
  border-color: rgba(239, 68, 68, 0.3);
}
.status-choice-tile[data-value="order_cancelled"].selected {
  border-color: #ef4444;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.12);
}
.status-choice-tile[data-value="order_cancelled"].selected .choice-icon {
  color: #ef4444;
}
.status-choice-tile[data-value="order_cancelled"].selected::after {
  background: #ef4444;
}

/* Lock Hint on Final Status Tiles */
.choice-lock-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}

.choice-lock-hint i {
  font-size: 10px;
}

.status-choice-tile.selected .choice-lock-hint {
  color: rgba(255, 255, 255, 0.7);
}

/* Modal Warning Box */
.modal-warning-box {
  background: rgba(245, 158, 11, 0.06);
  border: 1.5px solid rgba(245, 158, 11, 0.2);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 22px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}

.modal-warning-box i {
  color: #f59e0b;
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.modal-warning-box strong {
  color: #f59e0b;
  font-weight: 700;
}

/* Modal Save Button */
.modal-save-btn {
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: "Tajawal", sans-serif;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.3);
}

.modal-save-btn:hover {
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.45);
  transform: translateY(-2px);
}

.modal-save-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: var(--text-secondary);
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */

@keyframes orderCardIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes checkPop {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 1200px) {
  .orders-stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .orders-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .status-choice-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .orders-stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .orders-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .orders-toolbar {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
  }

  .orders-filter-select {
    width: 100%;
  }

  .order-info-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .order-modal-content {
    max-width: 95vw !important;
    margin: 0 12px;
  }

  .status-choice-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .modal-summary-details {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .orders-stats-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .orders-stat-chip {
    padding: 16px;
  }

  .stat-chip-value {
    font-size: 22px;
  }

  .order-card-header {
    flex-direction: column;
    gap: 12px;
  }

  .order-card-body {
    padding: 16px 18px;
  }

  .order-card-footer {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
  }

  .order-action-btn {
    justify-content: center;
    padding: 10px;
  }
}

/* ═══════════════════════════════════════════
   ORDERS LIST — Rows
   ═══════════════════════════════════════════ */

.orders-list {
  display: flex;
  flex-direction: column;
}

/* each order row */
.orow {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease;
  width: 100%;
}

.orow:last-child {
  border-bottom: none;
}

.orow:hover {
  background: rgba(255, 255, 255, 0.015);
}

/* expanded state */
.orow.orow-open {
  background: rgba(19, 181, 243, 0.02);
  border-bottom-color: rgba(19, 181, 243, 0.10);
}

/* clickable main area */
.orow-main {
  display: flex;
  align-items: stretch;
  cursor: pointer;
  padding: 0;
  width: 100%;
}

/* thin status stripe on the right (RTL start) */
.orow-stripe {
  width: 3px;
  flex-shrink: 0;
  border-radius: 0 4px 4px 0;
}
.orow-stripe-pending { background: #f59e0b; }
.orow-stripe-withdrawal { background: #8b5cf6; }
.orow-stripe-completed { background: #10b981; }
.orow-stripe-rejected { background: #ef4444; }

/* grid layout — 6 columns spanning the full width */
.orow-grid {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(100px, 1.5fr) minmax(80px, 1.5fr) minmax(80px, 1fr) minmax(70px, 0.8fr) minmax(80px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
}

.orow-cell {
  min-width: 0;
}

.orow-ref {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orow-customer {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.orow-amount {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
}

.orow-amount small {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 12px;
}

.orow-date {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: embed;
}

.orow-cell-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}

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

.orow-chevron {
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.3;
  transition: transform 0.25s ease;
  margin-inline-start: 4px;
}

.orders-tbl-lock {
  color: var(--text-secondary);
  opacity: 0.25;
  font-size: 12px;
}

/* detail panel */
.orow-detail {
  border-top: 1px solid var(--border-color);
}

.order-detail-panel {
  padding: 20px 24px 24px;
}

/* loading spinner at bottom of list */
.orders-loader {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

.orders-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--border-color);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: orderspin 0.7s linear infinite;
}

@keyframes orderspin {
  to { transform: rotate(360deg); }
}

.order-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px 16px;
}

.order-detail-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 0;
}

.order-detail-item .odl {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.order-detail-item .odl i {
  font-size: 10px;
  opacity: 0.4;
}

.order-detail-item .odv {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 600;
}

/* plate row */
.order-plate-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0 0;
  margin-top: 4px;
  border-top: 1px solid var(--border-color);
}

.order-plate-row .odl {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.order-plate-row .odl i {
  font-size: 10px;
  opacity: 0.4;
}

.order-plate-value {
  flex-shrink: 0;
}

.order-wash-photo-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.order-wash-photo-section > .odl {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 10px;
}

.order-wash-photo-section > .odl i {
  font-size: 10px;
  opacity: 0.4;
}

.order-wash-photo-thumb {
  position: relative;
  display: inline-block;
  border-radius: 14px;
  overflow: hidden;
  cursor: zoom-in;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
              box-shadow 0.22s ease,
              border-color 0.22s ease;
}

.order-wash-photo-thumb:hover {
  transform: translateY(-2px) scale(1.015);
  border-color: var(--accent-color);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.order-wash-photo-thumb img {
  display: block;
  width: 200px;
  height: 140px;
  object-fit: cover;
  /* Soft fade-in once the bytes land so a slow-loading proof
   * doesn't flash from blank to image abruptly. */
  animation: washPhotoFadeIn 0.35s ease both;
}

@keyframes washPhotoFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Always-visible "tap to enlarge" badge pinned to the bottom-right.
 * The old hover-only overlay was invisible on touch devices, so
 * tablet/iPad owners never realised the thumbnail was tappable. */
.order-wash-photo-overlay {
  position: absolute;
  bottom: 8px;
  inset-inline-end: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 13px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.2s ease, transform 0.2s ease;
}

.order-wash-photo-thumb:hover .order-wash-photo-overlay {
  background: var(--accent-color);
  transform: scale(1.08);
}

/* Zoom lightbox — full-screen blurred backdrop + framed image. */
.wash-photo-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: washPhotoFadeIn 0.22s ease;
}

.wash-photo-zoom-img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 18px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  object-fit: contain;
  /* Subtle pop-in so the lightbox doesn't snap. */
  animation: washPhotoPopIn 0.28s cubic-bezier(0.2, 0.9, 0.2, 1.1) both;
  cursor: default;
}

@keyframes washPhotoPopIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.wash-photo-zoom-close {
  position: absolute;
  top: 24px;
  inset-inline-start: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 1;
}

.wash-photo-zoom-close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
}

/* tablet */
@media (max-width: 768px) {
  .orow-grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    padding: 14px 16px;
  }
  .orow-cell-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .orow-ref { font-size: 13px; }
  .orow-customer { font-size: 13px; }
  .orow-amount { font-size: 15px; }

  .order-detail-grid {
    grid-template-columns: 1fr 1fr;
  }
  .order-detail-panel {
    padding: 16px;
  }
  .order-plate-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* phone */
@media (max-width: 480px) {
  .orow-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 12px 14px;
  }
  .orow-ref { font-size: 12px; }
  .orow-customer { font-size: 12px; }
  .orow-amount { font-size: 14px; }

  .order-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Release / Reassign modal ─────────────────────────────────────
   Owner-only modal triggered from the per-row "user-pen" action.
   Lets the owner either release the order back to the unclaimed
   pool or hand it to a different worker at the laundry. The radio
   list is keyboard-navigable, the release option sits at the top
   so it's the default highlight. */
.reassign-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.18s ease;
}

.reassign-modal {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  width: 100%;
  max-width: 460px;
  max-height: 86vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.reassign-modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.reassign-modal-title {
  font-family: 'Tajawal', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.reassign-modal-subtitle {
  font-family: 'Tajawal', sans-serif;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.reassign-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.reassign-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.reassign-modal-body {
  padding: 18px 22px;
  overflow-y: auto;
}

.reassign-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reassign-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.reassign-option:has(input:checked) {
  border-color: var(--accent-color, #13b5f3);
  background: rgba(19, 181, 243, 0.06);
}
.reassign-option input[type="radio"] {
  accent-color: var(--accent-color, #13b5f3);
}

.reassign-option-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(19, 181, 243, 0.12);
  color: var(--accent-color, #13b5f3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.reassign-option-release .reassign-option-icon {
  background: rgba(99, 102, 241, 0.14);
  color: #6366f1;
}

.reassign-option-text {
  flex: 1;
  min-width: 0;
}

.reassign-option-title {
  font-family: 'Tajawal', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.reassign-option-subtitle {
  font-family: 'Tajawal', sans-serif;
  font-size: 12px;
  color: var(--text-secondary);
}

.reassign-empty {
  padding: 16px 12px;
  text-align: center;
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  border: 1px dashed var(--border-color);
}

.reassign-loading,
.reassign-error {
  padding: 24px 12px;
  text-align: center;
  font-family: 'Tajawal', sans-serif;
  font-size: 13.5px;
  color: var(--text-secondary);
}

.reassign-modal-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.reassign-modal-actions .btn-primary,
.reassign-modal-actions .btn-secondary {
  padding: 9px 18px;
  border-radius: 10px;
  font-family: 'Tajawal', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  transition: background 0.15s ease, opacity 0.15s ease;
}
.reassign-modal-actions .btn-primary {
  background: var(--accent-color, #13b5f3);
  color: #fff;
  border-color: var(--accent-color, #13b5f3);
}
.reassign-modal-actions .btn-primary:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* Row action button — same shape family as the other admin
   action buttons, distinct hue so owners can spot it quickly. */
.btn-reassign {
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.32);
}
.btn-reassign:hover {
  background: rgba(99, 102, 241, 0.20);
}

/* ============================================================
   Same-plate-today hint
   ------------------------------------------------------------
   Surfaces when CompanyOrderSerializer.same_plate_today is true —
   another order at this same company on the same appointment_date
   is bound to a car with the same plate. Two users (e.g. son +
   father) sharing a vehicle is allowed by design; this is just an
   operator-confirm cue, not a block.
     * `.orow-same-plate`    — compact amber pill beside the
                               customer name in the collapsed row,
                               drawn at-a-glance.
     * `.order-plate-warn`   — full-width amber strip below the
                               plate row in the expanded detail
                               panel, so the worker confirming on
                               arrival can't miss it.
   ============================================================ */
.orow-same-plate {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  margin-block-start: 4px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.32);
  color: #f59e0b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: help;
}
.orow-same-plate i {
  font-size: 10px;
}

.order-plate-warn {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-block-start: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.30);
  color: #fbbf24;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
}
.order-plate-warn i {
  flex: 0 0 auto;
  font-size: 14px;
}

@media (max-width: 640px) {
  .orow-same-plate {
    font-size: 10.5px;
    padding: 2px 8px;
  }
  .order-plate-warn {
    font-size: 12px;
    padding: 8px 10px;
  }
}

/* ═══════════════════════════════════════════
   ORDER STATUS MODAL — optional completion extras
   (owner-side wash-proof photo + notes; the worker
   uploads via the same /complete/ endpoint)
   ═══════════════════════════════════════════ */
.osm-complete-extras {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.osm-photo-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.osm-photo-label i {
  color: var(--accent-color);
}
.osm-photo-label input[type="file"] {
  flex: 1 1 100%;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.osm-photo-label input[type="file"]::file-selector-button {
  background: var(--bg-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-main);
  cursor: pointer;
  margin-inline-end: 10px;
}
.osm-notes {
  width: 100%;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 13px;
  resize: vertical;
}
.osm-notes:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(19, 181, 243, 0.12);
}
.osm-no-transitions {
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  padding: 8px 0;
}
