/**
 * Duskara Hub — layout central dinâmico, lobby vivo, admin integrado
 */

.lobby-center {
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  background: #0a0a0f;
}

.dsk-hub-tabs {
  display: flex;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem 0;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  background: linear-gradient(180deg, rgba(30, 27, 45, 0.95), rgba(13, 13, 18, 0.9));
  z-index: 2;
}

.dsk-hub-tab {
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: rgba(180, 180, 200, 0.7);
  cursor: pointer;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}

.dsk-hub-tab:hover {
  color: #e8e0f0;
  background: rgba(139, 92, 246, 0.12);
}

.dsk-hub-tab--on {
  color: #d4af37;
  background: rgba(75, 42, 103, 0.45);
  box-shadow: 0 -2px 12px rgba(139, 92, 246, 0.25);
}

.dsk-main-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
  background:
    radial-gradient(ellipse 80% 50% at 50% 100%, rgba(75, 42, 103, 0.25), transparent 55%),
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(139, 92, 246, 0.08), transparent),
    linear-gradient(180deg, #0c0c12 0%, #12121a 100%);
  transition: filter 0.25s ease, opacity 0.25s ease;
}

.dsk-main-view--out {
  opacity: 0;
  filter: blur(6px);
}

.dsk-main-view--in {
  animation: dsk-view-in 0.32s ease forwards;
}

@keyframes dsk-view-in {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

.dsk-view-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  gap: 0.75rem;
  color: rgba(180, 180, 200, 0.8);
  font-size: 0.85rem;
}

.dsk-view-loading-rune {
  font-size: 2rem;
  animation: dsk-rune-spin-slow 3s linear infinite;
  color: #8b5cf6;
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

@keyframes dsk-rune-spin-slow {
  to {
    transform: rotate(360deg);
  }
}

.dsk-view-header {
  padding: 0.65rem 0.85rem 0.35rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
  margin-bottom: 0.5rem;
}

.dsk-view-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.dsk-muted,
.dsk-hub-welcome {
  color: rgba(160, 160, 180, 0.85);
  font-size: 0.8rem;
  margin: 0.25rem 0 0;
}

/* —— Sidebar perfil —— */
.dsk-char-identity {
  text-align: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.dsk-profile-hit {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.25rem;
  cursor: pointer;
  border-radius: 8px;
  transition: box-shadow 0.2s, background 0.2s;
}

.dsk-profile-hit:hover {
  background: rgba(139, 92, 246, 0.12);
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.25);
}

.dsk-profile-hit .char-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid rgba(212, 175, 55, 0.5);
  object-fit: cover;
  margin: 0 auto 0.35rem;
  display: block;
}

.dsk-profile-hit .char-name {
  font-family: var(--dsk-font-title, 'Cinzel', Georgia, serif);
  letter-spacing: 0.04em;
}

.dsk-mail-id {
  margin: 0.1rem 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: rgba(212, 175, 55, 0.9);
  font-family: var(--dsk-font-body, 'Segoe UI', system-ui, sans-serif);
  text-align: center;
}

.btn-sidebar-profile {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.72rem;
  border-radius: 6px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: rgba(75, 42, 103, 0.35);
  color: #e8e0f0;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.btn-sidebar-profile:hover {
  background: rgba(139, 92, 246, 0.25);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
}

/* —— Lobby hub vivo —— */
.dsk-hub-lobby {
  position: relative;
  min-height: 100%;
  padding: 0.5rem 0.65rem 1rem;
  overflow: hidden;
}

.dsk-hub-lobby-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(10, 10, 15, 0.7) 70%),
    radial-gradient(ellipse 90% 30% at 50% 95%, rgba(60, 45, 90, 0.4), transparent);
  opacity: 0.35;
  pointer-events: none;
}

.dsk-hub-lobby-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 80%, rgba(139, 92, 246, 0.15), transparent 60%);
}

.dsk-hub-lobby-fog {
  position: absolute;
  inset: -10%;
  background: radial-gradient(ellipse at 30% 50%, rgba(120, 100, 160, 0.12), transparent 50%);
  animation: dsk-fog-drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes dsk-fog-drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(2%, -1%) scale(1.05);
  }
}

.dsk-hub-lobby-inner {
  position: relative;
  z-index: 1;
}

.dsk-hub-lobby-head {
  margin-bottom: 0.75rem;
}

.dsk-hub-lobby-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.35rem;
}

.dsk-alive-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

@media (max-width: 1100px) {
  .dsk-alive-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .dsk-alive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .dsk-alive-grid {
    grid-template-columns: 1fr;
  }
}

.dsk-alive-grid .lobby-slot-card {
  animation: dsk-card-idle 4s ease-in-out infinite;
  animation-delay: calc(var(--slot-i, 0) * 0.15s);
}

@keyframes dsk-card-idle {
  0%,
  100% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 rgba(139, 92, 246, 0);
  }
  50% {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 12px rgba(139, 92, 246, 0.15);
  }
}

.dsk-alive-grid .lobby-slot-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.55),
    0 0 24px color-mix(in srgb, var(--slot-accent, #8b5cf6) 40%, transparent),
    inset 0 0 20px rgba(255, 255, 255, 0.04);
  z-index: 3;
}

.dsk-alive-grid .lobby-slot-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 45%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.dsk-alive-grid .lobby-slot-card:hover::before {
  opacity: 1;
}

/* Esconder painéis antigos e workspace overlay quando hub ativo */
body.dsk-hub-active #game-tabs-nav,
body.dsk-hub-active #lobby-admin-slot-wrap {
  display: none !important;
}

body.dsk-hub-active .lobby-center-scroll .game-tab-panel {
  display: none !important;
}

body.dsk-hub-active #admin-workspace.admin-workspace:not(.admin-workspace--legacy),
body.dsk-hub-active #settings-modal {
  display: none !important;
}

body.dsk-hub-active .house-modal:not(.house-modal--allow) {
  visibility: hidden;
  pointer-events: none;
  position: fixed;
  left: -9999px;
}

/* Inline modules */
.dsk-inline-module {
  padding: 0.5rem 0.65rem 1rem;
  min-height: 100%;
  animation: dsk-view-in 0.28s ease;
}

.dsk-inline-profile .dsk-profile-host {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.dsk-inline-settings {
  max-width: 480px;
  margin: 0 auto;
  padding: 0.5rem 0.75rem 1rem;
}

.dsk-inline-settings .settings-section {
  margin-bottom: 1rem;
}

/* Admin integrado */
.dsk-admin-root {
  min-height: 100%;
  padding: 0.35rem 0.5rem 1rem;
}

.dsk-admin-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 0.55rem;
  min-height: calc(100% - 60px);
}

.dsk-admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.45rem;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 8px;
  background: rgba(13, 13, 18, 0.85);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.dsk-admin-nav-btn {
  text-align: left;
  padding: 0.4rem 0.5rem;
  font-size: 0.72rem;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: rgba(200, 200, 220, 0.85);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.dsk-admin-nav-btn:hover,
.dsk-admin-nav-btn--on {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.35);
  color: #f0e8ff;
}

.dsk-admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 8px;
  background: rgba(13, 13, 18, 0.75);
  backdrop-filter: blur(8px);
}

.dsk-admin-module-title {
  margin: 0;
  padding: 0.45rem 0.65rem;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(139, 92, 246, 0.15);
  color: #d4af37;
}

.dsk-admin-module-host {
  flex: 1;
  min-height: 320px;
  overflow: auto;
  padding: 0.5rem;
}

/* Chat atmosférico */
body.dsk-hub-active .lobby-sidebar-right .chat-panel {
  background: linear-gradient(180deg, rgba(22, 20, 32, 0.95), rgba(10, 10, 14, 0.98));
}

body.dsk-hub-active .chat-messages {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  margin: 0.25rem;
  padding: 0.35rem;
}

body.dsk-hub-active .chat-msg {
  padding: 0.35rem 0.4rem;
  margin-bottom: 0.25rem;
  border-radius: 6px;
  background: rgba(20, 18, 30, 0.6);
  border-left: 2px solid rgba(139, 92, 246, 0.35);
}

body.dsk-hub-active .chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.4);
  object-fit: cover;
}

body.dsk-hub-active .chat-msg-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.15rem;
  font-size: 0.72rem;
}

body.dsk-hub-active .chat-msg-body {
  font-size: 0.78rem;
  line-height: 1.35;
}

/* Footer compacto + Sons UI integrado */
body.dsk-hub-active .lobby-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  min-height: 0;
  flex-shrink: 0;
}

body.dsk-hub-active .lobby-footer-tagline {
  flex: 1;
  text-align: center;
  font-size: 0.68rem;
  margin: 0;
}

body.dsk-hub-active .dsk-footer-tools {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

body.dsk-hub-active .dsk-sound-toggle {
  position: static;
  bottom: auto;
  left: auto;
  opacity: 0.85;
  font-size: 0.68rem;
  padding: 0.2rem 0.45rem;
  margin: 0;
}

@media (max-width: 900px) {
  .dsk-admin-layout {
    grid-template-columns: 1fr;
  }
  .dsk-admin-nav {
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
  }
}

/* Hub no celular — grade do reino legível */
@media (max-width: 1023px) {
  .dsk-hub-tab {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.72rem;
    padding: 0.45rem 0.7rem;
  }

  .dsk-hub-lobby-head h2 {
    font-size: 1.15rem;
  }

  .dsk-alive-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    padding: 0 0.15rem;
  }

  .dsk-alive-grid .lobby-slot-card {
    min-height: 4.25rem;
    aspect-ratio: 2.2 / 1;
  }

  .char-panel--mobile-sheet {
    margin: 0;
    padding: 0.5rem 0.65rem 1rem;
    max-height: none;
    overflow: visible;
  }

  .chat-panel--in-sheet {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
  }
}
