/**
 * Station Hub Styles
 * Styling for the station selection hub and bin management
 */

/* Station Hub Filter Overrides */
.station-hub-filters {
  grid-template-columns: 1fr 1fr auto !important;
}

.station-hub-filters .btn {
  align-self: end;
  height: 44px;
}

/* Content Section Headers */
.content-section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.content-section-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.content-section-title svg {
  fill: var(--emerald, var(--tx-color-emerald-deep));
}

.section-badge {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--emerald, var(--tx-color-emerald-deep));
  background: rgba(16, 185, 129, 0.1);
  padding: 0.375rem 1rem;
  border-radius: 12px;
}

/* Stations Grid */
.stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Station Card */
.station-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.station-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--emerald, var(--tx-color-emerald-deep)) 0%, var(--electric-blue, var(--tx-color-blue-brand)) 100%);
}

.station-card:hover {
  border-color: var(--emerald, var(--tx-color-emerald-deep));
  box-shadow: var(--shadow-lift);
  transform: translateY(-4px);
}

.station-card.active {
  border-color: var(--emerald, var(--tx-color-emerald-deep));
  background: var(--bg-surface);
}

/* Disabled/Inactive Station Card */
.station-card.disabled {
  cursor: not-allowed;
  opacity: 0.6;
  border-color: var(--border);
  background: var(--bg);
}

.station-card.disabled::before {
  background: linear-gradient(90deg, var(--text-muted) 0%, var(--text-4) 100%);
}

.station-card.disabled:hover {
  transform: none;
  box-shadow: var(--shadow-card);
  border-color: var(--border);
}

.station-card.disabled .station-name {
  color: var(--text-muted);
}

.station-card.disabled .station-description {
  color: var(--text-muted);
}

.station-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 1rem;
}

.station-number {
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.station-status {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.station-status.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald, var(--tx-color-emerald-deep));
}

.station-status.inactive {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.station-card-body {
  padding: 0 1.5rem 1rem;
}

.station-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.station-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Bins at Station */
.station-bins-section {
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border);
}

.station-bins-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.station-bins-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.station-bins-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--emerald, var(--tx-color-emerald-deep));
  background: rgba(16, 185, 129, 0.1);
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
}

.station-bins-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.station-bin-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-3);
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.station-bin-tag.status-in-use {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.08);
}

.station-bin-tag.status-full {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
}

.station-no-bins {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-style: italic;
}

.station-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid var(--border);
}

.station-stat {
  text-align: center;
  flex: 1;
}

.station-stat-value {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
}

.station-stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  margin-top: 2rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.section-count {
  font-size: 0.875rem;
  color: var(--text-muted);
  background: var(--bg-3);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
}

/* Bins Table */
.bins-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--bg-3);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem !important;
}

/* Bin Status Badges */
.bin-status {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
}

.bin-status.status-empty {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.bin-status.status-in-use {
  background: rgba(61, 123, 255, 0.15);
  color: var(--primary);
}

.bin-status.status-full {
  background: rgba(255, 179, 71, 0.15);
  color: var(--warning);
}

.bin-status.status-completed {
  background: rgba(16, 185, 129, 0.1);
  color: var(--tx-color-emerald-deep);
}

/* Action Buttons */
.action-btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.action-btn-primary {
  background: var(--primary);
  color: white;
}

.action-btn-primary:hover {
  background: var(--primary-dark);
}

.action-btn-secondary {
  background: var(--bg-3);
  color: var(--text-primary);
}

.action-btn-secondary:hover {
  background: var(--bg-4);
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--bg-card);
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Station Type Icons */
.station-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.station-icon.sorting { background: linear-gradient(135deg, var(--tx-color-blue-brand) 0%, var(--tx-color-violet-800) 100%); }
.station-icon.prep { background: linear-gradient(135deg, var(--tx-color-pink-300) 0%, var(--tx-color-red-warm) 100%); }
.station-icon.boxing { background: linear-gradient(135deg, var(--tx-color-blue-bright) 0%, var(--tx-color-cyan-aqua) 100%); }
.station-icon.qc { background: linear-gradient(135deg, var(--tx-color-emerald-flash) 0%, var(--tx-color-cyan-flash) 100%); }
.station-icon.shipping { background: linear-gradient(135deg, var(--tx-color-pink-warm-soft) 0%, var(--tx-color-amber-warm) 100%); }

.station-icon svg {
  width: 24px;
  height: 24px;
  fill: white;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* ===================================
   BIN DETAILS MODAL
   =================================== */

/* Base modal content styles for station-hub */
#bin-details-modal .modal-content {
  background: linear-gradient(180deg, rgba(12, 21, 40, 0.98) 0%, rgba(7, 15, 30, 0.98) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--tx-color-slate-200);
  border-radius: 12px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#bin-details-modal.show .modal-content {
  transform: translateY(0);
  opacity: 1;
}

#bin-details-modal .modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
}

#bin-details-modal .modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--tx-color-white);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

#bin-details-modal .modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

#bin-details-modal .modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

#bin-details-modal .data-table th {
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#bin-details-modal .data-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--tx-color-slate-200);
}

#bin-details-modal .data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.modal-large {
  max-width: 900px;
  width: 95%;
}

.bin-details-summary {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.bin-info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.bin-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bin-info-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.bin-info-value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--tx-color-white);
}

/* Tabs */
.bin-details-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 1rem;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--tx-color-cyan-brand);
}

.tab-btn.active {
  color: var(--tx-color-cyan-brand);
  border-bottom-color: var(--tx-color-cyan-brand);
}

.tab-content {
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
}

/* Contents Table */
.bin-contents-table-container {
  overflow-x: auto;
}

.bin-contents-table {
  font-size: 0.875rem;
}

.bin-contents-table th,
.bin-contents-table td {
  padding: 0.75rem 1rem;
}

.bin-contents-summary {
  padding: 1rem 0 0;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 1rem;
}

/* Station History List */
.station-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.station-history-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border-left: 4px solid var(--tx-color-cyan-brand);
}

.station-history-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tx-color-cyan-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.station-history-icon svg {
  width: 18px;
  height: 18px;
  fill: var(--tx-color-navy-surface);
}

.station-history-content {
  flex: 1;
}

.station-history-name {
  font-weight: 600;
  color: var(--tx-color-white);
  margin-bottom: 0.25rem;
}

.station-history-time {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
}

.station-history-duration {
  font-size: 0.8125rem;
  color: var(--tx-color-emerald-deep);
  font-weight: 500;
}

/* Action Log List */
.action-log-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.action-log-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  font-size: 0.875rem;
}

.action-log-timestamp {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  min-width: 140px;
}

.action-log-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.action-log-badge.item_added { background: rgba(59, 130, 246, 0.2); color: var(--tx-color-blue-400); }
.action-log-badge.quantity_updated { background: rgba(245, 158, 11, 0.2); color: var(--tx-color-amber-400); }
.action-log-badge.bin_checked_in { background: rgba(16, 185, 129, 0.2); color: var(--tx-color-emerald-400); }
.action-log-badge.bin_checked_out { background: rgba(239, 68, 68, 0.2); color: var(--tx-color-red-400); }
.action-log-badge.bin_completed { background: rgba(139, 92, 246, 0.2); color: var(--tx-color-violet-400); }

.action-log-details {
  flex: 1;
  color: var(--tx-color-slate-200);
}

@media (max-width: 768px) {
  .bin-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bin-details-tabs {
    overflow-x: auto;
  }

  .action-log-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .action-log-timestamp {
    min-width: auto;
  }
}
