/* Danbyte Studio — dark UI matching the Danbyte marketing site palette. */
:root {
  --bg: #08090c;
  --panel: #0e1016;
  --panel-2: #12151d;
  --border: #22262f;
  --border-2: #2c313c;
  --fg: #e7e9ee;
  --muted: #9aa2b1;
  --primary: #0f62fe;
  --primary-hover: #2f7bff;
  --danger: #ef4444;
  --ok: #10b981;
  --radius: 10px;
}
* {
  box-sizing: border-box;
}
/* The hidden attribute must win over the explicit display values below. */
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* ── Login ─────────────────────────────────────────────────────────────── */
.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: radial-gradient(
      70% 60% at 50% 0%,
      rgba(15, 98, 254, 0.16),
      transparent 70%
    ),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.login-brand,
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.login-brand span,
.brand span {
  color: var(--primary);
}
.login-sub {
  margin: 0 0 0.25rem;
  color: var(--muted);
}
.login-error {
  color: var(--danger);
  font-size: 0.85rem;
}

/* ── Inputs ────────────────────────────────────────────────────────────── */
input,
select,
textarea {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  outline: none;
  width: 100%;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.25);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 0.42rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 0.12s ease,
    border-color 0.12s ease;
}
.btn:hover {
  border-color: #3a4150;
  background: #171b24;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-ghost {
  background: transparent;
}
.btn-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-chip {
  padding: 0.3rem 0.65rem;
  font-size: 0.85rem;
  border-radius: 7px;
}
.login-card button {
  border: 0;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.6rem;
  cursor: pointer;
}
.login-card button:hover {
  background: var(--primary-hover);
}

/* ── Studio layout ─────────────────────────────────────────────────────── */
.studio {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.entry-select {
  max-width: 320px;
  width: auto;
}
.spacer {
  flex: 1;
}
.status {
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 1px;
}
.status.saved {
  color: var(--ok);
}
.status.error {
  color: var(--danger);
}
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.editor {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  padding: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.field > span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.field-wide {
  grid-column: span 4;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
}
.toolbar-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-right: 0.1rem;
}
.upload-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.media-strip {
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.media-label {
  font-size: 0.75rem;
  color: var(--muted);
}
.media-list {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.media-list button {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  font-family: ui-monospace, monospace;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  border-radius: 6px;
  cursor: pointer;
}
.media-list button:hover {
  border-color: var(--primary);
}
.body {
  flex: 1;
  min-height: 0;
  border: 0;
  border-radius: 0;
  resize: none;
  padding: 1rem 1.1rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  background: var(--bg);
}
.body:focus {
  box-shadow: none;
  border: 0;
}

/* ── Preview ───────────────────────────────────────────────────────────── */
.preview-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #000;
}
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  font-size: 0.82rem;
  color: var(--muted);
}
.preview-bar a {
  color: var(--primary);
  text-decoration: none;
}
.preview {
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  background: #000;
}

/* ── Publish log ───────────────────────────────────────────────────────── */
.log-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
.log-card {
  width: 100%;
  max-width: 760px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.log-body {
  margin: 0;
  padding: 1rem;
  overflow: auto;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  white-space: pre-wrap;
}

/* ── Media library ─────────────────────────────────────────────────────── */
.lib-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
.lib-card {
  width: 100%;
  max-width: 1080px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.lib-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.lib-title {
  font-weight: 700;
}
.lib-title span {
  color: var(--primary);
}
.lib-filter {
  width: 200px;
}
.lib-folder {
  width: auto;
  max-width: 180px;
}
.lib-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1.1rem 2rem;
}
.lib-body.drag {
  outline: 2px dashed var(--primary);
  outline-offset: -8px;
  background: rgba(15, 98, 254, 0.06);
}
.lib-group + .lib-group {
  margin-top: 1.5rem;
}
.lib-group-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.lib-group-head .folder-name {
  font-family: ui-monospace, monospace;
  color: var(--fg);
  font-weight: 600;
}
.lib-badge {
  font-size: 0.68rem;
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: 0.05rem 0.4rem;
  color: var(--muted);
}
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}
.lib-cell {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  background: var(--panel-2);
}
.lib-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #000;
  cursor: pointer;
}
.lib-name {
  padding: 0.35rem 0.5rem;
  font-size: 0.72rem;
  font-family: ui-monospace, monospace;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-actions {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  opacity: 0;
  background: rgba(6, 8, 12, 0.72);
  transition: opacity 0.12s ease;
}
.lib-cell:hover .lib-actions {
  opacity: 1;
}
.lib-actions button {
  font-size: 0.72rem;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--border-2);
  background: var(--panel);
  color: var(--fg);
  border-radius: 6px;
  cursor: pointer;
}
.lib-actions button:hover {
  border-color: var(--primary);
}
.lib-actions .lib-del:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.lib-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2rem 0;
  text-align: center;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }
  .editor {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .field-wide {
    grid-column: span 2;
  }
}
