.admin-body { background: var(--bg); }

.admin-tag {
  padding: 6px 13px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.header-spacer { flex: 1; }

.btn-sm { padding: 9px 18px; font-size: 13.5px; }
.btn-block { width: 100%; }

/* ---------- Login ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(800px 400px at 50% 0%, rgba(123, 92, 255, 0.22), transparent 65%),
    var(--bg);
}

.login-card {
  width: min(400px, 100%);
  background: var(--bg-raise);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.login-card .logo { margin-bottom: 6px; }
.login-card h1 { font-size: 23px; font-weight: 800; margin-bottom: 4px; }

.login-card label,
.panel label,
.modal-card label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.login-card input,
.panel input[type="text"],
.panel input[type="number"],
.panel input[type="password"],
.panel input[type="search"],
.panel textarea,
.modal-card input,
.modal-card textarea {
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
  outline: none;
  transition: 0.18s;
  width: 100%;
}

.panel input:focus,
.panel textarea:focus,
.modal-card input:focus,
.modal-card textarea:focus,
.login-card input:focus {
  border-color: var(--accent);
}

.req { color: var(--accent); }

.back-link { text-align: center; color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.back-link:hover { color: var(--accent); }

.form-error {
  color: #ff6b81;
  font-size: 13.5px;
  font-weight: 600;
  background: rgba(255, 45, 85, 0.1);
  border: 1px solid rgba(255, 45, 85, 0.35);
  padding: 10px 13px;
  border-radius: 8px;
}

.form-ok {
  color: #35d07f;
  font-size: 13.5px;
  font-weight: 600;
  background: rgba(53, 208, 127, 0.1);
  border: 1px solid rgba(53, 208, 127, 0.35);
  padding: 10px 13px;
  border-radius: 8px;
}

/* ---------- Dashboard ---------- */

.admin-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 24px 70px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }

.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.stat-num { font-size: 27px; font-weight: 800; letter-spacing: -0.6px; }
.stat-label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; }

.admin-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 24px; align-items: start; }

.panel {
  background: var(--bg-raise);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
}

.panel h2 { font-size: 18px; font-weight: 800; margin-bottom: 20px; display: flex; align-items: center; gap: 9px; }

.count-badge {
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}

#uploadForm { display: flex; flex-direction: column; gap: 16px; }
#siteForm, #passForm, .settings-form { display: flex; flex-direction: column; gap: 15px; }
#passForm { margin-top: 26px; padding-top: 26px; border-top: 1px solid var(--border); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 4px;
}

.seg-btn {
  flex: 1;
  padding: 10px 12px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 700;
  transition: 0.18s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent); color: #fff; }

.form-hint {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.55;
  margin-top: -4px;
}
.form-hint code {
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.upload-stats {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  flex-wrap: wrap;
}

#uploadForm select,
#existingForm select {
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14.5px;
  outline: none;
}


/* The "Use existing file" picker styles live in /css/picker.css, linked
   separately so they can be rewritten without touching this file. */

#existingForm:not([hidden]) { display: flex; flex-direction: column; gap: 16px; }

.check-row { flex-direction: row !important; align-items: center; gap: 10px !important; color: var(--text) !important; }
.check-row input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }

/* ---------- Drop zone ---------- */

.drop-zone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 34px 20px;
  text-align: center;
  cursor: pointer;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  transition: 0.18s;
  background: var(--bg-card);
}
.drop-zone:hover, .drop-zone.dragover { border-color: var(--accent); background: rgba(255, 45, 85, 0.06); }

.drop-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 45, 85, 0.15);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 19px;
}
.drop-title { font-size: 14.5px; font-weight: 700; color: var(--text); word-break: break-word; }
.drop-hint { font-size: 12px; color: var(--text-dim); }

/* ---------- Progress ---------- */

.progress {
  position: relative;
  height: 30px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.2s;
}
.progress-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* ---------- Library ---------- */

.lib-toolbar { margin-bottom: 16px; }
.lib-list { display: flex; flex-direction: column; gap: 11px; max-height: 620px; overflow-y: auto; }

.lib-item {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: 0.18s;
}
.lib-item:hover { border-color: #3d3d52; }

.lib-thumb {
  width: 46px;
  height: 66px;
  border-radius: 7px;
  background: linear-gradient(135deg, #23233a, #14141f);
  object-fit: cover;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 9px;
  font-weight: 800;
  color: #5a5a72;
  text-align: center;
  padding: 3px;
  overflow: hidden;
}

.lib-meta { flex: 1; min-width: 0; }
.lib-name {
  font-size: 14.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.lib-featured { color: var(--accent); font-weight: 700; }

.lib-actions { display: flex; gap: 6px; flex-shrink: 0; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  display: grid;
  place-items: center;
  transition: 0.18s;
}
.icon-btn:hover { color: var(--text); border-color: #3d3d52; }
.icon-btn.danger:hover { color: #ff6b81; border-color: #ff6b81; background: rgba(255, 107, 129, 0.1); }

/* ---------- Edit modal ---------- */

.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.85); }

.modal-card {
  position: relative;
  width: min(540px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-raise);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  box-shadow: var(--shadow);
}

.modal-card h2 { font-size: 19px; font-weight: 800; }
.modal-actions { display: flex; gap: 11px; justify-content: flex-end; margin-top: 8px; }

@media (max-width: 900px) {
  .admin-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
