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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #111;
  color: #eee;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Login */
.login-box {
  max-width: 360px;
  margin: 20vh auto;
  padding: 2rem;
  text-align: center;
}

.login-box h1 { margin-bottom: 1.5rem; font-size: 1.4rem; }

.login-box input {
  width: 100%;
  padding: 0.7rem;
  margin-bottom: 0.8rem;
  background: #222;
  border: 1px solid #333;
  color: #eee;
  border-radius: 4px;
  font-size: 0.95rem;
}

.message { margin-top: 1rem; color: #888; font-size: 0.9rem; }

/* Buttons */
button, .btn-primary, .btn-secondary, .btn-danger {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.btn-primary { background: #fff; color: #111; font-weight: 600; }
.btn-primary:hover { background: #ddd; }
.btn-secondary { background: #333; color: #eee; }
.btn-secondary:hover { background: #444; }
.btn-danger { background: #611; color: #fcc; }
.btn-danger:hover { background: #822; }
.btn-full { width: 100%; margin-top: 0.5rem; }

/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1.2rem;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
}

.topbar h1 { font-size: 1rem; }
.topbar-actions { display: flex; gap: 0.5rem; }

/* Dashboard layout */
.dashboard-layout {
  display: flex;
  height: calc(100vh - 52px);
}

/* Sidebar */
#sidebar {
  width: 240px;
  padding: 1rem;
  background: #1a1a1a;
  border-right: 1px solid #333;
  overflow-y: auto;
  flex-shrink: 0;
}

#sidebar h2 { font-size: 0.85rem; color: #888; text-transform: uppercase; margin-bottom: 0.8rem; }

#section-list { list-style: none; }

#section-list li {
  padding: 0.6rem 0.8rem;
  margin-bottom: 2px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#section-list li:hover { background: #2a2a2a; }
#section-list li.active { background: #333; }

#section-list li .drag-handle {
  cursor: grab;
  color: #555;
  padding: 0 4px;
}

/* Section editor */
#section-editor {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

#editor-empty { text-align: center; color: #555; margin-top: 30vh; }

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.editor-header h2 { font-size: 1.2rem; }
.editor-actions { display: flex; gap: 0.5rem; align-items: center; }

.editor-actions select,
.editor-actions label {
  background: #222;
  color: #eee;
  border: 1px solid #333;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Upload zone */
.upload-zone {
  border: 2px dashed #333;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
  color: #666;
  transition: border-color 0.2s;
}

.upload-zone.dragover { border-color: #fff; color: #ccc; }
.upload-link { color: #aaa; text-decoration: underline; cursor: pointer; }

#upload-progress { margin-top: 0.5rem; }

.progress-bar {
  height: 3px;
  background: #333;
  border-radius: 2px;
  margin: 4px 0;
}

.progress-bar-fill {
  height: 100%;
  background: #fff;
  border-radius: 2px;
  transition: width 0.2s;
}

/* Items grid */
#items-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.item-card {
  position: relative;
  width: 150px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.item-card:hover { border-color: #555; }
.item-card.selected { border-color: #fff; }
.item-card.dragging { opacity: 0.4; }

.item-card img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.item-card .item-label {
  padding: 4px 6px;
  font-size: 0.7rem;
  color: #888;
  background: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-card .item-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.6rem;
  padding: 2px 5px;
  border-radius: 3px;
}

/* Video item card (no image) */
.item-card.video-card img { display: none; }
.item-card.video-card {
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  width: 150px;
}

.item-card.video-card::before {
  content: '\25B6';
  font-size: 2rem;
  color: #555;
}

/* Slideshow group indicator */
.slideshow-group {
  border: 1px solid #444;
  border-radius: 6px;
  padding: 8px;
  margin: 4px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  cursor: grab;
}

.slideshow-group.dragging {
  opacity: 0.4;
}

.slideshow-group-label {
  width: 100%;
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 4px;
}

/* Subcategory groups */
.subcategory-group {
  width: 100%;
  margin-bottom: 1rem;
}

.subcategory-group h3 {
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid #333;
}

/* Bulk actions */
#bulk-actions {
  position: fixed;
  bottom: 0;
  left: 240px;
  right: 0;
  padding: 0.8rem 1.5rem;
  background: #222;
  border-top: 1px solid #444;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

#bulk-actions select,
#bulk-actions input {
  background: #333;
  border: 1px solid #444;
  color: #eee;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 1.5rem;
  width: 420px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header h3 { font-size: 1rem; }

.modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
}

.modal-close:hover { color: #fff; }

.form-group {
  margin-bottom: 0.8rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 0.3rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem;
  background: #222;
  border: 1px solid #333;
  color: #eee;
  border-radius: 4px;
  font-size: 0.9rem;
}

.form-group small { color: #666; font-size: 0.75rem; }

.modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 1.2rem;
}
