:root {
  --bg: #0b0907;
  --panel: #17130f;
  --panel-soft: #211b15;
  --text: #fffaf1;
  --muted: #c7bba8;
  --gold: #ddb55d;
  --line: rgba(255, 250, 241, 0.13);
  --danger: #ff8376;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at 80% 0, #2a2115 0, transparent 34%), var(--bg);
  color: var(--text);
  font-family: "Poppins", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
.admin-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px clamp(20px, 5vw, 70px);
  border-bottom: 1px solid var(--line);
  background: rgba(11, 9, 7, 0.86);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 700; }
.brand img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.header-actions { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: .9rem; }
.text-button { padding: 0; border: 0; background: none; color: var(--gold); }
main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 64px 0 100px; }
h1, h2 { margin: 0; font-family: "Playfair Display", Georgia, serif; }
h1 { font-size: clamp(2.5rem, 6vw, 5rem); }
h2 { font-size: clamp(1.8rem, 3vw, 2.7rem); }
.eyebrow { margin: 0 0 10px; color: var(--gold); font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; }
.login-card {
  width: min(500px, 100%);
  margin: 8vh auto 0;
  padding: clamp(28px, 5vw, 52px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.login-card > p:not(.eyebrow), .dashboard-heading p:last-child { color: var(--muted); line-height: 1.7; }
form label { display: grid; gap: 8px; color: var(--muted); font-size: .9rem; font-weight: 600; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0f0c09;
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(221, 181, 93, .12); }
.login-card form { display: grid; gap: 18px; margin-top: 28px; }
.primary-button {
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  background: var(--gold);
  color: #171009;
  padding: 12px 20px;
  font-weight: 700;
}
.primary-button:disabled { opacity: .55; cursor: wait; }
.status { min-height: 22px; margin: 0; color: var(--muted); font-size: .88rem; }
.status.error { color: var(--danger); }
.dashboard-heading { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 48px; flex-wrap: wrap; gap: 20px; }
.dashboard-heading p:last-of-type { max-width: 600px; margin-top: 10px; }
.upload-card { display: grid; gap: 22px; padding: 24px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label span { color: #807566; font-weight: 400; }
.file-drop {
  min-height: 150px; place-content: center; text-align: center; padding: 26px;
  border: 1px dashed rgba(221, 181, 93, .5); background: rgba(221, 181, 93, .04); transition: all 160ms ease;
}
.file-drop:hover { background: rgba(221, 181, 93, .1); border-color: var(--gold); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop strong { color: var(--text); font-size: 1.1rem; }
.upload-preview { max-height: 300px; overflow: hidden; border-radius: 7px; background: #050403; }
.upload-preview img, .upload-preview video { display: block; width: 100%; max-height: 300px; object-fit: contain; }
.modal-actions { display: flex; align-items: center; gap: 20px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-backdrop[hidden] { display: none; }
.modal-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; width: 100%; max-width: 700px; max-height: 90vh; overflow-y: auto; box-shadow: 0 40px 100px rgba(0,0,0,0.6); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 24px 24px 0; }
.close-btn { font-size: 1.4rem; color: var(--muted); }
.close-btn:hover { color: var(--text); }

/* Categories */
.categories-container { display: flex; flex-direction: column; gap: 64px; }
.category-section { border-top: 1px solid var(--line); padding-top: 32px; }
.category-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.category-header h2 { color: var(--gold); font-size: 2rem; }
.add-btn { background: transparent; border: 1px solid var(--gold); color: var(--gold); padding: 8px 16px; border-radius: 4px; font-weight: 600; font-family: inherit; transition: all 0.3s; }
.add-btn:hover { background: var(--gold); color: var(--bg); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.library-card { overflow: hidden; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; }
.library-visual { aspect-ratio: 4 / 3; background: #030201; position: relative; }
.library-visual img, .library-visual video { width: 100%; height: 100%; object-fit: cover; display: block; }
.library-body { padding: 16px; }
.library-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--gold); font-size: .72rem; text-transform: uppercase; margin-bottom: 8px; }
.library-caption { min-height: 42px; color: var(--muted); font-size: .86rem; line-height: 1.5; margin-bottom: 16px; }
.library-actions { display: flex; gap: 8px; }
.library-actions button { flex: 1; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-soft); color: var(--text); padding: 9px; font-size: .78rem; transition: background 0.2s; }
.library-actions button:hover { background: rgba(255,255,255,0.05); }
.library-actions .delete-button { color: var(--danger); border-color: rgba(255,131,118,0.3); }
.library-actions .delete-button:hover { background: rgba(255,131,118,0.1); }
.library-card.is-hidden { opacity: .56; }
.empty-text { color: var(--muted); font-style: italic; grid-column: 1 / -1; }


@media (max-width: 820px) {
  .upload-layout { grid-template-columns: 1fr; }
  .media-library { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .admin-header .brand span { display: none; }
  main { width: min(100% - 24px, 1180px); padding-top: 38px; }
  .field-row, .media-library { grid-template-columns: 1fr; }
  .library-heading { align-items: stretch; flex-direction: column; }
  .library-heading select { width: 100%; }
}
