/* ═══════════════════════════════════════════
   M8 STUDIO — studio.css
   ═══════════════════════════════════════════ */

:root {
  --bg:     #080612;
  --bg2:    #0d0b14;
  --gold:   #f0a500;
  --gold2:  rgba(240,165,0,0.08);
  --gold3:  rgba(240,165,0,0.18);
  --gold4:  rgba(240,165,0,0.35);
  --text:   rgba(255,255,255,0.88);
  --text-dim: rgba(255,255,255,0.40);
  --border: rgba(240,165,0,0.14);
  --topbar-h: 52px;
  --font-ui:   'Rajdhani', sans-serif;
  --font-mono: 'Share Tech Mono', monospace;
  --font-deco: 'Orbitron', monospace;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: var(--font-ui);
}

/* ── TOPBAR ─────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  background: rgba(8,6,18,0.97);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.topbar__left  { display: flex; align-items: center; flex-shrink: 0; }
.topbar__center { flex: 1; display: flex; align-items: center; justify-content: center; }
.topbar__right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── BRAND ──────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 9px; user-select: none; }

.m8-logo {
  width: 34px; height: 34px;
  border: 1.5px solid rgba(240,165,0,0.45);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(240,165,0,0.06); flex-shrink: 0;
}
.m8-logo span {
  color: var(--gold); font-size: 12px; font-weight: 700;
  font-family: var(--font-deco); letter-spacing: -1px;
}

.brand-text { display: flex; flex-direction: column; gap: 2px; }
.brand-name {
  font-family: var(--font-deco);
  font-size: 15px; font-weight: 700; color: var(--gold);
  letter-spacing: 3px; display: flex;
}
.flip-char {
  display: inline-block; width: 13px; height: 20px;
  overflow: hidden; position: relative; line-height: 20px;
}
.flip-char-inner {
  position: absolute; left: 0; top: 0;
  display: flex; flex-direction: column;
}
.flip-char-inner span {
  display: block; height: 20px; line-height: 20px;
  font-family: var(--font-deco); font-size: 15px;
  font-weight: 700; color: var(--gold);
}
.brand-tagline {
  font-family: var(--font-mono);
  font-size: 9px; color: rgba(240,165,0,0.35); letter-spacing: 2.5px;
  opacity: 0; transition: opacity 300ms ease;
}
.brand-tagline.visible { opacity: 1; }

/* ── STUDIO TABS ────────────────────────────── */
.studio-tabs {
  display: flex; align-items: center; gap: 2px;
}

.studio-tab {
  padding: 6px 18px;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.12em;
  cursor: pointer;
  transition: all 180ms ease;
  white-space: nowrap;
}
.studio-tab:hover {
  color: rgba(240,165,0,0.7);
  border-color: rgba(240,165,0,0.2);
  background: rgba(240,165,0,0.04);
}
.studio-tab.active {
  color: var(--gold);
  border-color: rgba(240,165,0,0.4);
  background: rgba(240,165,0,0.08);
}

/* ── CREDITS PILL ───────────────────────────── */
.credits-pill {
  background: var(--gold2);
  border: 1px solid rgba(240,165,0,0.25);
  border-radius: 4px; padding: 3px 10px;
  display: flex; align-items: center; gap: 6px;
}
.credits-label { color: rgba(240,165,0,0.5); font-size: 12px; letter-spacing: 1px; font-family: var(--font-mono); }
.credits-value { color: var(--gold); font-size: 14px; font-weight: 600; font-family: var(--font-mono); }

/* ── USER AVATAR ────────────────────────────── */
.user-avatar-wrapper { position: relative; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(240,165,0,0.15); border: 1px solid rgba(240,165,0,0.3);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background 150ms;
}
.user-avatar:hover { background: rgba(240,165,0,0.25); }

.btn-login {
  background: var(--gold2); border: 1px solid var(--gold4);
  color: var(--gold); font-size: 13px; letter-spacing: 1.5px;
  padding: 4px 12px; border-radius: 4px; cursor: pointer;
  font-family: var(--font-ui); font-weight: 600;
  transition: background 150ms;
}
.btn-login:hover { background: rgba(240,165,0,0.15); }

/* ── MODULE IFRAME ──────────────────────────── */
.module-wrap {
  position: fixed;
  top: var(--topbar-h); left: 0; right: 0; bottom: 0;
}
.module-wrap iframe {
  width: 100%; height: 100%;
  border: none; display: block;
  background: var(--bg);
}

/* ── USER MENU ──────────────────────────────── */
.user-menu {
  display: none;
  position: fixed; top: calc(var(--topbar-h) + 6px); right: 14px;
  background: rgba(14,12,22,0.98);
  border: 1px solid rgba(240,165,0,0.2);
  border-radius: 8px; min-width: 200px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  z-index: 200;
  overflow: hidden;
}
.user-menu.open { display: block; }
.user-menu-header { padding: 12px 16px; }
.user-name  { color: var(--text); font-weight: 600; font-size: 14px; }
.user-email { color: var(--text-dim); font-size: 12px; margin-top: 2px; font-family: var(--font-mono); }
.user-menu-divider { height: 1px; background: rgba(240,165,0,0.12); }
.user-menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 16px;
  background: none; border: none;
  color: var(--text); font-size: 13px; font-family: var(--font-ui);
  cursor: pointer; transition: background 120ms; text-align: left;
}
.user-menu-item:hover { background: rgba(240,165,0,0.07); }
.user-menu-logout { color: rgba(255,80,80,0.85); }
.user-menu-logout:hover { background: rgba(255,60,60,0.08); }

/* ── AUTH MODAL ─────────────────────────────── */
.auth-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
  z-index: 500; align-items: center; justify-content: center;
}
.auth-modal-overlay.open { display: flex; }

.auth-modal-card {
  background: rgba(13,11,22,0.98);
  border: 1px solid rgba(240,165,0,0.25);
  border-radius: 12px; padding: 32px 28px 28px;
  width: 340px; position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 14px;
}
.auth-modal-accent {
  position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.auth-modal-logo {
  display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 4px;
}
.auth-m8-box {
  width: 40px; height: 40px;
  border: 2px solid rgba(240,165,0,0.5); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(240,165,0,0.07); margin-bottom: 4px;
}
.auth-m8-box span { color: var(--gold); font-family: var(--font-deco); font-size: 14px; font-weight: 700; letter-spacing: -1px; }
.auth-modal-brand { font-family: var(--font-deco); font-size: 18px; font-weight: 700; color: var(--gold); letter-spacing: 4px; }
.auth-modal-tagline { font-family: var(--font-mono); font-size: 9px; color: rgba(240,165,0,0.35); letter-spacing: 3px; }

.auth-btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 10px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.04); color: var(--text);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  cursor: pointer; transition: background 150ms;
}
.auth-btn-google:hover { background: rgba(255,255,255,0.09); }

.auth-modal-divider {
  text-align: center; color: var(--text-dim);
  font-size: 11px; font-family: var(--font-mono); letter-spacing: 2px;
  position: relative;
}
.auth-modal-divider::before,
.auth-modal-divider::after {
  content: ''; position: absolute; top: 50%;
  width: 36%; height: 1px; background: rgba(255,255,255,0.1);
}
.auth-modal-divider::before { left: 0; }
.auth-modal-divider::after  { right: 0; }

.auth-modal-fields { display: flex; flex-direction: column; gap: 8px; }
.auth-modal-input {
  width: 100%; padding: 9px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 5px;
  color: var(--text); font-family: var(--font-ui); font-size: 14px; outline: none;
  transition: border-color 150ms;
}
.auth-modal-input:focus { border-color: rgba(240,165,0,0.4); }

.auth-modal-error { color: #ff5555; font-size: 12px; font-family: var(--font-mono); min-height: 16px; }

.auth-modal-btn-row { display: flex; gap: 8px; }
.auth-modal-btn-primary {
  flex: 1; padding: 10px;
  background: rgba(240,165,0,0.12); border: 1px solid rgba(240,165,0,0.45);
  color: var(--gold); font-family: var(--font-mono); font-size: 13px; letter-spacing: 1px;
  border-radius: 5px; cursor: pointer; transition: background 150ms;
}
.auth-modal-btn-primary:hover { background: rgba(240,165,0,0.22); }
.auth-modal-btn-ghost {
  flex: 1; padding: 10px;
  background: none; border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-dim); font-family: var(--font-mono); font-size: 13px; letter-spacing: 1px;
  border-radius: 5px; cursor: pointer; transition: background 150ms;
}
.auth-modal-btn-ghost:hover { background: rgba(255,255,255,0.05); }

.auth-modal-toggle {
  text-align: center; font-size: 12px; color: var(--text-dim); font-family: var(--font-ui);
}
.auth-modal-toggle span { color: var(--gold); cursor: pointer; text-decoration: underline; }

.auth-modal-credits-note {
  display: flex; align-items: center; gap: 8px;
  background: rgba(240,165,0,0.06); border: 1px solid rgba(240,165,0,0.2);
  border-radius: 6px; padding: 8px 12px;
  font-size: 12px; color: var(--text-dim); font-family: var(--font-ui);
}
.auth-modal-spinner {
  height: 16px; text-align: center;
}
.auth-modal-spinner.active::after {
  content: ''; display: inline-block;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(240,165,0,0.2); border-top-color: var(--gold);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
