/**
 * UDCL Master Design System (Aurora)
 * Padrao Visual Oficial da Uniao Democratica dos Ciclos Livres
 * Versao: 2026.11-PRO
 */

:root {
  /* Paleta Imperial e Institucional (Modo Claro) */
  --ox: #6b1d2f;
  --ox-rgb: 107, 29, 47;
  --ox-light: #8b283c;
  --ox-dark: #4d1421;
  
  --gold: #9e6f0b;
  --gold-rgb: 158, 111, 11;
  --gold-light: #c28b12;
  --gold-dark: #7a5508;
  
  --paper: #f8f6f0;
  --card: #ffffff;
  --card-hover: #fcfbf8;
  
  --rule: #e5ddcc;
  --rule-light: #f0eae0;
  --rule-dark: #cfc4ae;
  
  --ink: #141210;
  --ink2: #24201c;
  --ink-muted: #5e5447;
  --ink-faint: #8c8071;
  
  --acc: #8b1a1a;
  --th: #f3ece0;
  
  /* Status Semanticos */
  --success: #285933;
  --success-bg: #eaf3ec;
  --warning: #875412;
  --warning-bg: #fdf5e8;
  --danger: #8a2121;
  --danger-bg: #fbeeed;
  --info: #1b4b66;
  --info-bg: #eaf3f8;
  
  /* Geometria e Elevacao */
  --r-sm: 6px;
  --r: 10px;
  --r-lg: 16px;
  --r-full: 9999px;
  
  --shadow-sm: 0 1px 3px rgba(20, 18, 16, 0.05), 0 1px 2px rgba(20, 18, 16, 0.03);
  --shadow: 0 4px 16px -2px rgba(20, 18, 16, 0.06), 0 2px 6px -1px rgba(20, 18, 16, 0.04);
  --shadow-lg: 0 16px 40px -6px rgba(20, 18, 16, 0.12), 0 6px 16px -3px rgba(20, 18, 16, 0.06);
  --shadow-card: 0 2px 8px rgba(20, 18, 16, 0.04), 0 0 0 1px var(--rule);
  
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  /* Paleta Obsidian (Modo Escuro Oficial) */
  --ox: #9e3249;
  --ox-rgb: 158, 50, 73;
  --ox-light: #b8435d;
  --ox-dark: #6e1c2e;
  
  --gold: #d49c28;
  --gold-rgb: 212, 156, 40;
  --gold-light: #e6b345;
  --gold-dark: #9e6f0b;
  
  --paper: #12100f;
  --card: #1c1917;
  --card-hover: #24201c;
  
  --rule: #2e2822;
  --rule-light: #3d352e;
  --rule-dark: #24201b;
  
  --ink: #f2ece1;
  --ink2: #ded4c5;
  --ink-muted: #a69a8a;
  --ink-faint: #73685a;
  
  --acc: #b83244;
  --th: #24201b;
  
  --success: #52a663;
  --success-bg: #132417;
  --warning: #d69738;
  --warning-bg: #291d0d;
  --danger: #d95555;
  --danger-bg: #291313;
  --info: #499ac4;
  --info-bg: #11232e;
  
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--rule);
}

/* Reset e Base */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Source Sans 3', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

/* Tipografia */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-feature-settings: "lnum" 1;
  margin: 0.3em 0 0.4em;
  letter-spacing: -0.015em;
  color: var(--ink);
}

h1 {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.2;
}

h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ox);
  line-height: 1.3;
}

h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

/* Links */
a {
  color: var(--ox);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
  opacity: 0.85;
}

/* Header Institucional Moderno */
header.udcl-hdr {
  background: rgba(107, 29, 47, 0.96) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
  transition: all 0.2s var(--ease);
}

[data-theme="dark"] header.udcl-hdr {
  background: rgba(28, 17, 20, 0.94) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

header.udcl-hdr .udcl-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  color: #fff !important;
}

header.udcl-hdr .udcl-brand b {
  font-weight: 800;
  background: linear-gradient(135deg, #fff 40%, #edd8b4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

header.udcl-hdr .udcl-brand span {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.12);
  color: #f7edd9;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Navegacao */
header.udcl-hdr nav.udcl-nav a.top,
header.udcl-hdr nav.udcl-nav details.grp summary {
  font-size: 0.92rem;
  font-weight: 600;
  color: #f4e8d3 !important;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  transition: all 0.15s ease;
}

header.udcl-hdr nav.udcl-nav a.top:hover,
header.udcl-hdr nav.udcl-nav details.grp summary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff !important;
}

/* Botoes de Ferramentas no Header */
.tbtn {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  color: #f7ecd7 !important;
  border-radius: var(--r-sm) !important;
  padding: 5px 11px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.15s ease !important;
}

.tbtn:hover {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.hdr-btn-sala {
  background: linear-gradient(135deg, var(--gold) 0%, #7d5706 100%) !important;
  color: #fff !important;
  font-weight: 800 !important;
  letter-spacing: 0.08em;
  padding: 5px 13px !important;
  border-radius: var(--r-sm) !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.15s ease;
}

.hdr-btn-sala:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Cards Modernos */
.card {
  background: var(--card) !important;
  border: 1px solid var(--rule) !important;
  border-radius: var(--r) !important;
  padding: 20px 24px !important;
  box-shadow: var(--shadow-card) !important;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.card:hover {
  box-shadow: var(--shadow) !important;
}

/* Badges e Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid var(--ox);
  color: var(--ox);
  background: transparent;
}

.badge.badge-tramitacao {
  border-color: var(--info);
  color: var(--info);
  background: var(--info-bg);
}

.badge.badge-sancionado,
.badge.badge-aprovado {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-bg);
}

.badge.badge-vetado,
.badge.badge-rejeitado {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-bg);
}

.badge.badge-ouro,
.badge.oc {
  border-color: var(--gold);
  color: var(--gold-dark);
  background: var(--warning-bg);
}

/* Botoes Gerais */
button, .btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 18px;
  border-radius: var(--r-sm);
  border: 0;
  cursor: pointer;
  background: var(--ox);
  color: #fff;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

button:hover, .btn:hover {
  background: var(--ox-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

button:active, .btn:active {
  transform: translateY(0);
}

/* Tabelas Refinadas */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

table th {
  background: var(--th) !important;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 16px;
  border-bottom: 2px solid var(--rule);
}

table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule-light);
  vertical-align: middle;
}

table tr:last-child td {
  border-bottom: 0;
}

table tr:hover td {
  background: var(--card-hover);
}

/* Barra de Comando Spotlight (Ctrl+K) */
#pal {
  position: fixed;
  inset: 0;
  background: rgba(10, 9, 8, 0.65) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 14vh;
  z-index: 1000;
  animation: palFadeIn 0.15s ease-out;
}

#pal.on {
  display: flex !important;
}

#pal .box {
  background: var(--card) !important;
  color: var(--ink);
  width: min(650px, 94vw);
  border-radius: var(--r-lg) !important;
  border: 1px solid var(--rule) !important;
  box-shadow: var(--shadow-lg) !important;
  overflow: hidden;
}

#pal input {
  width: 100%;
  border: 0 !important;
  border-bottom: 1px solid var(--rule) !important;
  border-radius: 0 !important;
  padding: 18px 22px !important;
  font-size: 1.15rem !important;
  background: var(--card) !important;
  color: var(--ink) !important;
  outline: none !important;
}

#pal input::placeholder {
  color: var(--ink-faint);
}

#pal ul {
  list-style: none;
  margin: 0;
  padding: 8px;
  max-height: 55vh;
  overflow-y: auto;
}

#pal li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  color: var(--ink) !important;
  font-weight: 500;
  transition: all 0.1s ease;
}

#pal li.sel a,
#pal li a:hover {
  background: var(--ox) !important;
  color: #fff !important;
}

#pal li.sel a span.mut,
#pal li a:hover span.mut {
  color: rgba(255, 255, 255, 0.75) !important;
}

/* Botao Flutuante da IA */
#fab-ia {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--ox) 0%, #8c2339 100%) !important;
  color: #fff !important;
  padding: 11px 20px !important;
  border-radius: var(--r-full) !important;
  box-shadow: 0 6px 24px rgba(107, 29, 47, 0.35) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.2s var(--ease);
}

#fab-ia:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 30px rgba(107, 29, 47, 0.45) !important;
}

/* Animacoes */
@keyframes palFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}


/* Sistema de Notificacoes Flutuantes (Toast) */
#udcl-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.udcl-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--ox);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  font-size: 0.92rem;
  font-weight: 600;
  min-width: 260px;
  max-width: 420px;
  animation: toastSlideIn 0.25s var(--ease);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.udcl-toast.sucesso {
  border-left-color: var(--success);
}

.udcl-toast.alerta {
  border-left-color: var(--warning);
}

.udcl-toast.erro {
  border-left-color: var(--danger);
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Microinteracoes em Quadro de Organizacao Pessoal */
.org-quadro {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 14px;
}

.org-coluna {
  background: var(--card-hover);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 16px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.org-coluna h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
  font-size: 1.05rem;
  color: var(--ink);
  border-bottom: 2px solid var(--rule-light);
  padding-bottom: 8px;
}

.org-coluna-tarefas {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.org-tarefa {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.org-tarefa:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--ox-light);
}

.org-tarefa h4 {
  font-size: 1.05rem;
  margin: 6px 0 8px;
  line-height: 1.35;
}

.org-select-estado {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  font-size: 0.88rem;
  cursor: pointer;
  width: 100%;
}
