/* Dashboard MegaAds - Tema alinhado à logo (azul, branco, preto) */

:root {
  /* Cores da logo MegaAds */
  --mega-primary: #285EFF;
  --mega-primary-dark: #1A41CC;
  --mega-blue: #0066FF;
  --mega-dark: #0A0A0A;
  --mega-sidebar-bg: #000000;
  --mega-sidebar-hover: #1a1a1a;
  --mega-sidebar-active: rgba(40, 94, 255, 0.2);
  --mega-success: #38a169;
  --mga-card-radius: 12px;
  --mga-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --mga-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
  --sidebar-width: 260px;
}

/* Bootstrap overrides - cores da marca */
.bg-primary { background-color: var(--mega-primary) !important; }
.btn-primary { background-color: var(--mega-primary) !important; border-color: var(--mega-primary) !important; }
.btn-primary:hover { background-color: var(--mega-primary-dark) !important; border-color: var(--mega-primary-dark) !important; }
.text-primary { color: var(--mega-primary) !important; }
a { color: var(--mega-primary); }
a:hover { color: var(--mega-primary-dark); }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(160deg, #f0f4f8 0%, #e2e8f0 100%);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* Cards de comentários – fundo claro do dashboard, fonte e ícones bem visíveis */
.comment-card-original {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--mga-card-radius);
  padding: 1.25rem 1.5rem;
  position: relative;
  box-shadow: var(--mga-shadow);
}
.comment-card-original .comment-card-avatar {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  background: rgba(40, 94, 255, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mega-primary);
  font-size: 1.35rem;
}
.comment-card-original .comment-card-text {
  color: #212529;
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 1rem;
  word-break: break-word;
  font-weight: 500;
}
@media (min-width: 576px) {
  .comment-card-original .comment-card-text { font-size: 1.2rem; margin-bottom: 1.25rem; }
}
.comment-card-original .comment-card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem 0.75rem;
  font-size: 1rem;
}
@media (min-width: 576px) {
  .comment-card-original .comment-card-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; font-size: 1.05rem; }
}
.comment-card-original .comment-card-grid-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #495057;
  line-height: 1.4;
}
.comment-card-original .comment-card-grid-item .comment-card-icon {
  width: 1.35rem;
  height: 1.35rem;
  font-size: 1.35rem;
  flex-shrink: 0;
  color: var(--mega-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.comment-card-original .comment-card-grid-item .comment-card-label {
  font-weight: 600;
  flex-shrink: 0;
  color: #212529;
}
.comment-card-original .comment-card-grid-item a {
  color: var(--mega-primary);
  word-break: break-all;
  font-weight: 500;
}
.comment-card-original .comment-card-grid-item a:hover {
  text-decoration: underline;
}
.comment-card-original .comment-card-link-row {
  grid-column: 1 / -1;
}
/* Ícone de anexo: canto inferior direito, maior, sem aumentar o tamanho do card (position absolute, fora do fluxo) */
.comment-card-original .comment-card-attachment-badge {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 10px;
  background: rgba(40, 94, 255, 0.12);
  border: 1px solid rgba(40, 94, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mega-primary);
  font-size: 1.75rem;
}
.comment-card-original .comment-card-attachment-badge i {
  font-size: 1.75rem;
}
.comment-card-original .comment-card-thumb {
  max-width: 120px;
  max-height: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 0.5rem;
  cursor: pointer;
}
@media (min-width: 576px) {
  .comment-card-original .comment-card-flex { gap: 1rem; }
  .comment-card-original { padding: 1.5rem; }
}

/* Tela de login / cadastro - tela inteira, dois painéis */
#auth-overlay {
  box-sizing: border-box;
}

.auth-screen {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.auth-screen--twopanel {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  min-height: 100vh;
}

.auth-panel-left {
  width: 42%;
  min-height: 100vh;
  height: 100%;
  background: linear-gradient(160deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  box-sizing: border-box;
}

.auth-panel-logo {
  height: 44px;
  filter: brightness(0) invert(1);
  opacity: 0.95;
  margin-bottom: 0.75rem;
}

.auth-panel-tagline {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 3rem;
}

.auth-illustration-wrap {
  width: 100%;
  max-width: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-panel-icon {
  font-size: 10rem;
  color: rgba(255, 255, 255, 0.25);
}

.auth-panel-right {
  flex: 1;
  min-height: 100vh;
  height: 100%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  box-sizing: border-box;
}

.auth-form-wrap {
  width: 100%;
  max-width: 380px;
}

.auth-form-wrap--hidden {
  display: none;
}

.auth-panel-form {
  width: 100%;
}

.auth-panel-title {
  color: #1e293b;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 2rem;
}

.auth-label {
  display: block;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.auth-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 1.25rem;
}

.auth-input:focus {
  border-color: var(--mega-primary);
  box-shadow: 0 0 0 3px rgba(40, 94, 255, 0.12);
  outline: none;
}

.auth-options-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.auth-remember-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-remember-label {
  margin: 0;
  font-size: 0.9rem;
  color: #64748b;
  cursor: pointer;
}

.auth-checkbox {
  margin: 0;
}

.auth-forgot-link {
  font-size: 0.9rem;
  color: var(--mega-primary);
  text-decoration: none;
}

.auth-forgot-link:hover {
  text-decoration: underline;
  color: var(--mega-primary-dark);
}

.auth-error-msg {
  font-size: 0.85rem;
  color: #dc2626;
  margin-bottom: 0.75rem;
  min-height: 1.25rem;
}

.auth-submit-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.auth-signup-text {
  text-align: center;
  font-size: 0.95rem;
  color: #64748b;
  margin: 0;
}

.auth-register-link {
  color: var(--mega-primary);
  font-weight: 500;
  text-decoration: none;
}

.auth-register-link:hover {
  text-decoration: underline;
  color: var(--mega-primary-dark);
}

@media (max-width: 768px) {
  .auth-screen--twopanel {
    flex-direction: column;
  }
  .auth-panel-left {
    width: 100%;
    min-height: 28vh;
    padding: 2rem 1rem;
  }
  .auth-panel-tagline {
    margin-bottom: 1.5rem;
  }
  .auth-panel-icon {
    font-size: 4rem;
  }
  .auth-panel-right {
    padding: 2rem 1.5rem;
  }
}

/* Container principal: sidebar + conteúdo */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Menu lateral */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--mega-sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1030;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
}

.sidebar-brand {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.sidebar-brand img {
  max-width: 100%;
  height: auto;
  max-height: 56px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.sidebar-nav .nav-link {
  color: rgba(255, 255, 255, 0.85);
  padding: 0.75rem 1.25rem;
  margin: 0.125rem 0.75rem;
  border-radius: 10px;
  font-weight: 500;
  display: flex;
  align-items: center;
  transition: background 0.2s, color 0.2s;
}

.sidebar-nav .nav-link:hover {
  background: var(--mega-sidebar-hover);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--mega-sidebar-active);
  color: var(--mega-primary);
}

.sidebar-nav .nav-link i {
  font-size: 1.2rem;
  margin-right: 0.75rem;
  width: 24px;
  text-align: center;
}

.sidebar-brand .sidebar-tagline {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Área de conteúdo (deslocada pela sidebar) */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 1rem 1.5rem 2rem;
}

/* Cabeçalho interno da página */
.page-header {
  margin-bottom: 0.75rem;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a202c;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-header h1 i {
  color: var(--mega-primary);
}

/* Painel de filtros */
.filter-panel {
  background: #fff;
  border-radius: var(--mga-card-radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--mga-shadow);
  margin-bottom: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.filter-panel .form-label {
  font-weight: 600;
  color: #4a5568;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
}

/* Cards */
.card {
  border-radius: var(--mga-card-radius) !important;
  border: none !important;
  box-shadow: var(--mga-shadow) !important;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--mga-shadow-hover) !important;
}

.card-header {
  font-weight: 600;
  color: #2d3748;
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
  padding: 0.75rem 1rem;
  border-radius: var(--mga-card-radius) var(--mga-card-radius) 0 0 !important;
}

.card-header i {
  color: var(--mega-primary);
}

/* Gráficos: altura fixa para sempre aparecerem */
.card-body .js-plotly-plot,
.card-body .plotly,
.card-body .plot-container {
  min-height: 380px !important;
  height: 380px !important;
}
.card-body .graph-container {
  min-height: 380px !important;
}

/* Abas principais (Dashboard | Perdas) */
.nav-tabs-custom .nav-link {
  font-weight: 600;
  color: #4a5568;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 0.75rem 1.25rem;
}
.nav-tabs-custom .nav-link:hover {
  color: var(--mega-primary);
}
.nav-tabs-custom .nav-link.active {
  color: var(--mega-primary);
  background: transparent;
  border-bottom-color: var(--mega-primary);
}
.nav-tabs-custom .nav {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

/* Cards de métrica: espaço à direita e embaixo do número (não aumentar em cima) */
.metric-card .card-body {
  padding-top: 0.85rem;
  padding-left: 1rem;
  padding-right: 1.75rem;
  padding-bottom: 1rem;
}
.metric-card .card-body .metric-card-value,
.metric-card .card-body .h4 {
  font-size: 1.28rem !important;
  line-height: 1.3;
  min-height: 1.6rem;
  margin-bottom: 0;
}
.metric-card .card-body .text-muted.small {
  font-size: 0.82rem !important;
}
.metric-card-header {
  flex-wrap: nowrap;
  gap: 0.5rem;
}
.metric-card-header .metric-variation-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.metric-variation-positive {
  background: rgba(56, 161, 105, 0.15);
  color: #2f855a;
}
.metric-variation-negative {
  background: rgba(229, 62, 62, 0.12);
  color: #c53030;
}

/* Gráficos Plotly */
.js-plotly-plot .main-svg {
  border-radius: 8px;
}

/* Dropdowns */
.Select-control {
  border-radius: 8px !important;
}

/* Mobile: sidebar colapsável (opcional, mantém conteúdo usável) */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 72px;
  }

  .sidebar-brand .sidebar-tagline,
.sidebar-brand span.text-muted,
  .sidebar-nav .nav-link span:not(.bi),
  .sidebar-footer {
    display: none !important;
  }

  .sidebar-brand img {
    max-height: 44px;
  }

  .sidebar-nav .nav-link {
    justify-content: center;
    padding: 0.75rem;
  }

  .sidebar-nav .nav-link i {
    margin-right: 0;
  }

  .main-content {
    padding: 1rem;
  }
}

@media (max-width: 576px) {
  .filter-panel {
    padding: 1rem;
  }
}

/* Skeleton screens */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.06) 0%,
    rgba(0, 0, 0, 0.12) 50%,
    rgba(0, 0, 0, 0.06) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  border-radius: 6px;
}

.skeleton-dropdown {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.06) 0%,
    rgba(0, 0, 0, 0.12) 50%,
    rgba(0, 0, 0, 0.06) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.skeleton-card {
  pointer-events: none;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Loading dos filtros: overlay discreto */
.skeleton-loading-wrapper ._dash-loading {
  margin: 0;
  padding: 0.25rem 0;
}
.skeleton-loading-wrapper ._dash-loading .loading-spinner {
  margin: 0.25rem auto;
}

/* Espaçamento entre gráficos */
.chart-row {
  margin-bottom: 1.75rem;
}
.chart-row .chart-col {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}
@media (min-width: 992px) {
  .chart-row .chart-col:first-child {
    padding-right: 0.5rem;
  }
  .chart-row .chart-col:last-child {
    padding-left: 0.5rem;
  }
}
.chart-card {
  margin-bottom: 0;
  border-radius: var(--mga-card-radius, 12px);
}

/* Blocos de seção: evita sobreposição entre Métricas e Lost */
.metrics-section-block {
  display: block;
  overflow: visible;
  min-height: 6rem; /* reserva espaço para a linha de 7 cards */
}
.lost-section-block {
  display: block;
  clear: both;
  margin-top: 2.75rem;
  padding-top: 0;
}

/* Métricas Principais: 7 cards em uma única linha */
@media (min-width: 992px) {
  .metrics-row-single.row {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    min-height: 1px;
  }
  .metrics-row-single.row > [class*="col"] {
    flex: 1 1 0% !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .metrics-row-single.row > [class*="col"] > div {
    flex: 1 1 0 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
  }
  .metrics-row-single .metric-card {
    flex: 1 1 0 !important;
    min-height: 6rem !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .metrics-row-single .metric-card .card-body {
    flex: 1 1 0 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    padding-top: 1.1rem !important;
    padding-bottom: 1.25rem !important;
  }
  .metrics-row-single .metric-card .card-body .h4 {
    min-height: 1.6rem;
  }
  /* Perdas de Impressões: 3 cards */
  .impression-share-row.row > [class*="col"] {
    display: flex;
    flex-direction: column;
  }
  .impression-share-row .metric-card {
    flex: 1 1 0;
    min-height: 4.5rem;
    display: flex;
    flex-direction: column;
  }
  .impression-share-row .metric-card .card-body .h4 {
    min-height: 1.6rem;
  }
}
/* Card de métrica: seleção do valor com destaque discreto (evita azul sólido) */
.metric-card .h4::selection {
  background: rgba(40, 94, 255, 0.15);
  color: inherit;
}
