/*
 ╔══════════════════════════════════════════════════════════════════╗
 ║  SGEAC — themes.css                                             ║
 ║  Sistema de temas com variáveis CSS                             ║
 ╚══════════════════════════════════════════════════════════════════╝
*/

/* ── Tema Padrão (Azul Corporativo) ── */
:root {
  --primary: #0078d4;
  --primary-dark: #005a9e;
  --primary-light: #cce4f6;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active: #0078d4;
  --header-bg: #ffffff;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #6c757d;
  --font-size-base: 14px;
  --card-radius: 10px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ═══════════════════════════════════════════════════════════
   BASE — aplica variáveis a todos os elementos
   ═══════════════════════════════════════════════════════════ */

body {
  font-size: var(--font-size-base);
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s, color 0.3s;
}

/* Sidebar */
.sidebar {
  background: var(--sidebar-bg) !important;
  transition: background 0.3s;
}

.logo h2,
.logo p {
  color: var(--sidebar-text) !important;
}

.nav-item {
  color: var(--sidebar-text) !important;
}

.nav-item span {
  color: var(--sidebar-text) !important;
}

.nav-item.active {
  background: var(--sidebar-active) !important;
  color: #fff !important;
}

.nav-item.active span {
  color: #fff !important;
}

.nav-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* Header */
.header {
  background: var(--header-bg) !important;
  border-bottom: 1px solid var(--border) !important;
  box-shadow: var(--shadow);
}

#page-title {
  color: var(--text) !important;
}

/* Cards */
.card {
  background: var(--card-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--card-radius) !important;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card-title {
  color: var(--text) !important;
}

.card-subtitle {
  color: var(--text-muted) !important;
}

/* Botões primários */
.btn-primary,
.btn.btn-primary,
button.btn-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background: var(--primary-dark) !important;
  transform: translateY(-1px);
}

/* Inputs */
input,
select,
textarea {
  border-color: var(--border) !important;
  background: var(--card-bg) !important;
  color: var(--text) !important;
  font-size: var(--font-size-base);
  transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary) !important;
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Modais */
.modal-content {
  background: var(--card-bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--card-radius) !important;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18) !important;
}

.modal-header {
  background: var(--primary) !important;
  border-radius: calc(var(--card-radius) - 2px) calc(var(--card-radius) - 2px) 0 0 !important;
}

.modal-header h2 {
  color: #fff !important;
}

.modal-header .close {
  color: rgba(255, 255, 255, 0.8) !important;
}

.modal-header .close:hover {
  color: #fff !important;
}

/* Abas Localidades */
.loc-tabs-bar {
  background: var(--header-bg) !important;
  border-bottom: 1px solid var(--border) !important;
}

.loc-tab {
  color: var(--text-muted) !important;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.loc-tab.active {
  color: var(--primary) !important;
  border-bottom-color: var(--primary) !important;
  font-weight: 600;
}

/* Badges de status */
.status-badge,
.badge-loc-status {
  border-radius: 20px;
  font-size: 11px;
  padding: 3px 10px;
  font-weight: 600;
}

.status-badge.estoque,
.badge-loc-status.ativo {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.instalado {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.manutencao,
.badge-loc-status.manutencao {
  background: #fef9c3;
  color: #713f12;
}

.status-badge.baixado,
.badge-loc-status.inativo {
  background: #fee2e2;
  color: #991b1b;
}

/* Badges SSL */
.badge-ssl-status.solicitado {
  background: #fef9c3;
  color: #713f12;
}

.badge-ssl-status.enviado {
  background: #dbeafe;
  color: #1e40af;
}

.badge-ssl-status.devolvido {
  background: #d1fae5;
  color: #065f46;
}

.badge-ssl-status.baixado {
  background: #fee2e2;
  color: #991b1b;
}

/* Tabelas config */
.config-table {
  color: var(--text);
  border-color: var(--border);
}

.config-table th {
  background: var(--bg);
  color: var(--text-muted);
  border-color: var(--border);
}

.config-table td {
  border-color: var(--border);
}

.config-table tr:hover td {
  background: var(--bg);
}

/* Formulários - labels */
label {
  color: var(--text);
}

.form-section-title {
  color: var(--primary);
  border-bottom: 1px solid var(--border);
}

/* Timeline */
.timeline-item {
  border-left-color: var(--border);
}

.timeline-data {
  color: var(--primary);
}

.timeline-acao {
  color: var(--text);
}

.timeline-detalhe {
  color: var(--text-muted);
}

/* Filters */
.filters {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

/* Resumo status (equipamentos) */
.badge-resumo {
  background: var(--card-bg);
  border: 1px solid var(--border);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}


/* ═══════════════════════════════════════════════════════════
   TEMA ESCURO — body.tema-escuro
   ═══════════════════════════════════════════════════════════ */

body.tema-escuro {
  color-scheme: dark;
}

body.tema-escuro .card {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

body.tema-escuro .card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
}

body.tema-escuro input,
body.tema-escuro select,
body.tema-escuro textarea {
  background: #273549 !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

body.tema-escuro .config-table th {
  background: #1a2537;
}

body.tema-escuro .config-table tr:hover td {
  background: #1a2537;
}

body.tema-escuro .loc-localidade-group summary {
  background: #1a2537 !important;
  color: #e2e8f0 !important;
}

body.tema-escuro details[open]>div {
  background: #1e293b !important;
}

body.tema-escuro .empty-state p {
  color: #94a3b8;
}

body.tema-escuro .badge-resumo {
  background: #1e293b;
  border-color: #334155;
}

body.tema-escuro .badge-resumo .badge-top {
  color: #e2e8f0;
}

body.tema-escuro .filters {
  background: #1e293b;
  border-color: #334155;
}

body.tema-escuro .form-section-title {
  border-color: #334155;
}

body.tema-escuro .modal .modal-body,
body.tema-escuro #loc-hist-content,
body.tema-escuro #detalhe-content,
body.tema-escuro #colab-detalhes-content {
  background: var(--card-bg);
  color: var(--text);
}

body.tema-escuro .ssl-card,
body.tema-escuro .ferias-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

body.tema-escuro .loc-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

body.tema-escuro .loc-card-body h4 {
  color: #e2e8f0;
}

body.tema-escuro .resumo-card,
body.tema-escuro .stat-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}


/* ═══════════════════════════════════════════════════════════
   TEMA COMPACTO — ajustes de espaçamento
   ═══════════════════════════════════════════════════════════ */

body.tema-compacto .card {
  padding: 8px !important;
}

body.tema-compacto .card-info-item {
  margin-bottom: 2px !important;
  font-size: 12px !important;
}

body.tema-compacto .card-title {
  font-size: 13px !important;
}

body.tema-compacto .loc-card-header {
  padding: 8px !important;
}

body.tema-compacto .loc-card-body {
  padding: 8px !important;
}

body.tema-compacto .modal-content {
  padding: 0 !important;
}

body.tema-compacto .form-group {
  margin-bottom: 8px !important;
}

body.tema-compacto label {
  font-size: 12px !important;
  margin-bottom: 2px !important;
}

/* ═══════════════════════════════════════════════════════════
   SELETOR DE TEMA — estilos
   ═══════════════════════════════════════════════════════════ */

.theme-selector select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.theme-selector select:focus {
  border-color: var(--primary);
  outline: none;
}

/* ═══════════════════════════════════════════════════════════
   ANIMAÇÕES GLOBAIS
   ═══════════════════════════════════════════════════════════ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card,
.loc-card,
.ssl-card {
  animation: fadeIn 0.2s ease;
}

.modal-content {
  animation: fadeIn 0.15s ease;
}

/* Transições suaves ao trocar tema */
.sidebar,
.header,
.card,
.modal-content,
input,
select,
textarea,
body {
  transition:
    background 0.25s,
    color 0.25s,
    border-color 0.25s,
    box-shadow 0.25s;
}