* { box-sizing: border-box; }
:root {
  --bg: #121212;
  --card-bg: #1e1e1e;
  --text: #e4e4e4;
  --text-muted: #a0a0a0;
  --border: #333;
  --input-bg: #2a2a2a;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --secondary: #4b5563;
  --success: #22c55e;
  --shadow: rgba(0, 0, 0, 0.4);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  background: var(--bg);
  color: var(--text);
}
h1 { color: var(--text); }
h2 { color: var(--text); }
.card {
  background: var(--card-bg);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px var(--shadow);
}
input[type="text"], input[type="file"] {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 100%;
  margin-bottom: 10px;
  background: var(--input-bg);
  color: var(--text);
}
label {
  color: var(--text-muted);
  font-size: 0.9em;
}
button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 5px;
}
button:hover { background: var(--accent-hover); }
button.danger { background: var(--danger); }
button.danger:hover { background: var(--danger-hover); }
button.secondary { background: var(--secondary); }
.file-list { list-style: none; padding: 0; }
.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--border);
}
.file-item:last-child { border-bottom: none; }
.file-info { flex: 1; }
.file-name { font-weight: bold; }
.file-meta { font-size: 0.85em; color: var(--text-muted); }
.hidden { display: none; }
.error { color: var(--danger); margin-bottom: 10px; }
.success { color: var(--success); margin-bottom: 10px; }
#drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  margin-bottom: 15px;
  transition: all 0.3s;
}
#drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}

/* View Toggle */
.view-toggle {
  margin-bottom: 15px;
}
.view-toggle button {
  background: var(--input-bg);
  color: var(--text);
}
.view-toggle button.active {
  background: var(--accent);
  color: white;
}

/* Media Gallery */
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
}
.media-gallery.list-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.media-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--input-bg);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}
.media-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow);
}
.media-item .thumbnail {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.media-item .file-icon {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--input-bg);
}
.media-item .media-label {
  padding: 8px;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--card-bg);
  color: var(--text);
}
.media-gallery.list-view .media-item {
  display: flex;
  align-items: center;
}
.media-gallery.list-view .thumbnail,
.media-gallery.list-view .file-icon {
  width: 60px;
  height: 60px;
  aspect-ratio: auto;
  flex-shrink: 0;
}
.media-gallery.list-view .media-label {
  flex: 1;
  padding: 10px 15px;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox.hidden {
  display: none;
}
.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: transparent;
  color: white;
  font-size: 1.5rem;
  border: none;
  cursor: pointer;
  padding: 5px 10px;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  padding: 20px 15px;
  font-size: 1.5rem;
  cursor: pointer;
}
.lightbox-nav:hover {
  background: rgba(255,255,255,0.3);
}
.lightbox-nav.prev { left: -60px; }
.lightbox-nav.next { right: -60px; }
#lightbox-media img,
#lightbox-media video {
  max-width: 85vw;
  max-height: 80vh;
  border-radius: 4px;
}
.lightbox-info {
  color: white;
  margin-top: 15px;
  display: flex;
  gap: 20px;
  font-size: 0.9rem;
}