/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
}

/* === Header === */
header {
  background: #1a1a2e;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 2px solid #16213e;
  position: sticky;
  top: 0;
  z-index: 100;
}

header h1 {
  font-size: 1.4rem;
  color: #e0e0e0;
  letter-spacing: 0.5px;
}

.stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.stat {
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: #16213e;
}
.stat.total { border-left: 3px solid #888; }
.stat.unreviewed { border-left: 3px solid #f0a500; }
.stat.keeping { border-left: 3px solid #00b894; }
.stat.deleting { border-left: 3px solid #e74c3c; }

/* === Toolbar === */
.toolbar {
  padding: 12px 24px;
  background: #141414;
  border-bottom: 1px solid #222;
  position: sticky;
  top: 68px;
  z-index: 99;
}

.filters {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 6px 18px;
  border: 1px solid #333;
  background: #1e1e1e;
  color: #ccc;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.filter-btn:hover { background: #2a2a2a; border-color: #555; }
.filter-btn.active { background: #0a3d62; border-color: #1e90ff; color: #fff; }

/* === Image Grid === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 20px 24px;
}

.image-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1a1a;
  border: 2px solid #2a2a2a;
  transition: transform 0.15s, border-color 0.2s;
  cursor: pointer;
}
.image-card:hover {
  transform: scale(1.02);
  border-color: #444;
}

.image-card.status-keep { border-color: #00b894; }
.image-card.status-delete { border-color: #e74c3c; }
.image-card.status-unreviewed { border-color: #2a2a2a; }

.image-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.card-footer {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-filename {
  font-size: 0.75rem;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.card-actions button {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.15s;
}
.card-actions button:hover { transform: scale(1.15); }

.btn-keep {
  background: #00b894;
  color: #fff;
}
.btn-delete {
  background: #e74c3c;
  color: #fff;
}
.btn-undo {
  background: #636e72;
  color: #fff;
}

/* Status badge on card */
.status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-keep { background: rgba(0,184,148,0.9); color: #fff; }
.badge-delete { background: rgba(231,76,60,0.9); color: #fff; }

/* === Lightbox === */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.lightbox.active { display: flex; }

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 24px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  z-index: 1001;
  line-height: 1;
  transition: color 0.2s;
}
.lightbox-close:hover { color: #e74c3c; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 3rem;
  padding: 8px 16px;
  cursor: pointer;
  z-index: 1001;
  border-radius: 8px;
  transition: background 0.2s;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }

.lightbox-content {
  position: relative;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-content img {
  max-width: 85vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 6px;
}

.lightbox-info {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.lightbox-filename {
  font-size: 0.95rem;
  color: #bbb;
}

.lightbox-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.15s;
}
.action-btn:hover { transform: scale(1.05); }
.keep-btn { background: #00b894; color: #fff; }
.delete-btn { background: #e74c3c; color: #fff; }
.undo-btn { background: #636e72; color: #fff; }

/* === Responsive === */
@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; padding: 12px; }
  header { padding: 12px 16px; }
  header h1 { font-size: 1.1rem; }
}
