/* Flash messages */
.flash {
  padding: 0.75rem 1rem;
  border-radius: 0.25rem;
  margin-bottom: 1rem;
}
.flash-success {
  background: #1e4620;
  color: #a3d9a5;
  border: 1px solid #2d6a30;
}
.flash-error {
  background: #4a1c1c;
  color: #f5a5a5;
  border: 1px solid #6b2c2c;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-completed { background: #28a745; color: #fff; }
.badge-in_progress { background: #ffc107; color: #333; }
.badge-not_started { background: #6c757d; color: #fff; }
.badge-failed { background: #dc3545; color: #fff; }

/* Condition badges */
.badge-excellent { background: #17a2b8; color: #fff; }
.badge-good { background: #28a745; color: #fff; }
.badge-fair { background: #ffc107; color: #333; }
.badge-poor { background: #fd7e14; color: #fff; }
.badge-damaged { background: #dc3545; color: #fff; }

/* Tape type badge */
.badge-type {
  background: #6f42c1;
  color: #fff;
}

/* Tag pills */
.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  background: #3a3f44;
  color: #c9d1d9;
  margin: 0.1rem;
}

/* Card grid */
.tape-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
@media (max-width: 992px) {
  .tape-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 576px) {
  .tape-grid {
    grid-template-columns: 1fr;
  }
}

/* Tape card */
.tape-card {
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tape-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}
.tape-card-body {
  padding: 1rem;
}
.tape-card-body h4 {
  margin-bottom: 0.5rem;
}
.tape-card-badges {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  text-align: center;
  padding: 1.5rem 1rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 0.5rem;
}
.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  display: block;
}
.stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 1.5rem;
}
.filter-bar select,
.filter-bar input {
  margin-bottom: 0;
}
.filter-bar button,
.filter-bar [role="button"] {
  margin-bottom: 0;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  line-height: 1.5;
}

/* Detail view */
.tape-detail {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.tape-detail-photo {
  text-align: center;
}
.tape-detail-photo img {
  max-width: 500px;
  width: 100%;
  border-radius: 0.5rem;
}

/* Action buttons row */
.actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  align-items: center;
}
.actions button,
.actions [role="button"] {
  margin-bottom: 0;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  line-height: 1.5;
}

/* Tag input pills in form */
.tag-input-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  background: #3a3f44;
  color: #c9d1d9;
}
.tag-pill button {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  color: #999;
  width: auto;
}

/* Thumbnail preview */
.thumb-preview {
  max-width: 200px;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
}

/* Photo Gallery on Detail Page */
.tape-photo-gallery {
  margin-bottom: 2rem;
}
.gallery-main {
  text-align: center;
  margin-bottom: 1rem;
}
.gallery-main img {
  max-width: 600px;
  width: 100%;
  border-radius: 0.5rem;
}
.gallery-thumbnails {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.gallery-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 0.25rem;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, border-color 0.2s;
  border: 2px solid transparent;
}
.gallery-thumb:hover {
  opacity: 0.9;
}
.gallery-thumb.active {
  opacity: 1;
  border-color: var(--pico-primary);
}

/* Photo Grid in Edit Form */
.existing-photos {
  margin-bottom: 1rem;
}
.photo-grid {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.photo-item {
  position: relative;
  width: 120px;
}
.photo-item img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 0.5rem;
}
.photo-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 50%;
  background: rgba(220, 53, 69, 0.9);
  color: white;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}
.photo-delete-btn:hover {
  background: #dc3545;
}

/* Photo Preview Grid for New Uploads */
.photo-preview-grid {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.photo-preview-item {
  position: relative;
}
.photo-preview-item img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 0.5rem;
}

/* Photo marked for deletion */
.photo-item.marked-for-deletion {
  opacity: 0.4;
}
.photo-item.marked-for-deletion::after {
  content: 'Will be deleted';
  position: absolute;
  bottom: 4px;
  left: 4px;
  right: 4px;
  background: rgba(220, 53, 69, 0.9);
  color: white;
  font-size: 10px;
  text-align: center;
  padding: 2px;
  border-radius: 0 0 0.5rem 0.5rem;
}
