/* Sub-Hire Deliveries - Scoped under #subhire */

#subhire {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#subhire .sh-wrapper {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 40px;
}

/* Stats Bar */
#subhire .sh-stats-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

#subhire .sh-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  flex: 1;
  min-width: 120px;
}

#subhire .sh-stat:hover {
  border-color: #1a5490;
  background: #f0f5ff;
}

#subhire .sh-stat.active {
  border-color: #1a5490;
  background: #e8f0fe;
}

#subhire .sh-stat-count {
  font-size: 24px;
  font-weight: 700;
  color: #0c3368;
  line-height: 1;
}

#subhire .sh-stat-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#subhire .sh-stat--expected .sh-stat-count { color: #e67e22; }
#subhire .sh-stat--delivered .sh-stat-count { color: #2196F3; }
#subhire .sh-stat--checked .sh-stat-count { color: #9c27b0; }
#subhire .sh-stat--complete .sh-stat-count { color: #28a745; }
#subhire .sh-stat--courier .sh-stat-count { color: #dc3545; }

/* Toolbar */
#subhire .sh-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

#subhire .sh-filters select {
  padding: 8px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  cursor: pointer;
}

/* Cards */
#subhire .sh-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#subhire .sh-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow 0.15s, border-color 0.15s;
  cursor: pointer;
}

#subhire .sh-card:hover {
  border-color: #1a5490;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

#subhire .sh-card-main {
  flex: 1;
  min-width: 0;
}

#subhire .sh-card-supplier {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 4px;
}

#subhire .sh-card-items {
  font-size: 13px;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

#subhire .sh-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

#subhire .sh-card-date {
  font-size: 12px;
  color: #888;
}

#subhire .sh-card-date.sh-overdue {
  color: #dc3545;
  font-weight: 600;
}

#subhire .sh-card-badges {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Status badges */
#subhire .sh-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

#subhire .sh-badge--expected {
  background: #fff3e0;
  color: #e67e22;
}

#subhire .sh-badge--delivered {
  background: #e3f2fd;
  color: #1976d2;
}

#subhire .sh-badge--checked {
  background: #f3e5f5;
  color: #7b1fa2;
}

#subhire .sh-badge--complete {
  background: #e8f5e9;
  color: #2e7d32;
}

#subhire .sh-badge--courier {
  background: #fce4ec;
  color: #c62828;
}

#subhire .sh-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

#subhire .sh-card-actions .btn {
  white-space: nowrap;
  font-size: 12px;
}

#subhire .sh-card-file-counts {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #999;
}

/* Empty state */
#subhire .sh-empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}

#subhire .sh-empty p {
  font-size: 16px;
}

/* Detail View */
#subhire .sh-detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

#subhire .sh-detail-header h2 {
  flex: 1;
  margin: 0;
  font-size: 22px;
  color: #1a1a1a;
}

#subhire .sh-detail-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

#subhire .sh-detail-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  padding: 20px;
}

#subhire .sh-detail-card h3 {
  margin: 0 0 16px 0;
  font-size: 15px;
  color: #333;
  font-weight: 600;
}

#subhire .sh-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

#subhire .sh-card-header h3 {
  margin: 0;
}

/* Info grid */
#subhire .sh-info-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  font-size: 14px;
}

#subhire .sh-info-label {
  color: #888;
  font-weight: 500;
}

#subhire .sh-info-value {
  color: #333;
  word-break: break-word;
}

#subhire .sh-info-value.sh-items-text {
  white-space: pre-line;
}

/* Status actions */
#subhire .sh-status-actions {
  margin-top: 20px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

#subhire .sh-status-actions .btn {
  flex: 1;
  min-width: 140px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
}

#subhire .btn-deliver {
  background: #28a745;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#subhire .btn-deliver:hover { background: #218838; }

#subhire .btn-check {
  background: #2196F3;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#subhire .btn-check:hover { background: #1976d2; }

#subhire .btn-complete {
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#subhire .btn-complete:hover { background: #5a6268; }

#subhire .btn-reopen {
  background: #ffc107;
  color: #333;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

#subhire .btn-reopen:hover { background: #e0a800; }

/* Courier info */
#subhire .sh-courier-info {
  font-size: 14px;
}

#subhire .sh-courier-info .sh-info-grid {
  margin-bottom: 0;
}

#subhire .sh-courier-none {
  color: #999;
  font-style: italic;
}

/* File list */
#subhire .sh-file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#subhire .sh-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  font-size: 13px;
}

#subhire .sh-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
}

#subhire .sh-file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

#subhire .sh-file-actions a,
#subhire .sh-file-actions button {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}

#subhire .sh-file-actions a {
  background: #e3f2fd;
  color: #1976d2;
}

#subhire .sh-file-actions a:hover {
  background: #bbdefb;
}

#subhire .sh-file-btn-delete {
  background: #fce4ec;
  color: #c62828;
  border: none;
}

#subhire .sh-file-btn-delete:hover {
  background: #f8bbd0;
}

#subhire .sh-file-empty {
  color: #999;
  font-size: 13px;
  font-style: italic;
  padding: 8px 0;
}

/* Photo gallery */
#subhire .sh-photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

#subhire .sh-photo-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #f0f0f0;
}

#subhire .sh-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.15s;
}

#subhire .sh-photo-thumb:hover img {
  transform: scale(1.05);
}

#subhire .sh-photo-thumb .sh-photo-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  background: rgba(220, 53, 69, 0.85);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#subhire .sh-photo-thumb:hover .sh-photo-delete {
  display: flex;
}

/* Upload button styling */
#subhire .sh-upload-btn {
  cursor: pointer;
}

/* Lightbox */
#subhire ~ .sh-lightbox,
.sh-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sh-lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 4px;
}

.sh-lightbox-close {
  position: absolute;
  top: 16px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 36px;
  cursor: pointer;
  line-height: 1;
}

/* Modal overrides */
#sh-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sh-modal {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.sh-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
}

.sh-modal .modal-header h2 {
  margin: 0;
  font-size: 18px;
}

.sh-modal .modal-body {
  padding: 20px;
}

.sh-modal .modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e0e0e0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sh-modal .modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
  line-height: 1;
}

.sh-modal textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

/* Time slot row */
.sh-time-row {
  display: flex;
  gap: 12px;
}

.sh-time-row .form-group {
  flex: 1;
}

.sh-modal input[type="time"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.sh-modal input[type="text"],
.sh-modal input[type="date"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

/* Type toggle */
.sh-type-toggle {
  display: flex;
  gap: 0;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  overflow: hidden;
}

.sh-type-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: #f8f9fa;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  color: #555;
}

.sh-type-btn + .sh-type-btn {
  border-left: 1px solid #d0d0d0;
}

.sh-type-btn.active {
  background: #0c3368;
  color: #fff;
}

.sh-type-btn:hover:not(.active) {
  background: #e8f0fe;
}

/* Type badges */
#subhire .sh-badge--postal {
  background: #e8eaf6;
  color: #3949ab;
}

#subhire .sh-badge--subhire {
  background: #fff8e1;
  color: #f57f17;
}

/* Form section titles */
.sh-form-section-title {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

#subhire .sh-form-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 16px 0;
}

/* Return date highlight */
#subhire .sh-return-date-warning {
  color: #e67e22;
  font-weight: 600;
}

#subhire .sh-return-date-overdue {
  color: #dc3545;
  font-weight: 600;
}

/* Delete confirmation in card */
#subhire .sh-delete-btn {
  background: none;
  border: none;
  color: #dc3545;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 8px;
}

#subhire .sh-delete-btn:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  #subhire .sh-wrapper {
    padding: 12px;
  }

  #subhire .sh-stats-bar {
    gap: 8px;
  }

  #subhire .sh-stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  #subhire .sh-stat {
    padding: 8px 10px;
    min-width: unset;
    flex: unset;
  }

  #subhire .sh-stat-count {
    font-size: 18px;
  }

  #subhire .sh-stat-label {
    font-size: 10px;
  }

  #subhire .sh-card {
    flex-direction: column;
    align-items: stretch;
    padding: 14px;
  }

  #subhire .sh-card-actions {
    flex-direction: row;
    margin-top: 8px;
  }

  #subhire .sh-card-actions .btn {
    flex: 1;
    text-align: center;
  }

  #subhire .sh-detail-body {
    grid-template-columns: 1fr;
  }

  #subhire .sh-detail-header {
    flex-wrap: wrap;
  }

  #subhire .sh-detail-header h2 {
    font-size: 18px;
    width: 100%;
    order: -1;
    margin-bottom: 8px;
  }

  #subhire .sh-status-actions {
    flex-direction: column;
  }

  #subhire .sh-status-actions .btn {
    min-width: unset;
  }

  #subhire .sh-photo-gallery {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }

  #subhire .sh-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #subhire .sh-toolbar .btn {
    width: 100%;
  }

  #subhire .sh-filters select {
    width: 100%;
  }
}
