/* ============================================================
   PAEBES – SRE Linhares  |  Tema azul #1E3A5F
   ============================================================ */

:root {
  --primary:        #1E3A5F;
  --primary-hover:  #2B5282;
  --primary-light:  #EBF4FF;
  --accent:         #27AE60;
  --accent-dark:    #1E8449;
  --bg:             #F0F4F8;
  --card:           #FFFFFF;
  --border:         #E2E8F0;
  --text:           #2D3748;
  --text-muted:     #718096;
  --sidebar-w:      250px;
  --topbar-h:       56px;
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.09);
  --radius:         10px;
  --transition:     0.18s ease;
  --abaixo-basico:  #FC5454;
  --basico:         #F6A623;
  --proficiente:    #67C23A;
  --avancado:       #409EFF;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app-wrapper { display: flex; height: 100vh; overflow: hidden; }

/* ── sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--primary);
  color: white;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}

.brand-title {
  display: block;
  font-size: 1rem; font-weight: 700;
  letter-spacing: 0.3px; line-height: 1.2;
}

.brand-sub {
  display: block;
  font-size: 0.7rem; opacity: 0.65; line-height: 1.3;
}

.sidebar-divider { border-color: rgba(255,255,255,0.12); margin: 0.5rem 1rem; }

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0.75rem;
  display: flex; flex-direction: column; gap: 2px;
}

.sidebar-link {
  display: flex; align-items: center;
  padding: 0.6rem 0.875rem;
  border-radius: 8px;
  color: rgba(255,255,255,0.78) !important;
  text-decoration: none !important;
  font-size: 0.875rem; font-weight: 500;
  transition: background var(--transition), color var(--transition);
  gap: 0.5rem;
}

.sidebar-link:hover { background: rgba(255,255,255,0.12); color: white !important; }

.sidebar-link.active {
  background: rgba(255,255,255,0.18);
  color: white !important; font-weight: 600;
}

.sidebar-link i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar.perfil-leitura .insercao-only { display: none !important; }

/* ── sidebar footer ───────────────────────────────────────── */
.sidebar-footer {
  padding: 0.875rem 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}

.sidebar-user { display: flex; align-items: center; gap: 0.625rem; }

.sidebar-avatar {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.875rem; flex-shrink: 0;
}

.sidebar-user-info { display: flex; flex-direction: column; overflow: hidden; }

.sidebar-user-name {
  font-size: 0.8rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: white;
}

.sidebar-user-badge { font-size: 0.65rem; align-self: flex-start; margin-top: 2px; }

/* ── main wrapper ─────────────────────────────────────────── */
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ── topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--primary);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.topbar-title { font-size: 0.975rem; font-weight: 600; color: rgba(255,255,255,0.92); letter-spacing: 0.2px; }

.topbar-actions .btn { font-size: 0.8rem; border-color: rgba(255,255,255,0.4); color: rgba(255,255,255,0.85); }
.topbar-actions .btn:hover { background: rgba(255,255,255,0.1); color: white; border-color: rgba(255,255,255,0.7); }

/* ── page content ─────────────────────────────────────────── */
.page-content { flex: 1; overflow-y: auto; padding: 1.75rem 2rem; background: var(--bg); }

/* ── page header ──────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }

.page-title { font-size: 1.5rem; font-weight: 700; color: var(--primary); margin: 0 0 0.25rem; line-height: 1.3; }

.page-subtitle { color: var(--text-muted); font-size: 0.875rem; margin: 0; }

/* ── cards ────────────────────────────────────────────────── */
.card { border: 1px solid var(--border); border-radius: var(--radius) !important; box-shadow: var(--shadow-sm); }

/* ── filtros ──────────────────────────────────────────────── */
.filter-card { background: var(--card); border-left: 4px solid var(--primary) !important; }

.filter-label {
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; display: block;
}

/* ── dropdown Dash ────────────────────────────────────────── */
.dash-dropdown .Select-control { border-radius: 8px !important; border-color: var(--border) !important; font-size: 0.875rem; }
.dash-dropdown .Select-control:hover { border-color: #A0AEC0 !important; }
.dash-dropdown .is-focused .Select-control { border-color: #4299E1 !important; box-shadow: 0 0 0 3px rgba(66,153,225,0.15) !important; }
.dash-dropdown .Select-placeholder { color: #A0AEC0; }
.dash-dropdown .Select-menu-outer { border-radius: 8px; box-shadow: var(--shadow-md); border-color: var(--border); z-index: 9999; }
.Select-option,
.VirtualizedSelectOption {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
}
.Select-value-label {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* ── KPI cards ────────────────────────────────────────────── */
.kpi-card { border-radius: var(--radius) !important; border: 1px solid var(--border) !important; transition: box-shadow var(--transition); }
.kpi-card:hover { box-shadow: var(--shadow-md) !important; }
.kpi-card-body { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem !important; }

.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.kpi-blue   { background: #EBF8FF; color: #2B6CB0; }
.kpi-indigo { background: #EBF4FF; color: #434190; }
.kpi-green  { background: #F0FFF4; color: #276749; }
.kpi-red    { background: #FFF5F5; color: #C53030; }

.kpi-body { flex: 1; min-width: 0; }
.kpi-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 2px; }
.kpi-value { font-size: 1.65rem; font-weight: 700; color: var(--primary); margin: 0; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── abas ─────────────────────────────────────────────────── */
.page-tabs .nav-link { color: var(--text-muted); font-weight: 500; font-size: 0.875rem; border-radius: 8px 8px 0 0; padding: 0.6rem 1.25rem; border: 1px solid transparent; transition: color var(--transition), background var(--transition); }
.page-tabs .nav-link:hover { color: var(--primary); background: rgba(30,58,95,0.05); }
.page-tabs .nav-link.active { color: var(--primary) !important; font-weight: 600; background: white; border-color: var(--border) var(--border) white; }

/* ── radio group ──────────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-item { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; cursor: pointer; padding: 6px 10px; border-radius: 6px; transition: background var(--transition); }
.radio-item:hover { background: var(--primary-light); }
.radio-input { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

/* ── upload zone ──────────────────────────────────────────── */
.upload-zone { border: 2px dashed #CBD5E0 !important; border-radius: var(--radius) !important; background: #FAFBFC; padding: 2.5rem 1.5rem; text-align: center; cursor: pointer; transition: border-color var(--transition), background var(--transition); }
.upload-zone:hover { border-color: var(--primary) !important; background: var(--primary-light); }

/* ── DataTable ────────────────────────────────────────────── */
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner th {
  background-color: var(--primary) !important;
  color: white !important;
  font-size: 12px; font-weight: 600; padding: 8px 12px;
}

/* linha de filtro */
.dash-spreadsheet-inner tr.dash-filter th {
  background-color: #EBF4FF !important;
  padding: 4px 6px !important;
  border-bottom: 2px solid var(--border) !important;
}
.dash-spreadsheet-inner .dash-filter input[type="text"],
.dash-spreadsheet-inner .dash-filter input {
  background-color: #FFFFFF !important;
  color: var(--text) !important;
  border: 1px solid #A0AEC0 !important;
  border-radius: 4px !important;
  font-size: 12px !important;
  padding: 4px 8px !important;
  height: 28px !important;
  width: calc(100% - 28px) !important;
  box-sizing: border-box !important;
}
.dash-spreadsheet-inner .dash-filter input:focus {
  border-color: #4299E1 !important;
  outline: none !important;
  box-shadow: 0 0 0 2px rgba(66,153,225,0.2) !important;
}
/* botão de modo do filtro (=, contains…) */
.dash-spreadsheet-inner .dash-filter .column-filter-button {
  background: var(--primary) !important;
  color: white !important;
  border: none !important;
  border-radius: 4px !important;
  width: 24px !important; height: 24px !important;
  font-size: 10px !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}

.dash-table-container input[type="text"] { font-size: 12px; border-radius: 4px; border: 1px solid var(--border); padding: 4px 8px; }

/* ── sliders ──────────────────────────────────────────────── */
.rc-slider-track  { background-color: var(--primary) !important; }
.rc-slider-handle { border-color: var(--primary) !important; }
.rc-slider-handle:hover { border-color: var(--primary-hover) !important; }
.rc-slider-handle:active { box-shadow: 0 0 0 4px rgba(30,58,95,0.2) !important; }

/* ── scrollbar ────────────────────────────────────────────── */
.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-track { background: transparent; }
.page-content::-webkit-scrollbar-thumb { background: #CBD5E0; border-radius: 3px; }
.page-content::-webkit-scrollbar-thumb:hover { background: #A0AEC0; }

/* ── responsividade ───────────────────────────────────────── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .sidebar { position: fixed; left: -250px; transition: left 0.3s ease; z-index: 200; width: 250px; }
  .sidebar.open { left: 0; }
  .main-wrapper { width: 100%; }
  .page-content { padding: 1rem; }
}

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow-md  { box-shadow: var(--shadow-md) !important; }
._dash-loading-callback { opacity: 0.4; transition: opacity 0.3s; }
