*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --bg-card: #141420;
  --bg-hover: #1c1c2e;
  --border: #2a2a3d;
  --text: #e8e8f0;
  --text-dim: #8888a0;
  --accent: #6c63ff;
  --accent-glow: rgba(108, 99, 255, 0.3);
  --success: #4ade80;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Hero */
.hero {
  position: relative;
  height: 340px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: url('https://images.unsplash.com/photo-1513635269975-59663e0ac1ad?w=1600&q=80') center/cover no-repeat;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 15, 0.3) 0%,
    rgba(10, 10, 15, 0.6) 50%,
    rgba(10, 10, 15, 1) 100%
  );
}

.hero-content {
  position: relative;
  text-align: center;
  padding-bottom: 32px;
}

.hero h1 {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 0%, #c8c4ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text-dim);
  font-size: 1.1rem;
  margin-top: 4px;
  font-weight: 400;
}

/* Main */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* Upload */
.upload-section {
  margin-bottom: 24px;
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-card);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.05);
  box-shadow: 0 0 30px var(--accent-glow);
}

.drop-icon {
  width: 40px;
  height: 40px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.drop-zone p {
  font-size: 1rem;
  font-weight: 500;
}

.drop-hint {
  color: var(--text-dim);
  font-size: 0.85rem !important;
  font-weight: 400 !important;
  margin-top: 4px;
}

/* Upload Progress */
.upload-progress {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.progress-item .filename {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar-wrap {
  width: 120px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.2s;
}

.progress-item .status {
  font-size: 0.8rem;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.progress-item.done .progress-bar {
  background: var(--success);
}

.progress-item.done .status {
  color: var(--success);
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-count {
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #5b52ee;
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Gallery Grid */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-card);
  transition: transform 0.15s;
}

.gallery-item:hover {
  transform: scale(1.02);
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item .video-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}

.gallery-item .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.play-overlay svg {
  width: 48px;
  height: 48px;
  fill: rgba(255,255,255,0.85);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.gallery-item .check-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.6);
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}

.gallery-item:hover .check-overlay,
.gallery-item.selected .check-overlay {
  opacity: 1;
}

.gallery-item.selected .check-overlay {
  background: var(--accent);
  border-color: var(--accent);
}

.gallery-item.selected .check-overlay::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.gallery-item .item-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 10px 8px;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.8);
  opacity: 0;
  transition: opacity 0.15s;
}

.gallery-item:hover .item-info {
  opacity: 1;
}

.item-info .info-date {
  display: block;
  font-size: 0.7rem;
  opacity: 0.9;
}

.item-info .info-location {
  display: block;
  font-size: 0.7rem;
  opacity: 0.7;
  margin-top: 2px;
}

.lightbox-location {
  font-style: italic;
}

/* Loading */
.loading-spinner {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 0;
  color: var(--text-dim);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}

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

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox.active {
  display: flex;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  padding: 8px;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.lightbox-close:hover { opacity: 1; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 2.5rem;
  cursor: pointer;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  z-index: 10;
  opacity: 0.6;
  transition: opacity 0.15s;
  line-height: 1;
}

.lightbox-nav:hover { opacity: 1; }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-content {
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.lightbox-content video {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: var(--radius-sm);
}

.lightbox-info {
  margin-top: 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 16px;
}

.lightbox-info .dl-btn {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.lightbox-info .dl-btn:hover {
  text-decoration: underline;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-dim);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 600px) {
  .hero { height: 260px; }
  .hero h1 { font-size: 2.2rem; }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }

  .drop-zone { padding: 28px 16px; }
  .toolbar { padding: 8px 0; }

  .lightbox-nav { display: none; }
}

/* ZIP download progress toast */
.zip-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  z-index: 2000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.zip-toast .spinner {
  width: 20px;
  height: 20px;
  margin: 0;
}
