/* Portal do cliente — visual glass (referência Bootstrap + Inter) */
:root {
  --bg-main: #0b0c10;
  --bg-surface: #1f2833;
  --accent-color: #6c5ce7;
  --accent-hover: #a29bfe;
  --text-primary: #f8f9fa;
  --text-muted: #8b9bb4;
}

.hidden {
  display: none !important;
}

/* Hard guard: nunca mostrar login e dashboard juntos */
#login-card.hidden,
#dashboard-card.hidden {
  display: none !important;
}

#login-card:not(.hidden) {
  display: flex;
  align-items: center;
  justify-content: center;
}

#dashboard-card:not(.hidden) {
  display: block;
}

.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

body.portal-client {
  font-family: "Inter", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

.login-bs-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-bs-wrap .glass-card {
  max-width: 520px;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: rgba(31, 40, 51, 0.4);
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.brand-logo {
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: linear-gradient(45deg, #6c5ce7, #00cec9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Sidebar nav: sobrescreve Bootstrap .nav-link apenas aqui */
nav.sidebar .nav-link {
  color: var(--text-muted);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: all 0.2s;
  font-weight: 500;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
}

nav.sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

nav.sidebar .nav-link.active {
  background: linear-gradient(90deg, rgba(108, 92, 231, 0.2) 0%, transparent 100%);
  border-left: 3px solid var(--accent-color);
  color: #fff;
}

nav.sidebar .nav-link.nav-parent-bs.active {
  color: #fff;
}

.nav-sub-tv .nav-link.is-active {
  background: rgba(108, 92, 231, 0.15);
  border-left: 2px solid var(--accent-color);
  color: #fff;
}

.nav-sub-admin .nav-link.is-active {
  background: rgba(108, 92, 231, 0.15);
  border-left: 2px solid var(--accent-color);
  color: #fff;
}

.main-content {
  margin-left: 280px;
  padding: 2rem;
  transition: margin-left 0.3s ease;
}

.glass-card {
  background: rgba(31, 40, 51, 0.6);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-gradient {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border: none;
  color: white;
  font-weight: 600;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  transition: opacity 0.2s;
}

.btn-gradient:hover {
  opacity: 0.9;
  color: white;
}

.btn-outline-glass {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 500;
  border-radius: 8px;
}

.btn-outline-glass:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.info-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.info-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
}

.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  backdrop-filter: blur(3px);
}

.mobile-overlay.show {
  display: block;
}

.promo-vip-glow {
  width: 150px;
  height: 150px;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.45) 0%, transparent 70%);
  transform: translate(30%, -30%);
  pointer-events: none;
}

.portal-main-header {
  border-bottom-color: rgba(255, 255, 255, 0.12) !important;
}

/* Loja embutida (sem iframe): área rolável */
.vip-shop-host {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.35);
  min-height: min(86vh, 960px);
  max-height: none;
}

/* VIP embutido no portal: navegação só pela sidebar */
#view-vipshop .top,
#view-vipshop .tabs {
  display: none !important;
}

#view-vipshop #panel-home {
  display: none !important;
}

#nav-group-tv.is-expanded .nav-tv-chev {
  transform: rotate(90deg);
}

.nav-tv-chev {
  transition: transform 0.2s ease;
}

#nav-group-admin.is-expanded .nav-admin-chev {
  transform: rotate(90deg);
}

.nav-admin-chev {
  transition: transform 0.2s ease;
}

.portal-client #feedback {
  color: var(--text-muted);
}

.portal-client .toast {
  z-index: 1100;
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
}

/* ——— Tema claro ——— */
[data-bs-theme="light"] body.portal-client {
  --bg-main: #f4f6f9;
  --text-primary: #1a1d23;
  --text-muted: #5c6578;
  background-color: var(--bg-main);
  color: var(--text-primary);
}

[data-bs-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.85);
  border-right-color: rgba(0, 0, 0, 0.08);
}

[data-bs-theme="light"] nav.sidebar .nav-link {
  color: #5c6578;
}

[data-bs-theme="light"] nav.sidebar .nav-link.active {
  color: #1a1d23;
}

[data-bs-theme="light"] .glass-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.08);
}

[data-bs-theme="light"] .info-value {
  color: #1a1d23;
}

[data-bs-theme="light"] .btn-outline-glass {
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
}

[data-bs-theme="light"] .btn-outline-glass:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-primary);
}

[data-bs-theme="light"] .form-control.bg-dark {
  background-color: var(--bs-body-bg) !important;
  color: var(--bs-body-color) !important;
  border-color: var(--bs-border-color) !important;
}

[data-bs-theme="light"] .portal-main-header {
  border-bottom-color: rgba(0, 0, 0, 0.1) !important;
}

/* ——— Admin (portal) ——— */
.admin-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.admin-table th,
.admin-table td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
  font-size: 0.8125rem;
}

.admin-table th {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}

[data-bs-theme="light"] .admin-table th,
[data-bs-theme="light"] .admin-table td {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.admin-cell-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.admin-cell-subtitle {
  margin-top: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.admin-inline-editor {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-width: 240px;
}

.admin-inline-editor .form-control {
  font-size: 0.8125rem;
}

.admin-device-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.state-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.6875rem;
  font-weight: 700;
}

.state-pill.is-online {
  color: #b7ffe5;
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(16, 185, 129, 0.15);
}

.state-pill.is-offline {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(239, 68, 68, 0.13);
}

.state-pill.is-active {
  color: #c9ffea;
  border-color: rgba(16, 185, 129, 0.5);
  background: rgba(5, 150, 105, 0.2);
}

.state-pill.is-inactive {
  color: #e6eeff;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(71, 85, 105, 0.3);
}

[data-bs-theme="light"] .state-pill.is-online {
  color: #047857;
}

[data-bs-theme="light"] .state-pill.is-offline {
  color: #b91c1c;
}

[data-bs-theme="light"] .state-pill.is-active {
  color: #065f46;
}

[data-bs-theme="light"] .state-pill.is-inactive {
  color: #475569;
}

.admin-standalone-wrap {
  min-height: 100vh;
  padding: 1.25rem 1.25rem 2.5rem;
}

.admin-standalone-inner {
  max-width: 1500px;
  margin: 0 auto;
  width: 100%;
}

.admin-provisioning .form-control {
  font-size: 0.86rem;
}

.admin-provisioning .btn {
  min-width: 140px;
}
