/* ============================================================
   CGI - Custom CSS  |  Central de Monitoramento
   ============================================================ */

/* ---------- Fontes & Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body, .content-wrapper {
  font-family: 'Inter', sans-serif !important;
  background: #0d1117 !important;
}

/* ---------- Paleta de cores CGI ---------- */
:root {
  --cgi-bg:         #0d1117;
  --cgi-surface:    #161b27;
  --cgi-surface2:   #1e2538;
  --cgi-border:     rgba(255,255,255,0.07);
  --cgi-primary:    #3b82f6;
  --cgi-danger:     #ef4444;
  --cgi-warning:    #f59e0b;
  --cgi-success:    #10b981;
  --cgi-info:       #06b6d4;
  --cgi-purple:     #8b5cf6;
  --cgi-text:       #e2e8f0;
  --cgi-muted:      #64748b;
  --cgi-glow:       rgba(59,130,246,0.25);
}

/* ---------- Login Page ---------- */
.cgi-login-page {
  background: var(--cgi-bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.cgi-login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
  top: -200px; right: -200px;
  border-radius: 50%;
  animation: pulseGlow 4s ease-in-out infinite;
}

.cgi-login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(239,68,68,0.1) 0%, transparent 70%);
  bottom: -150px; left: -150px;
  border-radius: 50%;
  animation: pulseGlow 5s ease-in-out infinite reverse;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50%       { transform: scale(1.1); opacity: 1; }
}

.cgi-login-box {
  background: var(--cgi-surface);
  border: 1px solid var(--cgi-border);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.5), 0 0 40px var(--cgi-glow);
  position: relative;
  z-index: 2;
  animation: slideUp 0.6s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cgi-login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.cgi-login-logo .logo-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  margin-bottom: 1rem;
  box-shadow: 0 10px 30px rgba(59,130,246,0.4);
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.cgi-login-logo h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--cgi-text);
  margin: 0;
  letter-spacing: 3px;
}

.cgi-login-logo p {
  color: var(--cgi-muted);
  font-size: 0.78rem;
  letter-spacing: 2px;
  margin-top: 0.3rem;
}

.cgi-input-group {
  position: relative;
  margin-bottom: 1.2rem;
}

.cgi-input-group label {
  display: block;
  color: var(--cgi-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.cgi-input-group .input-wrapper {
  position: relative;
}

.cgi-input-group .input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cgi-muted);
  font-size: 0.9rem;
  z-index: 1;
}

.cgi-input-group input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: var(--cgi-surface2);
  border: 1px solid var(--cgi-border);
  border-radius: 10px;
  color: var(--cgi-text);
  font-size: 0.95rem;
  transition: all 0.3s;
  outline: none;
}

.cgi-input-group input:focus {
  border-color: var(--cgi-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
  background: var(--cgi-surface);
}

.cgi-btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 0.5rem;
  position: relative;
  overflow: hidden;
}

.cgi-btn-login::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.cgi-btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(59,130,246,0.45);
}

.cgi-btn-login:hover::before { opacity: 1; }

/* ---------- Sidebar ---------- */
.cgi-sidebar {
  background: linear-gradient(180deg, #0f1623 0%, #161b27 100%) !important;
  border-right: 1px solid var(--cgi-border);
}

.cgi-brand {
  background: linear-gradient(135deg, #0d1117, #1a1f2e) !important;
  border-bottom: 1px solid var(--cgi-border) !important;
  padding: 0.8rem 1rem !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.8rem;
}

.brand-icon-box {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #1d2535, #2d3561);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: 1px solid rgba(239,68,68,0.3);
}

.cgi-user-panel {
  border-bottom: 1px solid var(--cgi-border) !important;
  padding: 0.8rem 1rem !important;
}

/* Fix: nome do usuário na sidebar não deve ser cortado */
.cgi-user-panel .info {
  overflow: visible !important;
  min-width: 0;
  flex: 1;
}
.cgi-user-panel .info a,
.cgi-user-panel .info > a.d-block {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: unset !important;
  word-break: break-word;
  line-height: 1.3;
  font-size: 0.85rem;
}

.user-avatar-mini {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--cgi-primary), var(--cgi-purple));
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.75rem;
  margin-right: 5px;
}

.user-avatar-sidebar {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--cgi-primary), var(--cgi-purple));
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
}

.cgi-status-box {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: var(--cgi-success);
  box-shadow: 0 0 8px var(--cgi-success);
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active {
  background: linear-gradient(135deg, rgba(59,130,246,0.2), rgba(139,92,246,0.15)) !important;
  color: #fff !important;
  border-left: 3px solid var(--cgi-primary);
}

.nav-sidebar .nav-link {
  color: rgba(255,255,255,0.65) !important;
  transition: all 0.25s !important;
  border-radius: 8px !important;
  margin: 2px 8px !important;
}

.nav-sidebar .nav-link:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.07) !important;
}

/* ---------- Navbar ---------- */
.main-header.navbar {
  background: linear-gradient(135deg, #0f1623, #161b27) !important;
  border-bottom: 1px solid var(--cgi-border) !important;
  box-shadow: 0 2px 20px rgba(0,0,0,0.3) !important;
}

/* ---------- Content ---------- */
.content-wrapper {
  background: var(--cgi-bg) !important;
}

.content-header {
  padding: 1.2rem 1.5rem 0 !important;
}

.content-header h1 {
  color: var(--cgi-text) !important;
  font-weight: 700;
  font-size: 1.4rem;
}

/* ---------- Cards / Widgets ---------- */
.card {
  background: var(--cgi-surface) !important;
  border: 1px solid var(--cgi-border) !important;
  border-radius: 14px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25) !important;
  color: var(--cgi-text) !important;
  transition: transform 0.25s, box-shadow 0.25s !important;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.35) !important;
}

.card-header {
  background: transparent !important;
  border-bottom: 1px solid var(--cgi-border) !important;
  color: var(--cgi-text) !important;
  font-weight: 600;
  border-radius: 14px 14px 0 0 !important;
}

.card-body { color: var(--cgi-text) !important; }

/* Stat cards */
.stat-card {
  border-radius: 16px !important;
  overflow: hidden;
  position: relative;
}

.stat-card .stat-icon {
  width: 60px; height: 60px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--cgi-text);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--cgi-muted);
  margin-top: 4px;
}

.stat-card .card-body {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-card .bg-blue   { background: rgba(59,130,246,0.15); color: #60a5fa; }
.stat-card .bg-red    { background: rgba(239,68,68,0.15);  color: #f87171; }
.stat-card .bg-green  { background: rgba(16,185,129,0.15); color: #34d399; }
.stat-card .bg-yellow { background: rgba(245,158,11,0.15); color: #fbbf24; }
.stat-card .bg-purple { background: rgba(139,92,246,0.15); color: #a78bfa; }

.stat-card-blue   { border-left: 4px solid var(--cgi-primary) !important; }
.stat-card-red    { border-left: 4px solid var(--cgi-danger) !important; }
.stat-card-green  { border-left: 4px solid var(--cgi-success) !important; }
.stat-card-yellow { border-left: 4px solid var(--cgi-warning) !important; }
.stat-card-purple { border-left: 4px solid var(--cgi-purple) !important; }

/* ---------- Tables ---------- */
.table {
  color: var(--cgi-text) !important;
}

.table thead th {
  background: var(--cgi-surface2) !important;
  color: var(--cgi-muted) !important;
  border: none !important;
  font-size: 0.72rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 0.85rem 1rem !important;
}

.table tbody tr {
  border-bottom: 1px solid var(--cgi-border) !important;
  transition: background 0.2s;
}

.table tbody tr:hover {
  background: rgba(255,255,255,0.03) !important;
}

.table td {
  vertical-align: middle !important;
  border: none !important;
  padding: 0.7rem 1rem !important;
  color: var(--cgi-text) !important;
}

/* ---------- Badges & Status ---------- */
.badge { font-size: 0.72rem; padding: 4px 8px; border-radius: 6px; font-weight: 600; }

.badge-prioridade-BAIXA   { background: rgba(16,185,129,0.15); color: #34d399; }
.badge-prioridade-MEDIA   { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.badge-prioridade-ALTA    { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.badge-prioridade-CRITICA { background: rgba(239,68,68,0.2);    color: #f87171; animation: flashCrit 1s infinite; }

@keyframes flashCrit {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

.badge-status-ABERTA        { background: rgba(239,68,68,0.15);    color: #f87171; }
.badge-status-EM_ATENDIMENTO{ background: rgba(245,158,11,0.15);   color: #fbbf24; }
.badge-status-ENCERRADA     { background: rgba(16,185,129,0.15);   color: #34d399; }
.badge-status-ARQUIVADA     { background: rgba(100,116,139,0.15);  color: #94a3b8; }

/* ---------- Buttons ---------- */
.btn-cgi-primary {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  border: none; color: white;
  border-radius: 8px; padding: 8px 18px;
  font-weight: 600; font-size: 0.85rem;
  transition: all 0.25s;
}
.btn-cgi-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59,130,246,0.4);
  color: white;
}

.btn-cgi-danger {
  background: linear-gradient(135deg, #b91c1c, #ef4444);
  border: none; color: white;
  border-radius: 8px; padding: 8px 18px;
  font-weight: 600; font-size: 0.85rem;
  transition: all 0.25s;
}
.btn-cgi-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239,68,68,0.4);
  color: white;
}

/* ---------- Forms ---------- */
.form-control {
  background: var(--cgi-surface2) !important;
  border: 1px solid var(--cgi-border) !important;
  color: var(--cgi-text) !important;
  border-radius: 8px !important;
  padding: 10px 14px !important;
  transition: border-color 0.25s, box-shadow 0.25s !important;
}

.form-control:focus {
  border-color: var(--cgi-primary) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2) !important;
  background: var(--cgi-surface) !important;
  color: var(--cgi-text) !important;
}

.form-control option { background: var(--cgi-surface2); }

.form-group label {
  color: var(--cgi-muted) !important;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 5px;
}

/* ---------- Footer ---------- */
.cgi-footer {
  background: var(--cgi-surface) !important;
  border-top: 1px solid var(--cgi-border) !important;
  color: var(--cgi-muted) !important;
  font-size: 0.82rem;
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
  background: transparent !important;
}
.breadcrumb-item a { color: var(--cgi-primary) !important; }
.breadcrumb-item.active { color: var(--cgi-muted) !important; }

/* ---------- Chart containers ---------- */
.chart-container {
  position: relative;
  min-height: 250px;
}

/* ---------- Timeline ---------- */
.cgi-timeline {
  padding: 0;
  list-style: none;
  position: relative;
}

.cgi-timeline::before {
  content: '';
  position: absolute;
  left: 18px; top: 0; bottom: 0;
  width: 2px;
  background: var(--cgi-border);
}

.cgi-timeline-item {
  position: relative;
  padding-left: 50px;
  margin-bottom: 1.2rem;
}

.cgi-timeline-icon {
  position: absolute;
  left: 0; top: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border: 2px solid var(--cgi-surface);
}

.cgi-timeline-body {
  background: var(--cgi-surface2);
  border: 1px solid var(--cgi-border);
  border-radius: 10px;
  padding: 10px 14px;
}

.cgi-timeline-time {
  color: var(--cgi-muted);
  font-size: 0.75rem;
}

/* ---------- Utility ---------- */
.text-cgi-muted { color: var(--cgi-muted) !important; }
.text-cgi-primary { color: var(--cgi-primary) !important; }
.bg-cgi-surface { background: var(--cgi-surface) !important; }
.bg-cgi-surface2 { background: var(--cgi-surface2) !important; }

.section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--cgi-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* Spinner */
.cgi-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Alert override */
.alert {
  border-radius: 10px !important;
  border: none !important;
  font-size: 0.88rem;
}

/* Select2 dark theme */
.select2-container--default .select2-selection--single {
  background: var(--cgi-surface2) !important;
  border: 1px solid var(--cgi-border) !important;
  border-radius: 8px !important;
  height: 42px !important;
  color: var(--cgi-text) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--cgi-text) !important;
  line-height: 42px !important;
}

.select2-dropdown {
  background: var(--cgi-surface2) !important;
  border: 1px solid var(--cgi-border) !important;
}

.select2-results__option {
  color: var(--cgi-text) !important;
}

.select2-results__option--highlighted {
  background: var(--cgi-primary) !important;
}

/* Fix: Select2 não deve truncar o texto selecionado */
.select2-container {
  width: 100% !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--cgi-text) !important;
  line-height: 40px !important;
  padding-left: 12px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.select2-container--default .select2-selection--single {
  height: 42px !important;
}

/* Fix: <select> nativo — corrige corte vertical do texto/emojis */
select.form-control {
  height: auto !important;          /* permite crescer com o conteúdo */
  min-height: calc(2.25rem + 2px); /* baseline igual ao Bootstrap */
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  line-height: 1.5 !important;
  overflow: visible;
}

/* Fix: opções dentro do select com texto completo */
select.form-control option {
  white-space: normal;
  word-wrap: break-word;
}


/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cgi-bg); }
::-webkit-scrollbar-thumb { background: var(--cgi-surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--cgi-primary); }

/* Responsive */
@media (max-width: 768px) {
  .stat-card .stat-value { font-size: 1.5rem; }
  .cgi-login-box { margin: 1rem; padding: 1.5rem; }
}

/* Fix para textos longos no dropdown sendo cortados */
.dropdown-menu .dropdown-item {
  white-space: normal !important;
  word-wrap: break-word;
  line-height: 1.4;
  padding-top: 8px;
  padding-bottom: 8px;
}
