:root {
  --brand: #2f6e4f;
  --brand-dark: #204d38;
  --bg: #f5f6f4;
  --card: #ffffff;
  --border: #e2e4e1;
  --text: #1f2521;
  --text-muted: #6b756f;
  --danger: #c0392b;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.hidden { display: none !important; }

/* ---- Login ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--card);
  padding: 40px;
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  width: 320px;
  text-align: center;
}
.login-box h1 { font-size: 20px; margin-bottom: 24px; }
.login-box form { display: flex; flex-direction: column; gap: 12px; }
.login-box input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0 0; }

/* ---- Layout ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: var(--brand);
  color: white;
}
.topbar h1 { font-size: 18px; margin: 0; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 28px 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
}
.tab-btn.active {
  color: var(--brand-dark);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

.tab-panel { display: none; padding: 24px 28px 60px; max-width: 1200px; margin: 0 auto; }
.tab-panel.active { display: block; }

/* ---- Buttons ---- */
.btn-primary, .btn-secondary {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
}
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: rgba(255,255,255,0.15); color: white; }
.btn-secondary:hover { background: rgba(255,255,255,0.25); }

/* ---- Dropzone ---- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  background: var(--card);
  margin-bottom: 16px;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.dragover { border-color: var(--brand); background: #eef6f1; }
.upload-progress { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

/* ---- Content grid ---- */
.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.content-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.content-card .thumb {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
  background: #eee;
}
.content-card .name {
  font-size: 12px;
  padding: 6px 8px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.content-card .delete-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.55);
  color: white;
  border: none;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}
.content-card .badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.55);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* ---- Screen tabs ---- */
.screen-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.screen-tab-btn {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  cursor: pointer;
  font-size: 13px;
}
.screen-tab-btn.active { background: var(--brand); color: white; border-color: var(--brand); }

/* ---- Playlist editor ---- */
.playlist-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.playlist-column h3 { margin-bottom: 4px; }
.hint { font-size: 12px; color: var(--text-muted); margin-top: 0; }

.pick-list {
  min-height: 300px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfa;
  cursor: pointer;
}
.pick-item img, .pick-item .vid-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  background: #ddd;
  flex-shrink: 0;
}
.pick-item .info { flex: 1; min-width: 0; }
.pick-item .info .fname {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pick-item .info .ftype { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }

.playlist-list .pick-item { cursor: grab; }
.playlist-list .pick-item.dragging { opacity: 0.4; }

.duration-input {
  width: 56px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}

.remove-item-btn {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 14px;
}

.save-status { margin-left: 12px; font-size: 13px; color: var(--brand-dark); }

@media (max-width: 800px) {
  .playlist-editor { grid-template-columns: 1fr; }
}
