/* Every rule below is prefixed with the ".odm-overlay" ancestor and every
   margin/padding value carries !important. This modal is mounted inside
   CustomerDetailPanel, which itself lives inside the dispatch page's
   "#customer-panel-wrap * { margin: revert; padding: revert; }" and
   ".dispatch-container * { margin: 0; padding: 0; }" resets. The first uses
   an ID selector no class selector can out-rank on specificity, so
   !important is the only reliable way to keep this component's own spacing
   (see the identical pattern in CustomerDetailPanel.css). `gap` is untouched
   by either reset and doesn't need it. */

.odm-overlay {
  position: fixed;
  inset: 0;
  /* Above the dispatch page's header (2000) and sidebar-collapse tab (1200),
     so the modal always sits on top of the whole app, not just the panel. */
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px !important;
}

.odm-overlay .odm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: odmFadeIn 0.25s ease-out;
}

.odm-overlay .odm-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 82vh;
  background: #ffffff;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 30px 60px -15px rgba(15, 23, 42, 0.35), 0 0 0 1px rgba(0,0,0,0.02);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: odmSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
  font-family: 'Public Sans', -apple-system, sans-serif;
}

.odm-overlay .odm-header {
  padding: 18px 20px 15px !important;
  background: #662582;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
/* Subtle ambient glow, matching the primary-color treatment used elsewhere
   in the app (login hero, header profile menu). */
.odm-overlay .odm-header::before {
  content: '';
  position: absolute;
  top: -60%;
  right: -10%;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.odm-overlay .odm-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.odm-overlay .odm-title-area {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.odm-overlay .odm-eyebrow {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.65);
  position: relative;
}

.odm-overlay .odm-title {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
}

.odm-overlay .odm-date {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  position: relative;
}
.odm-overlay .odm-date svg {
  color: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}

.odm-overlay .odm-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  position: relative;
}
.odm-overlay .odm-close-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  transform: rotate(90deg);
}

.odm-overlay .odm-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.odm-overlay .odm-status-badge {
  padding: 3px 8px !important;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.odm-overlay .odm-status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.odm-overlay .odm-status-created { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.odm-overlay .odm-status-created::before { background: #3b82f6; }
.odm-overlay .odm-status-pending { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.odm-overlay .odm-status-pending::before { background: #f59e0b; }
.odm-overlay .odm-status-delivered { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.odm-overlay .odm-status-delivered::before { background: #22c55e; }
.odm-overlay .odm-status-cancelled { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.odm-overlay .odm-status-cancelled::before { background: #ef4444; }

.odm-overlay .odm-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px 20px !important;
}
.odm-overlay .odm-body::-webkit-scrollbar {
  width: 6px;
}
.odm-overlay .odm-body::-webkit-scrollbar-track {
  background: transparent;
}
.odm-overlay .odm-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.odm-overlay .odm-section-title {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #94a3b8;
  margin-bottom: 10px !important;
}

.odm-overlay .odm-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px !important;
}

.odm-overlay .odm-items-table th {
  text-align: left;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  padding: 0 0 8px 0 !important;
  border-bottom: 1px solid #e2e8f0;
}
.odm-overlay .odm-items-table th.text-right { text-align: right; }

.odm-overlay .odm-items-table td {
  padding: 10px 0 !important;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12.5px;
  color: #334155;
  vertical-align: middle;
}
.odm-overlay .odm-items-table tr:last-child td {
  border-bottom: none;
}
.odm-overlay .odm-items-table td.text-right { text-align: right; }

.odm-overlay .odm-item-name {
  font-weight: 700;
  color: #0f172a;
}
.odm-overlay .odm-item-qty {
  color: #64748b;
  font-size: 13px;
}

.odm-overlay .odm-totals-section {
  background: linear-gradient(135deg, #fafafa, #f8fafc);
  border: 1px solid #f1f5f9;
  border-radius: 14px;
  padding: 14px 16px !important;
  margin-bottom: 16px !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}

.odm-overlay .odm-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: #64748b;
  font-weight: 500;
}
.odm-overlay .odm-total-row.grand-total {
  margin-top: 6px !important;
  padding-top: 10px !important;
  border-top: 1px dashed #cbd5e1;
  font-size: 16px;
  font-weight: 800;
  color: #662582;
}

.odm-overlay .odm-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.odm-overlay .odm-info-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  min-width: 0;
}
.odm-overlay .odm-info-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(102, 37, 130, 0.08);
  border-color: rgba(102, 37, 130, 0.2);
}
.odm-overlay .odm-info-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(102, 37, 130, 0.07);
  color: #662582;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.odm-overlay .odm-info-label {
  font-size: 9.5px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.odm-overlay .odm-info-value {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  overflow-wrap: break-word;
}

.odm-overlay .odm-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 0 !important;
  color: #94a3b8;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
}
.odm-overlay .odm-loading svg {
  color: #662582;
}

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

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

@media (max-width: 640px) {
  .odm-overlay {
    padding: 12px !important;
  }
  .odm-overlay .odm-card {
    max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: 14px !important;
  }
}

