/* ============================================
   ITEM PHOTOS, CHECKOUT, AND ASSIGNMENT SYSTEM
   Styling for photo gallery, checkout/check-in, and assignments
   ============================================ */

/* ==================== PHOTO GALLERY (AMAZON STYLE) ==================== */

.photo-gallery {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 2px solid var(--border-color);
  margin-bottom: 24px;
  flex-direction: column;
}

.photo-gallery-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border-radius: 8px;
  padding: 20px;
  position: relative;
}

.photo-gallery-main img {
  max-width: 100%;
  max-height: 500px;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.photo-gallery-main img:hover {
  transform: scale(1.02);
}

.photo-label {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

.photo-gallery-thumbnails {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.photo-thumbnail {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.photo-thumbnail:hover {
  border-color: var(--accent-primary);
  transform: scale(1.05);
}

.photo-thumbnail.active {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.photo-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-gallery-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

/* ==================== PHOTO UPLOAD MODAL ==================== */

#photoPreviewsContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.photo-upload-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photo-upload-preview img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--border-color);
}

/* ==================== CHECKOUT/CHECK-IN STATUS BANNERS ==================== */

.checkout-status-banner,
.assignment-status-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 2px solid var(--border-color);
  margin-bottom: 24px;
}

.checkout-status-banner.checked-out {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.checkout-status-banner.available,
.assignment-status-banner.available {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.assignment-status-banner.assigned {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
}

.status-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 50%;
  font-size: 24px;
  flex-shrink: 0;
}

.checkout-status-banner.checked-out .status-icon {
  color: #f59e0b;
}

.checkout-status-banner.available .status-icon,
.assignment-status-banner.available .status-icon {
  color: #10b981;
}

.assignment-status-banner.assigned .status-icon {
  color: #6366f1;
}

.status-info {
  flex: 1;
}

.status-info h4 {
  margin: 0 0 4px 0;
  font-size: 18px;
  color: var(--text-primary);
}

.status-info p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ==================== HISTORY SECTIONS (COLLAPSIBLE) ==================== */

.history-section {
  margin-top: 24px;
  margin-bottom: 24px;
}

.history-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.history-toggle:hover {
  background: var(--bg-card);
  border-color: var(--accent-primary);
}

.history-toggle i.fa-chevron-down {
  transition: transform 0.3s ease;
}

.history-toggle.expanded i.fa-chevron-down {
  transform: rotate(180deg);
}

.history-content {
  margin-top: 12px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.history-card {
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.history-card:last-child {
  margin-bottom: 0;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.history-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

.history-user i {
  color: var(--accent-primary);
}

.history-status {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.history-status.status-returned {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.history-status.status-checked_out,
.history-status.status-active {
  background: rgba(99, 102, 241, 0.2);
  color: #6366f1;
}

.history-details p {
  margin: 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.history-details strong {
  color: var(--text-primary);
}

.history-photos,
.update-photos {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.history-photos h5,
.update-photos h5 {
  width: 100%;
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
}

.history-photos img,
.update-photos img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--border-color);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.history-photos img:hover,
.update-photos img:hover {
  transform: scale(1.05);
  border-color: var(--accent-primary);
}

.history-photo-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-photo-card .photo-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  margin: 0;
}

/* ==================== STATUS UPDATES ==================== */

.status-updates-list {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--border-color);
}

.status-updates-list h5 {
  margin: 0 0 16px 0;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 600;
}

.status-update-card {
  padding: 16px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 12px;
}

.status-update-card:last-child {
  margin-bottom: 0;
}

.status-update-card.late {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.update-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.late-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

/* ==================== CHECK-IN MODAL SPECIFIC ==================== */

.reference-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
  margin: 20px 0;
  padding: 20px;
  background: var(--bg-card);
  border-radius: 12px;
  border: 2px solid var(--border-color);
}

.reference-photo-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.reference-photo-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--border-color);
}

.reference-photo-card .photo-label {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  font-weight: 600;
}

.photo-preview {
  margin-top: 12px;
}

.photo-preview img {
  border: 2px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ==================== ALERTS ==================== */

.alert {
  padding: 16px;
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 14px;
}

.alert i {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert.alert-info {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--accent-primary);
  color: var(--text-primary);
}

.alert.alert-info i {
  color: var(--accent-primary);
}

.alert.alert-warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid #f59e0b;
  color: var(--text-primary);
}

.alert.alert-warning i {
  color: #f59e0b;
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (min-width: 768px) {
  .photo-gallery {
    flex-direction: row;
  }

  .photo-gallery-main {
    flex: 1;
  }

  .photo-gallery-thumbnails {
    flex-direction: column;
    flex-wrap: nowrap;
    max-height: 500px;
    overflow-y: auto;
  }
}

@media (max-width: 768px) {
  .checkout-status-banner,
  .assignment-status-banner {
    flex-direction: column;
    text-align: center;
  }

  .history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .reference-photos-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  #photoPreviewsContainer {
    grid-template-columns: 1fr;
  }
}

/* ==================== CHANGELOG (SIMPLE COMPACT LIST) ==================== */

.changelog-entry {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

.changelog-entry:last-child {
  border-bottom: none;
}

.changelog-date {
  color: var(--text-secondary);
  font-weight: 500;
  min-width: 100px;
}

.changelog-action {
  color: var(--text-primary);
  flex: 1;
  text-align: right;
}

/* ==================== COLLAPSIBLE SECTIONS ==================== */

.collapsible-section {
  margin-top: 24px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 2px solid var(--border-color);
  overflow: hidden;
}

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
  background: var(--bg-secondary);
}

.collapsible-header:hover {
  background: var(--bg-card);
}

.collapsible-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.collapsible-header::after {
  content: '▼';
  font-size: 14px;
  color: var(--text-secondary);
  transition: transform 0.3s ease;
}

.collapsible-header.active::after {
  transform: rotate(-180deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: var(--bg-card);
}

.collapsible-content > * {
  padding: 20px;
}
