/* 0. VERY SMALL RESET */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  font-family: var(--body-font-family);
  line-height: 1.45;
  color: var(--color-body);
  background: #f6f8f8;
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

strong,
.strong {
  font-weight: 600;
  color: var(--color-heading);
}

.dashboard-overview-stat {
  font-size: 1.75rem;
  line-height: 1.75rem;
}

.overview-list-item-stats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 1. LAYOUT HELPERS */
.container {
  width: 100%;
  padding: 1rem 0.5rem;
  margin-inline: auto;
  max-width: 64rem;
}
.card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  padding: 1.25rem;
}

/* 2. RE‑USABLE COMPONENT CLASSES */
.space-x {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* table styles */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 0.75rem;
  overflow: hidden;
  font-size: 0.98rem;
}
thead th {
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 0.85rem;
  background: #f0f7f4;
  color: #252525;
  letter-spacing: 0.01em;
  border-bottom: 1px solid #ddd;
}
tbody td {
  padding: 0.65rem 0.85rem;
  border-top: 1px solid #e5e5e5;
  vertical-align: middle;
}
tbody tr:hover {
  background: #f3fdf8;
  transition: background 0.15s;
}

td[data-flag="true"] {
  color: #c62828;
  font-weight: 600;
}

/* 4. DASHBOARD & DISCOUNT CODES SECTION */
.inner-card {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1rem 1rem;
  border: 1px solid var(--border-color);
  max-width: 100%;
  display: flex;
  flex-direction: column;
}
.inner-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--color-heading);
  line-height: normal;
}

.inner-card .flex {
  flex: 1;
}

/* 6. HEADER & SECTION SPACING */
h1,
h2,
h3 {
  letter-spacing: 0.01em;
  margin: 0;
}
h2 {
  font-size: 2rem;
  color: var(--color-heading);
  line-height: normal;
}
h3 {
  font-size: 0.875rem;
  color: var(--primary-color);
}
p {
  margin: 0;
}
main.container {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

/* Ensure content doesn't get hidden behind job status banner */
body:has(.job-status-banner.show) main.container {
  margin-top: 80px;
  transition: margin-top 0.3s ease-in-out;
}

.process-orders-controls {
  display: flex;
  flex-direction: column;
}

@media (min-width: 641px) {
  .btn {
    width: auto;
    justify-content: flex-start;
  }
  .space-x {
    flex-direction: row;
    gap: 1rem;
  }
  .container {
    padding: 2rem 1rem;
  }
  .card {
    padding: 1.75rem;
  }
  .inner-card {
    max-width: 32rem;
    padding: 1.25rem 1.5rem;
  }
  .orders-table {
    margin-bottom: 2rem;
  }
  main.container {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }
}

.input-label {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.input-number {
  width: 80px;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 0.4rem;
  font-size: 1rem;
}

.dashboard-overview-list {
  display: flex;
  list-style: none;
  gap: 1rem;
  padding: 0;
  margin: 0;
}

.dashboard-overview-list li {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  gap: 1rem;
}

.overview-list-item {
  display: flex;
  flex: 1;
}

.overview-list-item-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0 1rem;
}

.pre-text {
  color: var(--primary-color);
  margin: 0;
  font-size: 1rem;
  line-height: normal;
}

.dashboard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.inner-card__list {
  padding: 0;
  margin: 1rem 0 0;
  list-style: none;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.inner-card__list li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.tag {
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
  list-style: none;
  font-size: 0.75rem;
  width: fit-content;
}

.tag.neutral {
  background-color: var(--tag-color-neutral);
}

.tag.neutral-blue {
  background-color: var(--tag-color-neutral-blue);
}

.tag.low-risk {
  background-color: var(--tag-color-low-risk);
  color: var(--tag-color-low-risk-text);
}

.tag.high-risk {
  background-color: var(--tag-color-high-risk);
  color: var(--tag-color-high-risk-text);
}

.order-row .tag {
  text-align: center;
}

/* Adjust flatpickr calendar position */
.flatpickr-calendar {
  margin-top: 1rem;
}

.button {
  font-family: var(--body-font-family);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 1rem 2rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  text-decoration: none;
  border: none;
  border-radius: 5px;
}
.button.button-secondary {
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  border-radius: 4px;
}
.button-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.button:disabled,
.button.button-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  background: var(--border-color);
  color: var(--text);
  border-color: var(--border-color);
  transform: none;
  box-shadow: none;
}

.button:has(svg),
.button:disabled:has(svg) {
  background: transparent;
}

.button:disabled svg path {
  fill: var(--border-color);
}

.button-secondary:disabled,
.button-secondary.button-disabled {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
}

.inner-card .button {
  width: 100%;
  font-weight: 600;
  margin-top: 1rem;
}

.no-orders-message {
  text-align: center;
}

.orders-scanned-percentage {
  width: 100%;
  height: 10px;
  -webkit-appearance: none;
  appearance: none;
}

.orders-scanned-percentage::-webkit-progress-bar {
  background-color: #f1f1f1;
  border-radius: 4px;
}

.orders-scanned-percentage::-webkit-progress-value {
  background-color: var(--progress-color, #4caf50);
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.orders-scanned-percentage::-moz-progress-bar {
  background-color: var(--progress-color, #4caf50);
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

.date-picker-container {
  display: flex;
  align-items: center;
}

.date-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  font-size: 14px;
}

.date-display:hover {
  background-color: #f0f0f0;
}

.date-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  z-index: -1;
}

.date-picker-container {
  display: flex;
  align-items: center;
}

.date-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}
.date-display:hover {
  background-color: #f0f0f0;
}

/* hide the real text input; flatpickr injects its own clone */
.date-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  z-index: -1;
}

/* Modal styles using dialog element */
.modal-dialog {
  padding: 0;
  border: none;
  border-radius: 8px;
  width: 80%;
  max-width: 600px;
  margin: auto;
}

/* Style for the backdrop */
.modal-dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
  background-color: var(--surface, #fff);
  padding: 1rem;
  border-radius: 8px;
  /* border: 1px solid var(--border-color); */
  /* margin: 1rem; */
  max-width: 100%;
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.modal-header svg {
  min-width: 4rem;
  min-height: 4rem;
}

.modal-header h3 {
  margin: 0;
  color: var(--black, #000);
}

.modal-body {
  padding: 20px;
}

.close-modal {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
}

.close-modal:hover,
.close-modal:focus {
  color: var(--text, #000);
  text-decoration: none;
  cursor: pointer;
}

/* Order details modal specific styles */
.order-summary {
  margin-bottom: 1.5rem;
}

#order-details-content h3 {
  font-size: 1.25rem;
}

/* .order-summary h4 {
  margin: 0 0 0.5rem 0;
  color: var(--primary-color, #00795b);
  font-size: 1.2rem;
} */

.detection-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.detection-item:last-child {
  border-bottom: none;
}

.take-action {
  margin-bottom: 1.5rem;
}

.take-action h4 {
  margin: 0 0 0.5rem 0;
  color: var(--black, #000);
  font-size: 1.1rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid #e0e0e0;
}

.button-primary {
  background-color: var(--primary-color, #00795b);
  color: white;
  border: 1px solid var(--primary-color, #00795b);
}

.button-primary:hover {
  background-color: #005a42;
  border-color: #005a42;
}

.button-danger {
  background-color: #d32f2f;
  color: white;
  border: 1px solid #d32f2f;
}

.button-danger:hover {
  background-color: #b71c1c;
  border-color: #b71c1c;
}

/* Scan orders modal specific styles */
.scan-orders-modal .modal-body {
  padding: 1.5rem;
}

.scan-description {
  margin-bottom: 1.5rem;
}

.scan-description p {
  color: #666;
  line-height: 1.5;
  margin: 0;
}

.process-orders-controls {
  flex-wrap: wrap;
}

.job-status-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 10px;
}

.progress-container {
  width: 100%;
  background-color: #f1f1f1;
  border-radius: 4px;
  margin: 10px 0;
  overflow: hidden;
}

.progress-bar {
  height: 10px;
  background-color: #4caf50;
  width: 0%;
  transition: width 0.3s ease;
}

#modal-process-status {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: #666;
  text-align: center;
}

.button.view-details-btn {
  color: var(--color-body);
  background: transparent;
  border: 1px solid var(--color-body);
  padding: 0.5rem 0.8rem;
}

@media (max-width: 640px) {
  .modal-dialog {
    width: 95%;
    max-width: none;
  }

  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .button {
    width: 100%;
  }

  .file-upload-area {
    padding: 1.5rem 1rem;
  }

  .upload-modal .modal-body {
    padding: 1rem;
  }
}

/* Slider styles for scan orders modal */
.slider-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.slider-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: #666;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.slider-current {
  font-weight: 600;
  color: var(--primary-color, #00795b);
}

.order-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
  opacity: 0.7;
  transition: opacity 0.2s;
  cursor: pointer;
}

.order-slider:hover {
  opacity: 1;
}

.order-slider::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color, #00795b);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.order-slider::-webkit-slider-thumb:hover {
  background: #005a42;
  transform: scale(1.1);
}

.order-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color, #00795b);
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s;
}

.order-slider::-moz-range-thumb:hover {
  background: #005a42;
  transform: scale(1.1);
}

.order-slider::-moz-range-track {
  width: 100%;
  height: 6px;
  cursor: pointer;
  background: #ddd;
  border-radius: 3px;
  border: none;
}

/* Summary boxes for additional orders and cost */
.order-summary-boxes {
  display: flex;
  gap: 1rem;
  margin: 1rem 0;
  width: 100%;
}

.summary-box {
  flex: 1;
  background: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem;
  text-align: center;
  min-width: 0;
}

.summary-label {
  font-size: 0.875rem;
  color: #666;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color, #00795b);
  line-height: 1.2;
}

@media (max-width: 640px) {
  .slider-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .slider-info span {
    font-size: 0.8rem;
  }

  .order-summary-boxes {
    flex-direction: column;
    gap: 0.5rem;
  }

  .summary-box {
    padding: 0.5rem;
  }

  .summary-label {
    font-size: 0.8rem;
  }

  .summary-value {
    font-size: 1.1rem;
  }
}

/* Job Status Banner Styles */
.job-status-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #00795b 0%, #00a76f 100%);
  color: white;
  transform: translateY(-100%);
  transition: transform 0.3s ease-in-out;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.job-status-banner.show {
  transform: translateY(0);
}

.job-status-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  gap: 1rem;
}

.job-status-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.job-status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.job-status-icon .spinner {
  color: white;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.job-status-text {
  min-width: 0;
  flex: 1;
}

.job-status-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  line-height: 1.2;
}

.job-status-description {
  font-size: 0.875rem;
  opacity: 0.9;
  margin: 0;
  line-height: 1.2;
  margin-top: 0.125rem;
}

.job-status-progress {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  min-width: 200px;
  flex-shrink: 0;
}

.progress-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  white-space: nowrap;
}

.job-eta {
  opacity: 0.8;
  font-size: 0.8rem;
}

.progress-bar-container {
  width: 200px;
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: white;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.job-status-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.job-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.job-action-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.job-action-btn:active {
  transform: translateY(0);
}

/* Status-specific styles */
.job-status-banner.status-pending {
  background: linear-gradient(135deg, #1976d2 0%, #42a5f5 100%);
}

.job-status-banner.status-processing {
  background: linear-gradient(135deg, #00795b 0%, #00a76f 100%);
}

.job-status-banner.status-completed {
  background: linear-gradient(135deg, #388e3c 0%, #66bb6a 100%);
}

.job-status-banner.status-failed {
  background: linear-gradient(135deg, #d32f2f 0%, #f44336 100%);
}

/* Responsive design */
@media (max-width: 768px) {
  .job-status-content {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .job-status-info {
    gap: 0.5rem;
  }

  .job-status-progress {
    align-items: stretch;
    min-width: auto;
  }

  .progress-info {
    justify-content: space-between;
    gap: 0.5rem;
  }

  .progress-bar-container {
    width: 100%;
  }

  .job-status-actions {
    justify-content: center;
  }

  .job-status-title {
    font-size: 0.9rem;
  }

  .job-status-description {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .job-status-content {
    padding: 0.5rem 0.75rem;
  }

  .job-status-info {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .job-status-icon {
    align-self: flex-start;
  }

  .progress-info {
    font-size: 0.8rem;
  }

  .job-eta {
    font-size: 0.75rem;
  }
}

.footer.container {
  padding-top: 0;
}

.footer {
  margin-inline: auto;
  max-width: 64rem;
}

.footer .card {
  flex-direction: column;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.footer__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem;
}

.footer__brand a {
  text-decoration: none;
  color: var(--primary-color);
}

.percentage-low {
  --progress-color: var(--tag-color-high-risk-text);
}

.percentage-medium {
  --progress-color: #ba9012;
}

.percentage-high {
  --progress-color: var(--tag-color-low-risk-text);
}

.order-match-list {
  list-style-type: none;
  padding: 0;
  display: flex;
  gap: 0.25rem;
  margin: 1rem 0;
}

details,
details summary {
  padding-left: 0;
  background-image: none;
  -webkit-appearance: none;
}

details summary::-webkit-details-marker {
  display: none;
}

.fraud-detection summary {
  cursor: pointer;
  list-style: none;
}

.fraud-detection {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}
