/* ============================================================
   Fan Selector - Estilos Globais
   Tema: Azul + Verde (moderno, profissional)
   ============================================================ */

/* ── Variaveis CSS ───────────────────────────────────────── */
:root {
  /* Cores primarias */
  --primary:        #1a5276;   /* Azul escuro */
  --primary-light:  #2e86c1;   /* Azul medio */
  --primary-xlight: #aed6f1;   /* Azul claro */
  --secondary:      #1e8449;   /* Verde escuro */
  --secondary-light:#27ae60;   /* Verde medio */
  --secondary-xlight:#a9dfbf;  /* Verde claro */

  /* Neutros */
  --bg-app:         #e0ecf2;   /* Fundo geral — FanTR azul claro */
  --bg-card:        #ffffff;   /* Fundo cards */
  --bg-sidebar:     #345a74;   /* Fundo sidebar/navbar — FanTR azul escuro */
  --border:         #c8d9e3;   /* Bordas — derivado do azul claro FanTR */

  /* Texto */
  --text-primary:   #1c2b3a;
  --text-secondary: #5d7083;
  --text-muted:     #8fa3b3;
  --text-sidebar:   #c8d6e3;
  --text-sidebar-active: #ffffff;

  /* Shadows — FanTR (aligned with tokens.css) */
  --shadow-sm:  0 1px 3px rgba(52, 90, 116, 0.08);
  --shadow-md:  0 2px 8px rgba(52, 90, 116, 0.12);
  --shadow-lg:  0 4px 16px rgba(52, 90, 116, 0.16);

  /* Layout — aligned with tokens.css */
  --sidebar-width:      230px;
  --navbar-height:      56px;
  --sidebar-collapsed:  70px;

  /* Transitions */
  --transition: all 0.25s ease;
}

/* ── Reset e Base ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── App Wrapper ─────────────────────────────────────────── */
#app-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Navbar ──────────────────────────────────────────────── */
.main-navbar {
  height: var(--navbar-height);
  background-color: var(--bg-sidebar) !important;
  border-bottom: none;
  box-shadow: 0 2px 8px rgba(52, 90, 116, 0.30);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 16px;
}

.main-navbar .container-fluid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0;
}

.navbar-page-title {
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
  margin-left: 12px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.navbar-divider {
  width: 1px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.25);
}

/* ── Seletor de idioma ───────────────────────────────────── */
.language-selector {
  display: flex;
  gap: 4px;
  align-items: center;
}

.lang-btn {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.40) !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 3px 8px !important;
  border-radius: 4px !important;
  transition: var(--transition) !important;
  min-width: 36px;
}

.lang-btn:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  border-color: rgba(255, 255, 255, 0.60) !important;
  color: #ffffff !important;
}

.lang-btn.active-lang,
.lang-btn.lang-active {
  background: #ffffff !important;
  border-color: #ffffff !important;
  color: #345a74 !important;
}

/* ── Info do usuario ─────────────────────────────────────── */
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  font-size: 22px;
  color: rgba(255, 255, 255, 0.85);
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: #ffffff;
}

.btn-login {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(255, 255, 255, 0.40) !important;
  color: #ffffff !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  padding: 5px 14px !important;
  border-radius: 6px !important;
  transition: var(--transition) !important;
}

.btn-login:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  border-color: rgba(255, 255, 255, 0.60) !important;
}

/* ── Main Container ──────────────────────────────────────── */
.main-container {
  display: flex;
  min-height: 100vh;
  padding-top: var(--navbar-height);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar-wrapper {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  flex-shrink: 0;
}

/* ── Page Content ────────────────────────────────────────── */
.page-content {
  flex: 1;
  min-width: 0;
  padding: 24px;
  overflow-y: auto;
  background-color: var(--bg-app);
}

/* Cards: definidos em assets/css/cards.css (Sub-fase 1.5c) */
/* Botões: definidos em assets/css/buttons.css (Sub-fase 1.5a) */
/* Inputs/selects/labels: definidos em assets/css/inputs.css (Sub-fase 1.5b) */

/* ── Badges de status ────────────────────────────────────── */
.badge-primary {
  background: var(--primary-xlight);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

.badge-success {
  background: var(--secondary-xlight);
  color: var(--secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}

/* ── Responsividade ──────────────────────────────────────── */
@media (max-width: 991px) {
  /* Sidebar oculto em portrait e landscape mobile/tablet até lg */
  .sidebar-wrapper {
    position: fixed;
    left: calc(-1 * var(--sidebar-width));
    top: var(--navbar-height);
    bottom: 0;
    z-index: 999;
    transition: var(--transition);
  }

  .sidebar-wrapper.open {
    left: 0;
  }
  /* Overlay semi-transparente quando sidebar aberto */
  .sidebar-wrapper.open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: -1;
  }

  .page-content {
    padding: 16px;
  }

  .user-name,
  .navbar-divider {
    display: none;
  }
}

@media (max-width: 576px) {
  .page-content {
    padding: 12px;
  }
}


/* ══════════════════════════════════════════════════════════════════
   FORM SECTIONS — Secoes internas do card Ponto de Operacao
   ══════════════════════════════════════════════════════════════════ */

.form-section {
  padding: 10px 0 8px 0;
}

/* form-section-label: definido em assets/css/inputs.css (Sub-fase 1.5b) */

.section-divider {
  margin: 4px 0 8px 0;
  border-color: rgba(6,124,177,0.15);
}

/* dropdown-inline-label: definido em assets/css/inputs.css (Sub-fase 1.5b) */

/* ══════════════════════════════════════════════════════════════════
   RODAPE DE ACOES — Linha de botoes na base do card
   ══════════════════════════════════════════════════════════════════ */

.card-footer-actions {
  border-top: 1px solid rgba(6,124,177,0.15);
  background: rgba(6,124,177,0.03);
  border-radius: 0 0 8px 8px;
  padding: 10px 16px;
}

.form-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-actions-side {
  flex: 1;
  display: flex;
  gap: 8px;
}

/* Botao CALCULAR */
.btn-calcular {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background-color: rgb(147,192,31);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 32px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s, box-shadow 0.18s;
  box-shadow: 0 2px 8px rgba(147,192,31,0.30);
  white-space: nowrap;
}

.btn-calcular:hover {
  background-color: rgb(130,172,25);
  box-shadow: 0 4px 14px rgba(147,192,31,0.40);
  transform: translateY(-1px);
}

.btn-calcular:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(147,192,31,0.25);
}

/* Input readonly (densidade calculada) */
.form-control-readonly {
  background-color: rgba(6,124,177,0.10) !important;
  color: var(--color-brand-blue) !important;
  font-weight: 700 !important;
  cursor: default;
}

/* ══════════════════════════════════════════════════════════════════
   STATUS BAR — base (layout); variantes em assets/css/alerts.css
   ══════════════════════════════════════════════════════════════════ */

.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-md);
  padding: 9px 16px;
  margin: 10px 0;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-left: 4px solid var(--color-info);  /* cor base — overridden pelas variantes */
  background-color: var(--color-info-bg);
  color: var(--color-brand-dark);
  transition: background var(--transition-base), border-color var(--transition-base);
}

.status-bar-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.status-bar-text {
  line-height: 1.4;
}



/* AG-Grid: migrado para assets/css/aggrid.css (Sub-fase 1.6a) */

/* Tabs: definidas em assets/css/tabs.css (Sub-fase 1.5c) */

/* ── Plotly: permitir anotações fora da área de plot ────────── */
.js-plotly-plot .svg-container,
.js-plotly-plot .main-svg {
    overflow: visible !important;
}
/* Permitir overflow no card que contém gráficos */
.card-modern.card-graficos {
    overflow: visible !important;
}

/* ── Aviso de rotação (toast portrait, apenas aba gráficos) ─────── */
.aviso-rotacao-overlay {
    display: none;
    position: fixed;
    top: auto;    /* CSS defensivo — Sub-fase 1.6d removeu inset:0 de graphs_responsive.css */
    right: auto;  /* idem */
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: rgba(0, 40, 80, 0.90);
    color: #fff;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    text-align: center;
    padding: 0.65rem 1.1rem;
    border-radius: 40px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.35);
    pointer-events: all;
    white-space: nowrap;
    max-width: 92vw;
}
@media screen and (max-width: 767px) and (orientation: portrait) {
    .aviso-rotacao-overlay.graficos-ativos {
        display: flex !important;
    }
}
.aviso-rotacao-overlay.dismissed {
    display: none !important;
}
.aviso-rotacao-fechar {
    background: rgba(255,255,255,0.22);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}
.aviso-rotacao-fechar:hover {
    background: rgba(255,255,255,0.4);
}
