/* ── SHARED BASE: sidebar, topbar, modal, form elements ──
   Used by: worlds.html, app.html
   Landing has its own nav/modal — see landing.css
── */

html, body { height: 100%; overflow: hidden; }

/* Remove 300ms tap delay on mobile for all interactive elements */
a, button, [role="button"], input, select, textarea, label {
  touch-action: manipulation;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  display: flex;
  height: 100dvh;
  transition: background var(--transition), color var(--transition);
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100dvh;
  overflow: hidden;
  transition: background var(--transition);
}

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-mark {
  width: 30px; height: 30px;
  border: 1.5px solid var(--sidebar-accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--sidebar-accent);
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--sidebar-accent);
  letter-spacing: 0.1em;
}

.sidebar-section { padding: 16px 10px 4px; }

.sidebar-label,
.sidebar-section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sidebar-text);
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 400;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
}
.sidebar-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.sidebar-item.active { background: var(--sidebar-active); color: var(--sidebar-text-active); }
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--sidebar-accent);
  border-radius: 0 2px 2px 0;
}

.sidebar-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-bottom {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.07);
  margin-top: auto;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition);
}
.user-row:hover { background: var(--sidebar-hover); }

.user-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8B4513, #C4782A);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 12px; font-weight: 500; color: var(--sidebar-text-active); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan { font-size: 10px; color: var(--sidebar-text); }

.theme-mini { display: flex; gap: 4px; padding: 0 8px; margin-bottom: 10px; }

.lang-mini { display: flex; gap: 5px; padding: 0 8px; margin-bottom: 8px; }
.lang-btn-mini {
  flex: 1;
  background: var(--sidebar-hover);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 6px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 500;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.lang-btn-mini:hover  { color: var(--sidebar-text-active); background: var(--sidebar-active); }
.lang-btn-mini.active { color: var(--sidebar-text-active); background: var(--sidebar-active); border-color: rgba(255,255,255,0.1); }
.theme-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition);
}
.theme-dot.active { border-color: var(--sidebar-accent); }
.td-light { background: #F5F2ED; }
.td-dark  { background: #171310; }
.td-pink  { background: #F8EDF3; }
.td-blood { background: radial-gradient(circle at 35% 35%, #3A0808, #080808); border-color: rgba(200,20,20,0.55) !important; }

/* ── MAIN CONTAINER ── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── TOPBAR ── */
.topbar {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
  flex: 1;
}

.topbar-sub { font-size: 12px; color: var(--text3); }

/* ── SHARED PAGE SCROLL ── */
.page-scroll { flex: 1; overflow-y: auto; padding: 24px 28px; }
.page-scroll::-webkit-scrollbar { width: 4px; }
.page-scroll::-webkit-scrollbar-track { background: transparent; }
.page-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── MODAL (shared base) ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  position: relative;
  transform: translateY(16px);
  transition: transform var(--transition);
  box-shadow: 0 32px 80px rgba(0,0,0,0.25);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 28px; height: 28px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--text3);
  transition: all var(--transition);
  line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--bg3); }

/* ── FORM ELEMENTS ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 7px;
}

.form-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text3); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text3);
  font-family: var(--font-ui);
  font-size: 12px;
}
.form-divider::before, .form-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-google {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition);
}
.btn-google:hover { background: var(--bg3); color: var(--text); border-color: var(--accent); }

.form-terms {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text3);
  text-align: center;
  margin-top: 14px;
  line-height: 1.5;
}
.form-terms a { color: var(--accent); text-decoration: none; }

/* ── SHARED BUTTONS ── */
.btn-ghost-small {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.btn-ghost-small:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary-small {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary-small:hover { background: var(--accent2); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: var(--surface);
  border: 2px dashed var(--border2);
  border-radius: var(--radius-lg);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-title { font-family: var(--font-display); font-size: 16px; color: var(--text2); margin-bottom: 6px; }
.empty-desc { font-size: 13px; color: var(--text3); margin-bottom: 18px; }

/* ── WORLD GRADIENT BACKGROUNDS ── */
.wg-dark   { background: linear-gradient(135deg,#1A0F08 0%,#3D1C0C 60%,#0E0C0A 100%); }
.wg-blue   { background: linear-gradient(135deg,#0A1520 0%,#1A3040 60%,#080E18 100%); }
.wg-pink   { background: linear-gradient(135deg,#3A1528 0%,#6A2848 60%,#2A0E1C 100%); }
.wg-purple { background: linear-gradient(135deg,#1A1A2E 0%,#2D2D4E 60%,#0E0E1C 100%); }
.wg-green  { background: linear-gradient(135deg,#0D2010 0%,#1A4020 60%,#081408 100%); }
.wg-gold   { background: linear-gradient(135deg,#1E1205 0%,#3C2410 60%,#120C02 100%); }
.wg-red    { background: linear-gradient(135deg,#200808 0%,#401010 60%,#140404 100%); }
.wg-teal   { background: linear-gradient(135deg,#081820 0%,#103040 60%,#041018 100%); }
.wg-rose   { background: linear-gradient(135deg,#F0C8DC 0%,#C880A8 60%,#E0A0C0 100%); }
.wg-blood  { background: linear-gradient(135deg,#1A0000 0%,#3D0808 60%,#0E0000 100%); }
.wg-gray   { background: linear-gradient(135deg,#141414 0%,#282828 60%,#0A0A0A 100%); }
.wg-cyan   { background: linear-gradient(135deg,#041818 0%,#083030 60%,#021010 100%); }
.wg-neon   { background: linear-gradient(135deg,#0A0020 0%,#1A0040 60%,#060010 100%); }
.wg-orange { background: linear-gradient(135deg,#1A0A00 0%,#3D2000 60%,#0E0800 100%); }
.wg-black  { background: linear-gradient(135deg,#080808 0%,#101010 60%,#040404 100%); }
.wg-warm   { background: linear-gradient(135deg,#1A1008 0%,#2D1E10 60%,#100C06 100%); }

.ic-dark  { background: linear-gradient(135deg,#1A0F08,#3d1c0c); }
.ic-blue  { background: linear-gradient(135deg,#0a1520,#1a3040); }
.ic-pink  { background: linear-gradient(135deg,#f0c8dc,#c880a8); }

/* ── HAMBURGER + MOBILE SIDEBAR OVERLAY ── */

/* Hidden on desktop by default */
.hamburger-btn {
  display: none;
  position: fixed;
  top: 8px; left: 8px;
  z-index: 210;
  width: 36px; height: 36px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text2);
  font-size: 17px;
  cursor: pointer;
  align-items: center; justify-content: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
  transition: all var(--transition);
}
.hamburger-btn:hover { border-color: var(--accent); color: var(--text); }
.sidebar-open .hamburger-btn { display: none; }

.sidebar-mobile-close {
  display: none;
  margin-left: auto;
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: var(--sidebar-text);
  width: 26px; height: 26px;
  font-size: 13px;
  cursor: pointer;
  align-items: center; justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-mobile-close:hover { color: var(--sidebar-text-active); border-color: rgba(255,255,255,0.3); }

.mobile-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.mobile-sidebar-backdrop.open { display: block; }

/* ── RESPONSIVE BASE (sidebar + topbar) ── */
@media (max-width: 768px) {
  .hamburger-btn        { display: flex; }
  .sidebar-mobile-close { display: flex; }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 4px 0 32px rgba(0,0,0,0.28);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  /* Main fills full width when sidebar is out of flow */
  .main { width: 100%; }

  .topbar { padding: 0 16px 0 54px; }
  .topbar-sub { display: none; }

  .page-scroll { padding: 16px; }
}
