/*
 * VÉRTICE — Global CSS
 * Arquivo: assets/css/global.css
 * Descrição: Design tokens (CSS variables), reset, tipografia,
 *            utilitários e componentes reutilizáveis em todo o projeto.
 *
 * Seções:
 *   1. Design Tokens (variáveis CSS)
 *   2. Reset & Base
 *   3. Tipografia
 *   4. Layout Utilitários
 *   5. Componentes — Botões
 *   6. Componentes — Inputs
 *   7. Componentes — Modal
 *   8. Componentes — Toast / Alertas
 *   9. Componentes — Status Badge
 *  10. Header & Footer
 *  11. Animações
 */

/* ══════════════════════════════════════════════
   1. DESIGN TOKENS
   Paleta, tipografia, sombras e espaçamento
   ══════════════════════════════════════════════ */
:root {
  /* Cores principais */
  --color-bg:          #0b0d0f;
  --color-surface:     #12151a;
  --color-surface-2:   #1a1e25;
  --color-border:      #232830;
  --color-border-soft: #1e2330;

  /* Texto */
  --color-text:        #e8eaf0;
  --color-text-muted:  #7a8090;
  --color-text-faint:  #454d5c;

  /* Acento — triângulo dourado */
  --color-accent:      #f0b429;
  --color-accent-dim:  rgba(240, 180, 41, 0.15);

  /* Estados semânticos */
  --color-pending:     #f0b429;
  --color-pending-bg:  rgba(240, 180, 41, 0.12);
  --color-progress:    #4f8ef7;
  --color-progress-bg: rgba(79, 142, 247, 0.12);
  --color-done:        #3ecf8e;
  --color-done-bg:     rgba(62, 207, 142, 0.12);
  --color-cancel:      #f46e6e;
  --color-cancel-bg:   rgba(244, 110, 110, 0.12);

  /* Tipografia */
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  /* Espaçamento */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* Bordas */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Sombras */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 48px rgba(0,0,0,0.6);

  /* Transições */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
}

/* ══════════════════════════════════════════════
   2. RESET & BASE
   ══════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

/* ══════════════════════════════════════════════
   3. TIPOGRAFIA
   ══════════════════════════════════════════════ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
}

/* ══════════════════════════════════════════════
   4. LAYOUT UTILITÁRIOS
   ══════════════════════════════════════════════ */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.hidden { display: none !important; }

/* ══════════════════════════════════════════════
   5. COMPONENTES — BOTÕES
   ══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out),
              opacity var(--duration-fast);
  white-space: nowrap;
  position: relative;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* Primário — fundo dourado */
.btn-primary {
  background: var(--color-accent);
  color: #0b0d0f;
}
.btn-primary:hover { background: #f5c446; }

/* Fantasma — sem fundo */
.btn-ghost {
  color: var(--color-text-muted);
}
.btn-ghost:hover { color: var(--color-text); background: var(--color-surface-2); }

/* Contorno */
.btn-outline {
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* Perigo */
.btn-danger {
  background: var(--color-cancel);
  color: #fff;
}
.btn-danger:hover { background: #e05555; }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* Spinner dentro de botão */
.btn-spinner { display: inline-flex; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════
   6. COMPONENTES — INPUTS
   ══════════════════════════════════════════════ */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  font-family: var(--font-display);
}

.field-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  transition: border-color var(--duration-fast);
  outline: none;
}
.field-input:focus {
  border-color: var(--color-accent);
}
.field-input::placeholder {
  color: var(--color-text-faint);
}
.field-input.error {
  border-color: var(--color-cancel);
}

textarea.field-input {
  resize: vertical;
  min-height: 80px;
}

select.field-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8090' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.field-error {
  font-size: 12px;
  color: var(--color-cancel);
  min-height: 16px;
}

.input-sm { padding: 7px 12px; font-size: 13px; }
.select-sm { padding: 7px 32px 7px 12px; font-size: 13px; }
.input-color { padding: 4px 8px; height: 38px; }

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* ══════════════════════════════════════════════
   7. COMPONENTES — MODAL
   ══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
  animation: fadeIn var(--duration-base) var(--ease-out);
}

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUp var(--duration-slow) var(--ease-out);
}

.modal-large { max-width: 760px; }
.modal-sm    { max-width: 420px; }

.modal-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.modal-close:hover { background: var(--color-border); color: var(--color-text); }

.modal-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.modal-dept-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.modal-dept-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  margin-bottom: 4px;
}

.modal-dept-name {
  font-size: 22px;
  font-weight: 700;
}

.modal-dept-email {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.modal-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
}

/* ══════════════════════════════════════════════
   8. COMPONENTES — TOAST
   ══════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  z-index: 2000;
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: slideUp var(--duration-base) var(--ease-out);
}
.toast.toast-success { border-color: var(--color-done); }
.toast.toast-error   { border-color: var(--color-cancel); }

.toast-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.toast-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.toast-msg { font-size: 13px; color: var(--color-text-muted); }

/* ══════════════════════════════════════════════
   9. COMPONENTES — STATUS BADGE
   ══════════════════════════════════════════════ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-display);
  text-transform: capitalize;
  white-space: nowrap;
}

.status-badge.pendente    { background: var(--color-pending-bg);  color: var(--color-pending);  }
.status-badge.em_andamento{ background: var(--color-progress-bg); color: var(--color-progress); }
.status-badge.concluido   { background: var(--color-done-bg);     color: var(--color-done);     }
.status-badge.cancelado   { background: var(--color-cancel-bg);   color: var(--color-cancel);   }

/* ══════════════════════════════════════════════
   10. HEADER & FOOTER
   ══════════════════════════════════════════════ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 13, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-soft);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
}

.logo-symbol {
  color: var(--color-accent);
  font-size: 20px;
  line-height: 1;
}
.logo-symbol.large { font-size: 32px; }

.logo-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.site-footer {
  border-top: 1px solid var(--color-border-soft);
  margin-top: var(--space-2xl);
  padding-block: var(--space-lg);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--color-text-faint);
}

.footer-inner a:hover { color: var(--color-accent); }

/* ══════════════════════════════════════════════
   11. ANIMAÇÕES
   ══════════════════════════════════════════════ */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50%       { opacity: 0.7; }
}

/* Linha do tempo */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-left: var(--space-sm);
  border-left: 2px solid var(--color-border);
  margin-block: var(--space-md);
}

.timeline-item {
  position: relative;
  padding: var(--space-sm) var(--space-md);
  padding-left: var(--space-lg);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-faint);
  border: 2px solid var(--color-bg);
}

.timeline-item.active::before { background: var(--color-accent); }
.timeline-item.done::before   { background: var(--color-done);   }

.timeline-status {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
}

.timeline-date {
  font-size: 12px;
  color: var(--color-text-faint);
}

.timeline-note {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* Seções de resultado */
.result-section {
  padding-block: var(--space-lg);
  border-top: 1px solid var(--color-border-soft);
}
.result-section:first-child { border-top: none; }

.result-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
  margin-bottom: var(--space-md);
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.result-fields {
  display: grid;
  gap: var(--space-md);
}

.result-fields dt {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}

.result-fields dd {
  font-size: 14px;
  color: var(--color-text);
}

/* Anexos */
.attach-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.attach-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: border-color var(--duration-fast), color var(--duration-fast);
}
.attach-item:hover { border-color: var(--color-accent); color: var(--color-accent); }

.attach-status {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
}

/* Responsividade geral */
@media (max-width: 640px) {
  .container { padding-inline: var(--space-md); }
  .header-nav .btn-ghost { display: none; }
  .form-row-2 { grid-template-columns: 1fr; }
  .modal { padding: var(--space-lg); }
  .toast { left: var(--space-md); right: var(--space-md); min-width: unset; }
}
