/**
 * WarehouseWrangler - Shipments Management Styles
 */

.app-main.shipments-page {
  max-width: 1520px;
}

.shipments-page {
  gap: 2rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.page-title {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.page-title .material-icons-outlined {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(0, 86, 179, 0.12);
  color: var(--color-primary);
  font-size: 28px;
}

.page-title-copy h2 {
  font-size: 1.75rem;
  font-weight: 600;
}

.page-title-copy p {
  margin-top: 0.25rem;
  color: var(--color-muted);
  max-width: 640px;
}

.page-header-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.surface-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
  padding: 1.75rem;
}

.metrics-panel {
  padding-bottom: 0.5rem;
}

.metrics-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metric-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-neutral);
  box-shadow: none;
  text-align: left;
}

.metric-card button,
button.metric-card {
  border: none;
  cursor: pointer;
}

button.metric-card {
  font: inherit;
  color: inherit;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

button.metric-card:is(:hover, :focus-visible) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: rgba(0, 86, 179, 0.3);
  outline: none;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: rgba(0, 86, 179, 0.1);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.metric-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--color-text);
}

.metric-subtext {
  font-size: 0.9rem;
  color: var(--color-muted);
}

.status-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.status-card:is(:focus-visible) {
  outline: 2px solid rgba(0, 86, 179, 0.4);
  outline-offset: 2px;
}

.status-card.is-active,
.status-card[aria-pressed="true"] {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-soft);
  background: rgba(0, 86, 179, 0.12);
}

.filters-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.filters-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.filters-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.filter-field select,
.filter-field input[type="date"] {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.filter-field select:focus,
.filter-field input[type="date"]:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
  outline: none;
}

.filters-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.table-card {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.loading-indicator {
  text-align: center;
  padding: 2.5rem;
  color: var(--color-muted);
  font-weight: 500;
}

.table-scroll {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: visible;
  background: var(--color-surface);
}

.table-scroll__viewport {
  max-height: 70vh;
  overflow: auto;
  border-radius: inherit;
}

.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--color-surface);
  box-shadow:
    0 1px 0 var(--color-border),
    0 6px 12px rgba(12, 28, 53, 0.08);
}

.table-sticky thead th:first-child {
  z-index: 3;
}

.shipments-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

.shipments-table thead {
  background: rgba(0, 86, 179, 0.08);
}

.shipments-table th,
.shipments-table td {
  padding: 0.95rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  font-size: 0.95rem;
}

.shipments-table th {
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.85rem;
}

.shipments-table tbody tr:nth-child(even) {
  background: rgba(0, 86, 179, 0.03);
}

.shipments-table tbody tr:hover {
  background: rgba(0, 86, 179, 0.06);
}

.shipments-table th:nth-child(1),
.shipments-table td:nth-child(1) {
  min-width: 220px;
}

.shipments-table th:nth-child(2),
.shipments-table td:nth-child(2) {
  min-width: 160px;
}

.shipments-table th:nth-child(3),
.shipments-table td:nth-child(3) {
  min-width: 160px;
}

.shipments-table th:nth-child(4),
.shipments-table td:nth-child(4),
.shipments-table th:nth-child(5),
.shipments-table td:nth-child(5),
.shipments-table th:nth-child(6),
.shipments-table td:nth-child(6) {
  min-width: 120px;
  text-align: center;
}

.shipments-table th:nth-child(7),
.shipments-table td:nth-child(7) {
  min-width: 180px;
}

.shipments-table th:nth-child(8),
.shipments-table td:nth-child(8) {
  min-width: 160px;
}

.shipments-table .numeric {
  text-align: center;
}

.shipments-table .actions-col {
  text-align: right;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-muted);
  text-align: center;
  padding: 2rem 1rem;
}

.empty-state .material-icons-outlined {
  font-size: 32px;
  color: rgba(0, 86, 179, 0.6);
}

.is-hidden {
  display: none !important;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.status-badge .material-icons-outlined {
  font-size: 18px;
}

.status-prepared {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

.status-sent {
  background: var(--status-success-bg);
  color: var(--status-success-text);
}

.status-recalled {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}

.location-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.location-incoming {
  background: var(--location-incoming-bg);
  color: var(--location-incoming-text);
}

.location-wml {
  background: var(--location-wml-bg);
  color: var(--location-wml-text);
}

.location-gmr {
  background: var(--location-gmr-bg);
  color: var(--location-gmr-text);
}

.action-buttons {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
}

.icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  display: inline-flex;
  position: relative;
  gap: 0;
}

.icon-button .material-icons-outlined {
  font-size: 22px;
}

.icon-button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, 4px);
  background: var(--color-text);
  color: var(--color-surface);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  white-space: nowrap;
}

.icon-button[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: var(--color-text) transparent transparent transparent;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.icon-button:focus-visible[data-tooltip]::after,
.icon-button:hover[data-tooltip]::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.icon-button:focus-visible[data-tooltip]::before,
.icon-button:hover[data-tooltip]::before {
  opacity: 1;
}

.btn-surface {
  background: rgba(0, 86, 179, 0.12);
  color: var(--color-primary);
  border: none;
}

.btn-surface:is(:hover, :focus-visible) {
  background: rgba(0, 86, 179, 0.2);
}

.btn-positive {
  background: rgba(40, 167, 69, 0.15);
  color: var(--color-success);
  border: none;
}

.btn-positive:is(:hover, :focus-visible) {
  background: rgba(40, 167, 69, 0.25);
}

.btn-danger {
  background: rgba(220, 53, 69, 0.18);
  color: var(--color-danger);
  border: none;
}

.btn-danger:is(:hover, :focus-visible) {
  background: rgba(220, 53, 69, 0.3);
}

.warning-box {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  background: rgba(220, 53, 69, 0.08);
  border: 1px solid rgba(220, 53, 69, 0.25);
  color: var(--color-danger);
}

.warning-box .material-icons-outlined {
  font-size: 24px;
  margin-top: 0.2rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 40, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  /* max-width: 640px; */
  box-shadow: 0 24px 48px rgba(12, 28, 53, 0.18);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-content.modal-wide {
  max-width: 90vw;
  /* max-width: min(90vw, 1200px); */
}

.modal-large {
  max-width: 90vw;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--color-border);
  gap: 1rem;
}

.modal-title-group {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-title-group .material-icons-outlined {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 86, 179, 0.12);
  color: var(--color-primary);
}

.modal-close {
  background: none;
  border: none;
  padding: 0.35rem;
  border-radius: 50%;
  cursor: pointer;
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close:is(:hover, :focus-visible) {
  background: rgba(0, 86, 179, 0.1);
  color: var(--color-primary);
}

.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.5rem 1.75rem;
  border-top: 1px solid var(--color-border);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: var(--color-text);
}

.form-group small {
  color: var(--color-muted);
}

.form-group input,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  font-family: inherit;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
  outline: none;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.shipment-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.step-number {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 86, 179, 0.08);
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.progress-step.active .step-number {
  background: rgba(0, 86, 179, 0.15);
  color: var(--color-primary);
}

.progress-step.completed .step-number {
  background: rgba(40, 167, 69, 0.18);
  color: var(--color-success);
}

.step-label {
  font-size: 0.85rem;
  color: var(--color-muted);
  font-weight: 600;
}

.progress-line {
  width: 80px;
  height: 2px;
  background: var(--color-border);
}

.progress-line.completed {
  background: rgba(40, 167, 69, 0.6);
}

.shipment-summary {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.shipment-summary h4 {
  font-size: 1rem;
  font-weight: 600;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.summary-item {
  background: rgba(0, 86, 179, 0.06);
  border: 1px solid rgba(0, 86, 179, 0.15);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-item .label {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-item .value {
  font-size: 1.4rem;
  font-weight: 600;
}

.carton-search-field {
  margin: 0.75rem 0 1.25rem;
}

.carton-search-field label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.carton-search-field__label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-muted);
}

.carton-search-field__input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font: inherit;
  background-color: var(--color-surface);
  color: var(--color-text);
  -webkit-text-fill-color: var(--color-text);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

input[type="search"].carton-search-field__input {
  color: var(--color-text);
  -webkit-text-fill-color: var(--color-text);
}

.carton-search-field__input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
  outline: none;
}

.available-cartons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.no-data {
  text-align: center;
  padding: 1.5rem;
  color: var(--color-muted);
  font-weight: 500;
}

.carton-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.carton-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
}

.carton-info {
  color: var(--color-muted);
  font-size: 0.95rem;
}

.carton-products {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.carton-product-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(0, 86, 179, 0.12);
  color: var(--color-primary);
  font-weight: 600;
}

.carton-products--empty {
  color: var(--color-muted);
  font-style: italic;
}

.carton-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.carton-actions .btn {
  flex: 1 1 120px;
  justify-content: center;
}

.box-selection-dialog {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-selection {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.product-info strong {
  display: block;
  font-weight: 600;
}

.product-meta {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.quantity-input {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quantity-input input {
  width: 120px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 25, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 2rem;
}

.dialog-content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: min(720px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 30px 60px rgba(12, 28, 53, 0.24);
}

.selected-boxes-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.selected-boxes-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.selected-boxes-table th,
.selected-boxes-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
}

.selected-boxes-table th {
  background: rgba(0, 86, 179, 0.08);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.selected-boxes-table tbody tr:nth-child(even) {
  background: rgba(0, 86, 179, 0.04);
}

.confirm-details {
  background: rgba(0, 86, 179, 0.06);
  border: 1px solid rgba(0, 86, 179, 0.15);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.confirm-details h4 {
  font-size: 1.05rem;
  font-weight: 600;
}

.confirm-totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.confirm-totals .total-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.confirm-totals .value {
  font-weight: 700;
  color: var(--color-primary);
}

.confirm-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.breakdown-table th,
.breakdown-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.breakdown-table th {
  background: rgba(0, 86, 179, 0.08);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.details-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.details-section + .details-section {
  margin-top: 1.5rem;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: rgba(0, 86, 179, 0.05);
  border: 1px solid rgba(0, 86, 179, 0.15);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
}

.detail-item label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.detail-item.full-width {
  grid-column: 1 / -1;
  background: none;
  border: none;
  padding: 0;
}

.detail-item.full-width p {
  margin: 0;
  color: var(--color-text);
  background: rgba(0, 86, 179, 0.05);
  border: 1px solid rgba(0, 86, 179, 0.15);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
}

.totals-grid .total-item {
  background: rgba(0, 86, 179, 0.06);
  border: 1px solid rgba(0, 86, 179, 0.15);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.total-label {
  font-size: 0.85rem;
  color: var(--color-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.total-value {
  font-size: 1.5rem;
  font-weight: 600;
}

.contents-table-wrapper {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.contents-table {
  width: 100%;
  border-collapse: collapse;
}

.contents-table th,
.contents-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.contents-table th {
  background: rgba(0, 86, 179, 0.08);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.contents-table tbody tr:nth-child(even) {
  background: rgba(0, 86, 179, 0.04);
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .filters-actions {
    justify-content: flex-start;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }
}
