/* Raya 360 Studio — admin UI. Dark, amber accent, matches the viewer/app. */
:root {
  --accent: #ffb030;
  --bg: #0b0c10;
  --bg-2: #14151a;
  --bg-3: #1c1e26;
  --line: #2a2c36;
  --text: #ececef;
  --muted: #9a9aa2;
  --danger: #ff6b6b;
  --ok: #37d67a;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
button { font-family: inherit; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: transform .12s, background .12s, border-color .12s;
}
.btn:hover { transform: translateY(-1px); border-color: #3a3d49; }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: #14151a; border-color: transparent; }
.btn.danger { color: var(--danger); border-color: #4a2626; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 13px; }

/* Inputs */
input, textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 72px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px; font-weight: 600; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* Layout */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--bg-2);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.container { max-width: 1100px; margin: 0 auto; padding: 26px 22px; }
.muted { color: var(--muted); }
.tag { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--bg-3); color: var(--muted); }
.tag.published { background: rgba(55,214,122,.15); color: var(--ok); }
.tag.draft { background: rgba(255,176,48,.15); color: var(--accent); }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: border-color .12s, transform .12s;
}
.card:hover { border-color: #3a3d49; transform: translateY(-2px); }
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card .meta { display: flex; align-items: center; gap: 8px; margin-top: 12px; }

/* Login */
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-box { width: 100%; max-width: 360px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 16px; padding: 30px; }
.login-box h1 { margin: 0 0 4px; font-size: 22px; }

/* Editor */
.editor { display: grid; grid-template-columns: 300px 1fr; height: calc(100vh - 57px); }
.sidebar { border-right: 1px solid var(--line); background: var(--bg-2); overflow-y: auto; padding: 16px; }
.stage { position: relative; background: #000; }
#psv { position: absolute; inset: 0; }
.room-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px;
  cursor: pointer; margin-bottom: 4px; }
.room-item:hover { background: var(--bg-3); }
.room-item.active { background: var(--bg-3); outline: 1px solid var(--accent); }
.room-item img { width: 46px; height: 26px; object-fit: cover; border-radius: 5px; background:#222; }
.room-item .rn { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
  margin: 18px 0 8px; font-weight: 700; }

/* Stage toolbar */
.stage-tools { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 30;
  display: flex; gap: 8px; background: rgba(11,12,16,.75); backdrop-filter: blur(10px);
  padding: 7px; border-radius: 999px; border: 1px solid var(--line); }
.stage-hint { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 30;
  background: rgba(255,176,48,.95); color: #14151a; padding: 8px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600; display: none; }
.stage-hint.show { display: block; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto; background: var(--bg-2);
  border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* Toast */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: var(--bg-3); border: 1px solid var(--line); padding: 12px 20px; border-radius: 999px;
  font-size: 14px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.err { border-color: #4a2626; color: #ffb3b3; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.spinner { border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  width: 26px; height: 26px; animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }
