/* Premium dashboard — inspired by modern analytics UI */

:root {
  --premium-purple: #6b2d7a;
  --premium-purple-dark: #4a1f54;
  --premium-bg: #f4f4f4;
  --premium-card: #ffffff;
  --premium-text: #1a1a2e;
  --premium-muted: #6c757d;
  --premium-border: #e8e8e8;
  --premium-shadow: 0 2px 12px rgba(26, 26, 46, 0.06);
  --premium-radius: 10px;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--premium-bg) !important;
  color: var(--premium-text);
  margin: 0;
  min-height: 100vh;
}

.premium-page {
  min-height: 100vh;
  background-color: var(--premium-bg);
  padding-bottom: 3rem;
}

/* Top navigation bar */
.premium-topbar {
  background: linear-gradient(135deg, var(--premium-purple) 0%, var(--premium-purple-dark) 100%);
  color: #fff;
  padding: 0.75rem 2rem 0;
  box-shadow: 0 4px 20px rgba(74, 31, 84, 0.25);
}

.premium-topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.5rem;
}

.premium-logo {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
}

.premium-logo span {
  font-weight: 400;
  opacity: 0.85;
  font-size: 0.95rem;
  margin-left: 0.35rem;
}

.premium-topbar-badge {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.9;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

/* Dash tabs inside top bar */
.premium-tabs-wrap {
  max-width: 1400px;
  margin: 0 auto;
  border-bottom: none;
}

.premium-tabs-wrap .dash-tabs {
  border-bottom: none !important;
}

.premium-tabs-wrap .tab-parent,
.premium-tabs-wrap [class*="tab-parent"] {
  background: transparent !important;
}

/* Dash dcc.Tabs: support multiple class naming schemes */
.premium-tabs-wrap .tab,
.premium-tabs-wrap .dash-tab,
.premium-tabs-wrap [role="tab"] {
  color: rgba(255, 255, 255, 0.82) !important;
  border: none !important;
  padding: 0.65rem 1rem !important;
  font-size: 0.9rem;
  font-weight: 500;
  background: transparent !important;
  margin-right: 0.15rem;
  border-radius: 6px 6px 0 0 !important;
}

.premium-tabs-wrap .tab:hover,
.premium-tabs-wrap .dash-tab:hover,
.premium-tabs-wrap [role="tab"]:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

.premium-tabs-wrap .tab--selected,
.premium-tabs-wrap .tab.selected,
.premium-tabs-wrap .dash-tab--selected,
.premium-tabs-wrap [role="tab"][aria-selected="true"] {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.14) !important;
  border-bottom: 3px solid #fff !important;
  border-radius: 6px 6px 0 0 !important;
}

.premium-tabs-wrap .tab-container--selected,
.premium-tabs-wrap .dash-tab--selected {
  border-bottom: none !important;
}

/* Main content area */
.premium-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 0;
}

/* Elevated cards */
.premium-card {
  background: var(--premium-card);
  border-radius: var(--premium-radius);
  box-shadow: var(--premium-shadow);
  border: 1px solid var(--premium-border);
  overflow: hidden;
}

/* Sidebar filters: do not clip dcc.Dropdown (react-select) menus */
.premium-card.premium-filters-card,
.premium-card.premium-filters-card .card-body {
  overflow: visible;
}

.premium-main .premium-filters-col {
  overflow: visible;
  position: relative;
  z-index: 20;
}

/* Menu layer above main charts (react-select used by dcc.Dropdown) */
.premium-filters-card .Select-menu-outer {
  z-index: 5000 !important;
}

.premium-card .card-body {
  padding: 1.35rem 1.5rem;
}

.premium-card h5,
.premium-card .card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--premium-text);
  letter-spacing: -0.01em;
}

/* Metric tiles */
.premium-metric {
  background: var(--premium-card);
  border-radius: var(--premium-radius);
  box-shadow: var(--premium-shadow);
  border: 1px solid var(--premium-border);
  padding: 1.25rem 1.35rem;
  height: 100%;
}

.premium-metric-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--premium-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.premium-metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--premium-text);
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.premium-metric-sub {
  font-size: 0.8rem;
  color: var(--premium-muted);
  margin-top: 0.35rem;
}

/* Chart panels — minimal padding so the plot uses the card width */
.premium-chart-panel {
  background: var(--premium-card);
  border-radius: var(--premium-radius);
  box-shadow: var(--premium-shadow);
  border: 1px solid var(--premium-border);
  padding: 0.2rem 0.1rem 0.1rem;
  margin-bottom: 0.75rem;
}

.premium-chart-panel .dash-graph,
.premium-chart-panel .js-plotly-plot {
  width: 100% !important;
}

.premium-tab-content {
  margin-top: 1.5rem;
}

/* Auth UI */
.premium-user-profile {
  max-width: 1400px;
  margin: -0.25rem auto 1rem auto;
  padding: 0 1.5rem;
}

/* Profile chip in purple top bar (demo + prod) */
.premium-user-profile--topbar {
  margin: 0 !important;
  padding: 0 !important;
  max-width: min(320px, 42vw);
}

.premium-topbar-actions {
  justify-content: flex-end;
}

.premium-topbar .premium-user-profile--topbar .premium-user-profile-inner {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.38);
  backdrop-filter: blur(8px);
}

.premium-topbar .premium-user-profile--topbar .premium-user-profile-name {
  color: #fff !important;
}

.premium-topbar .premium-user-profile--topbar .premium-user-profile-sub {
  color: rgba(255, 255, 255, 0.88) !important;
}

.premium-user-profile-inner {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  padding: 0.45rem 1rem 0.45rem 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.premium-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--premium-purple) 0%, var(--premium-purple-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(74, 31, 84, 0.22);
}

.premium-user-avatar-initial {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  user-select: none;
}

.premium-user-text-block {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
  text-align: left;
}

.premium-user-profile-muted {
  color: rgba(26, 26, 46, 0.65);
  font-size: 0.9rem;
}

.premium-user-profile-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--premium-text);
  line-height: 1.25;
}

.premium-user-profile-sub {
  font-size: 0.78rem;
  color: var(--premium-muted);
  line-height: 1.2;
  word-break: break-all;
}

/* Admin table */
.premium-admin-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(26, 26, 46, 0.7);
  font-weight: 700;
}

/* Login card + full-page sign-in */
.premium-login-page .premium-login-body {
  min-height: calc(100vh - 120px);
  background: linear-gradient(
    180deg,
    rgba(107, 45, 122, 0.06) 0%,
    var(--premium-bg) 45%
  );
}

.premium-login-heading {
  color: var(--premium-text);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.premium-login-card {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--premium-shadow);
  border: 1px solid var(--premium-border);
}

.premium-login-btn {
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.55rem 1rem;
  border-radius: 8px;
}

.premium-logout-btn {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.55) !important;
  font-size: 0.75rem;
}

.premium-logout-btn:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
}

/* Dropdowns inside sidebar */
.premium-card .Select-control {
  border-radius: 8px !important;
  border-color: var(--premium-border) !important;
}

/* Remove default container padding clash */
.premium-main.container-fluid {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* MessageVerse floating assistant (all tabs) */
.mv-floating-root {
  position: fixed;
  inset: 0;
  z-index: 1080;
  pointer-events: none;
}

.mv-floating-root .mv-fab-stack,
.mv-floating-root .mv-floating-panel-wrap,
.mv-floating-root .toast {
  pointer-events: auto;
}

.mv-fab-stack {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 1082;
}

.mv-fab-notification-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 11px;
  height: 11px;
  background: #e53935;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  z-index: 3;
}

.mv-fab-btn {
  border-radius: 999px !important;
  padding: 0.45rem 1rem 0.45rem 0.45rem !important;
  background: linear-gradient(135deg, var(--premium-purple) 0%, var(--premium-purple-dark) 100%) !important;
  border: none !important;
  color: #fff !important;
  max-width: min(300px, calc(100vw - 2rem));
  text-align: left;
}

.mv-fab-btn:hover {
  color: #fff !important;
  filter: brightness(1.06);
}

.mv-fab-monogram {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: -0.04em;
  flex-shrink: 0;
  color: #fff;
}

.mv-fab-title {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.25;
}

.mv-fab-sub {
  font-size: 0.7rem;
  opacity: 0.92;
  font-weight: 400;
  line-height: 1.2;
}

.mv-floating-panel-wrap {
  position: fixed;
  bottom: 5.25rem;
  right: 1.25rem;
  width: min(520px, calc(100vw - 2rem));
  z-index: 1081;
}

.mv-floating-card {
  border-radius: var(--premium-radius) !important;
  max-height: min(82vh, 880px);
  overflow: hidden;
}

.mv-floating-card .card-body {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: min(78vh, 820px);
}

/* MessageVerse chart: reserve vertical space so Plotly is not squashed */
.mv-floating-card .mv-chart-section {
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
}

.mv-floating-card .mv-chart-section.mv-chart-section--compact {
  min-height: 88px;
  height: 88px;
}

.mv-floating-card .mv-chart-section.mv-chart-section--expanded {
  min-height: 300px;
  height: clamp(300px, 44vh, 460px);
}

.mv-floating-card .mv-chart-section.mv-chart-section--compact .dash-graph,
.mv-floating-card .mv-chart-section.mv-chart-section--compact .js-plotly-plot,
.mv-floating-card .mv-chart-section.mv-chart-section--compact .plot-container.plotly {
  height: 88px !important;
  min-height: 88px !important;
}

.mv-floating-card .mv-chart-section.mv-chart-section--expanded .dash-graph,
.mv-floating-card .mv-chart-section.mv-chart-section--expanded .js-plotly-plot,
.mv-floating-card .mv-chart-section.mv-chart-section--expanded .plot-container.plotly {
  height: 100% !important;
  min-height: 280px !important;
}

.mv-floating-card .mv-messageverse-loading > div {
  min-height: inherit;
}

/* MessageVerse suggested questions: readable rows, no stacked/overlapping options */
.mv-preset-dropdown .Select-menu-outer {
  z-index: 10060 !important;
}

.mv-preset-dropdown .Select-menu {
  max-height: min(380px, 55vh) !important;
}

.mv-floating-card .mv-preset-dropdown .Select-control {
  min-height: 3rem !important;
  height: auto !important;
  align-items: center;
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
}

.mv-floating-card .mv-preset-dropdown .Select-value,
.mv-floating-card .mv-preset-dropdown .Select-placeholder {
  line-height: 1.45 !important;
  white-space: normal !important;
  word-break: break-word !important;
  padding-top: 0.15rem;
  padding-bottom: 0.15rem;
}

.mv-floating-card .mv-preset-dropdown .Select-value-label,
.mv-floating-card .mv-preset-dropdown .Select-placeholder {
  max-width: 100%;
}

.mv-preset-dropdown .Select-option {
  padding: 0.65rem 0.75rem !important;
  line-height: 1.4 !important;
  white-space: normal !important;
  word-break: break-word !important;
  min-height: 2.75rem !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mv-preset-dropdown .VirtualizedSelectGrid__innerScrollContainer > div {
  position: relative !important;
}
