/* ==========================================================================
   ASP Cares Specialty Pharmacy - Delivery Tracking
   Authentic Corporate Design System Matched to https://www.aspcares.com/
   Typography: Gotham / Montserrat Light (300 weight, tracked uppercase)
   Brand Colors: #1C62AF (ASP Blue), #EE2932 (ASP Red), #0C437A (Deep Navy)
   ========================================================================== */

:root {
  /* Official ASP Cares Brand Colors */
  --asp-blue: #1c62af;
  --asp-blue-dark: #0c437a;
  --asp-blue-hover: #154e8e;
  --asp-red: #ee2932;
  --asp-red-hover: #d11d26;
  
  /* Neutral Palette */
  --text-dark: #222222;
  --text-body: #444444;
  --text-muted: #666666;
  --text-light: #888888;
  
  --bg-page: #ffffff;
  --bg-subtle: #f6f6f6;
  --border-light: #e5e7eb;
  --border-table: #e0e0e0;
  
  /* Status Colors */
  --status-green: #1b873f;
  --status-green-bg: #eaf7ed;
  --status-green-border: #bbf7d0;
  
  /* Typography */
  --font-primary: 'Montserrat', 'Gotham', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: pan-y;
  overscroll-behavior-x: none;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  touch-action: pan-y;
  overscroll-behavior-x: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-page);
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Prevent accidental iOS drag preview / callouts */
img, svg, a {
  -webkit-user-drag: none;
}

button, .dtr-control, .badge-status, .b2b-logo-brand {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ==========================================================================
   1. Main Header: B2B Services Single Unified Corporate Logo
   ========================================================================== */
.main-header {
  background: #ffffff;
  padding: 1.15rem 0;
  border-bottom: 1px solid #e8e8e8;
  position: relative;
  z-index: 100;
  width: 100%;
}

.header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.b2b-logo-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.b2b-logo-brand:hover {
  opacity: 0.92;
  transform: translateY(-0.5px);
}

.b2b-logo-icon {
  display: block;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 9px;
  box-shadow: 0 3px 10px rgba(28, 98, 175, 0.2);
}

.b2b-logo-typography {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-family: var(--font-primary);
  line-height: 1;
}

.b2b-word-b2b {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--asp-blue);
  letter-spacing: 0.04em;
}

.b2b-word-services {
  font-size: 1.25rem;
  font-weight: 400;
  color: #1e293b;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ==========================================================================
   2. Page Title Section (Light uppercase typography)
   ========================================================================== */
.page-title-section {
  text-align: center;
  padding: 2.5rem 1.5rem 1.5rem;
  max-width: 920px;
  margin: 0 auto;
  width: 100%;
}

.page-main-title {
  font-size: 2.75rem;
  font-weight: 300; /* Ultra-light elegant typography from aspcares.com */
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #222222;
  line-height: 1.2;
  margin: 0;
}

/* ==========================================================================
   4. Search Bar Section (Instant live search, prominent & responsive)
   ========================================================================== */
.search-container-wrap {
  max-width: 980px;
  margin: 0 auto 2.25rem;
  padding: 0 1.5rem;
  width: 100%;
}

.search-box-card {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 0.55rem 0.85rem 0.55rem 1.15rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box-card:focus-within {
  border-color: var(--asp-blue);
  box-shadow: 0 0 0 3px rgba(28, 98, 175, 0.1), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.search-input-group {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0.75rem;
  min-width: 0;
}

.search-icon-wrap {
  color: #666666;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.search-input-field {
  border: none;
  outline: none;
  flex: 1;
  min-width: 0;
  font-family: var(--font-primary);
  font-size: 16px; /* Exactly 16px prevents iOS Safari from auto-zooming and causing page-drag */
  color: var(--text-dark);
  padding: 0.45rem 0.25rem;
}

.search-input-field::placeholder {
  color: #888888;
  font-weight: 400;
}

.btn-clear-input {
  background: none;
  border: none;
  color: #999999;
  font-size: 1.35rem;
  line-height: 1;
  padding: 0 0.5rem;
  cursor: pointer;
  display: none;
  flex-shrink: 0;
}

.btn-clear-input:hover {
  color: var(--asp-red);
}

/* ==========================================================================
   5. Table Manifest Section (Responsive container)
   ========================================================================== */
.table-main-wrapper {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  width: 100%;
}

.table-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 1.5rem 1.5rem 2rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  width: 100%;
}

.manifest-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
}

.manifest-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--asp-blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.manifest-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.table-responsive-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}

/* ==========================================================================
   6. DataTables Corporate Medical Styling
   ========================================================================== */
table.dataTable {
  width: 100% !important;
  border-collapse: collapse !important;
  table-layout: auto !important;
  margin-top: 0.5rem !important;
  margin-bottom: 1.25rem !important;
}

table.dataTable thead th {
  background-color: #f9fafb !important;
  color: #374151 !important;
  font-size: 0.74rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
  padding: 0.85rem 0.75rem !important;
  border-bottom: 2px solid var(--asp-blue) !important;
  border-top: 1px solid #e5e7eb !important;
  vertical-align: middle !important;
}

table.dataTable tbody td {
  padding: 0.95rem 0.75rem !important;
  font-size: 0.86rem !important;
  color: #333333 !important;
  border-bottom: 1px solid #f0f0f0 !important;
  vertical-align: middle !important;
  box-sizing: border-box !important;
}

table.dataTable tbody tr:hover {
  background-color: #f9fafb !important;
}

/* Column Specific Rules */
.col-track-id {
  white-space: nowrap !important;
}

.track-id-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.track-id-text {
  font-weight: 700;
  color: var(--asp-blue);
  letter-spacing: 0.02em;
  font-size: 0.88rem;
}

.btn-copy-id {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 0.2rem;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s;
}

.btn-copy-id:hover {
  color: var(--asp-blue);
}

.col-patient {
  white-space: normal !important;
  min-width: 140px;
}

.patient-name {
  font-weight: 700;
  color: #1f2937;
  font-size: 0.88rem;
}

.patient-sub {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.15rem;
}

.mobile-status-inline {
  display: none;
  margin-top: 0.35rem;
}

.col-destination {
  min-width: 200px;
  max-width: 320px;
  white-space: normal !important;
}

.address-text {
  white-space: normal !important;
  word-break: normal;
  overflow-wrap: break-word;
  line-height: 1.45;
  color: #4b5563;
  font-size: 0.85rem;
  padding-right: 0.5rem;
}

.col-delivered {
  white-space: nowrap !important;
}

.delivered-cell {
  white-space: nowrap !important;
  font-size: 0.85rem;
  font-weight: 500;
  color: #374151;
}

.col-status {
  white-space: nowrap !important;
  text-align: center !important;
}

.status-badge-delivered {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 3px;
  background-color: var(--status-green-bg);
  color: var(--status-green);
  border: 1px solid var(--status-green-border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.col-pod {
  white-space: normal !important;
}

.pod-name {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.85rem;
}

.pod-note {
  font-size: 0.75rem;
  color: #6b7280;
  font-style: italic;
  margin-top: 0.15rem;
}

.title-short {
  display: none;
}

.col-action {
  white-space: nowrap !important;
  text-align: center !important;
}

.btn-details-link {
  background: #ffffff;
  color: var(--asp-blue);
  border: 1px solid var(--asp-blue);
  border-radius: 3px;
  padding: 0.35rem 0.75rem;
  font-family: var(--font-primary);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-details-link:hover {
  background-color: var(--asp-blue);
  color: #ffffff;
}

/* DataTables Responsive Child Row Accordion Details */
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
  position: relative !important;
  padding-left: 32px !important;
  cursor: pointer;
}

table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
  top: 50% !important;
  left: 8px !important;
  height: 16px !important;
  width: 16px !important;
  margin-top: -9px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1.5px solid var(--asp-blue) !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  text-align: center !important;
  font-family: inherit !important;
  line-height: 1 !important;
  content: '+' !important;
  background-color: #ffffff !important;
  color: var(--asp-blue) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  transform: none !important;
}

table.dataTable.dtr-inline.collapsed > tbody > tr.parent > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr.parent > th.dtr-control:before {
  content: '−' !important;
  background-color: var(--asp-blue) !important;
  color: #ffffff !important;
}

table.dataTable > tbody > tr.child {
  background-color: #f9fafb !important;
}

table.dataTable > tbody > tr.child ul.dtr-details {
  width: 100% !important;
  padding: 0.65rem 0.5rem !important;
  display: block !important;
  list-style: none !important;
}

table.dataTable > tbody > tr.child ul.dtr-details > li {
  border-bottom: 1px solid #e5e7eb !important;
  padding: 0.65rem 0.25rem !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 0.25rem !important;
}

table.dataTable > tbody > tr.child ul.dtr-details > li:last-child {
  border-bottom: none !important;
}

table.dataTable > tbody > tr.child span.dtr-title {
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  color: var(--asp-blue-dark) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  display: block !important;
}

table.dataTable > tbody > tr.child span.dtr-data {
  font-size: 0.85rem !important;
  color: #222222 !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: break-word !important;
  line-height: 1.45 !important;
}

/* DataTables Controls & Pagination */
.dataTables_wrapper .dataTables_length {
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid #d1d5db;
  border-radius: 3px;
  padding: 0.35rem 0.65rem;
  font-family: inherit;
  color: #333333;
  background: white;
  margin: 0 0.35rem;
  outline: none;
}

.dataTables_wrapper .dataTables_info {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding-top: 1rem !important;
}

.dataTables_wrapper .dataTables_paginate {
  margin-top: 1rem !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 3px !important;
  padding: 0.35rem 0.75rem !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  border: 1px solid transparent !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--asp-blue) !important;
  color: #ffffff !important;
  border-color: var(--asp-blue) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current):not(.disabled) {
  background: #f3f4f6 !important;
  color: var(--text-dark) !important;
  border-color: #d1d5db !important;
}

/* ==========================================================================
   7. Details Modal (Clinical Verification Dialog)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: #ffffff;
  border-radius: 4px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border-top: 4px solid var(--asp-blue);
}

.modal-header {
  padding: 1.15rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.modal-title-wrap h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--asp-blue-dark);
  letter-spacing: 0.02em;
}

.btn-modal-close {
  background: none;
  border: none;
  color: #999999;
  cursor: pointer;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0 0.4rem;
  transition: color 0.15s;
}

.btn-modal-close:hover {
  color: var(--asp-red);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-section-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--asp-blue-dark);
  margin-bottom: 0.65rem;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 0.35rem;
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.detail-item {
  margin-bottom: 0.45rem;
}

.detail-item .label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-item .val {
  font-size: 0.9rem;
  color: #1f2937;
  font-weight: 600;
  margin-top: 0.15rem;
}

.detail-item .sub-val {
  font-size: 0.8rem;
  color: #666666;
  margin-top: 0.15rem;
  line-height: 1.4;
}

.pod-highlight-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  padding: 1rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.btn-modal-action {
  padding: 0.6rem 1.5rem;
  border-radius: 3px;
  font-family: var(--font-primary);
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-modal-action.primary {
  background: var(--asp-blue);
  border: none;
  color: #ffffff;
}

.btn-modal-action.primary:hover {
  background: var(--asp-blue-hover);
}



/* ==========================================================================
   9. Comprehensive Responsive Media Queries
   ========================================================================== */
@media (max-width: 850px) {
  .page-main-title {
    font-size: 2.2rem;
    letter-spacing: 0.08em;
  }
}

@media (max-width: 768px) {
  .table-main-wrapper {
    padding: 0 0.75rem 3rem;
  }
  .table-panel {
    padding: 1rem 0.75rem 1.5rem;
  }
  .manifest-heading-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
  .manifest-title {
    font-size: 1.05rem;
    line-height: 1.3;
  }
  .manifest-subtitle {
    font-size: 0.78rem;
  }
  .modal-grid-2 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

@media (max-width: 640px) {
  .header-container {
    justify-content: center;
    padding: 0 1rem;
  }
  .b2b-logo-brand {
    gap: 0.65rem;
  }
  .b2b-logo-icon {
    width: 32px;
    height: 32px;
  }
  .b2b-word-b2b {
    font-size: 1.2rem;
  }
  .b2b-word-services {
    font-size: 1.05rem;
    letter-spacing: 0.12em;
  }
  .page-title-section {
    padding: 1.75rem 1rem 1.25rem;
  }
  .page-main-title {
    font-size: 2rem;
    letter-spacing: 0.12em;
    line-height: 1.2;
  }
  .search-container-wrap {
    padding: 0 0.75rem;
    margin-bottom: 1.5rem;
  }
  .search-box-card {
    padding: 0.5rem 0.65rem 0.5rem 0.85rem;
  }
  .search-input-group {
    width: 100%;
  }
  
  /* Mobile Title Variants & Table Sizing */
  .title-full {
    display: none !important;
  }
  .title-short {
    display: inline !important;
  }
  
  .table-main-wrapper {
    padding: 0 0.35rem 2.5rem !important;
  }
  .table-panel {
    padding: 0.85rem 0.35rem 1.25rem !important;
  }
  
  .mobile-status-inline {
    display: inline-block;
  }
  table.dataTable thead th {
    padding: 0.65rem 0.25rem !important;
    font-size: 0.7rem !important;
  }
  table.dataTable tbody td {
    padding: 0.7rem 0.25rem !important;
    font-size: 0.78rem !important;
  }
  table.dataTable thead th.col-track-id,
  table.dataTable tbody td.col-track-id {
    padding-left: 22px !important;
    padding-right: 3px !important;
    width: 82px !important;
    max-width: 82px !important;
  }
  table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control,
  table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control {
    padding-left: 20px !important;
  }
  table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
  table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
    left: 3px !important;
    height: 13px !important;
    width: 13px !important;
    margin-top: -7px !important;
    font-size: 10px !important;
  }
  .track-id-text {
    font-size: 0.8rem;
  }
  .btn-copy-id {
    display: none !important;
  }
  .col-patient {
    min-width: 0 !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
  .patient-name {
    font-size: 0.82rem;
  }
  .patient-sub {
    font-size: 0.72rem;
  }
  table.dataTable thead th.col-action,
  table.dataTable tbody td.col-action {
    padding-left: 3px !important;
    padding-right: 3px !important;
    width: 62px !important;
    max-width: 62px !important;
  }
  .btn-details-link {
    padding: 0.28rem 0.45rem !important;
    font-size: 0.7rem !important;
  }
  
  .dataTables_wrapper .dataTables_length select {
    font-size: 16px !important;
  }

  .table-responsive-wrapper {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Modal on Mobile */
  .modal-overlay {
    padding: 0.5rem;
  }
  .modal-container {
    max-height: 95vh;
  }
  .modal-header {
    padding: 0.85rem 1rem;
  }
  .modal-body {
    padding: 1rem;
    gap: 1rem;
  }
  .modal-footer {
    padding: 0.75rem 1rem;
  }
}
