/* ═══════════════════════════════════════════════════
   ALUPAR · Concorrência 2026
   Design System — Enterprise Gateway · Trust & Authority
   Fonts: Lexend (headings) + Inter (body)
   UX Skill: ui-ux-pro-max — WCAG AAA, prefers-reduced-motion
   ═══════════════════════════════════════════════════ */

/* ── Google Fonts ─────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@200;300;400;500;600;700;800&family=Inter:wght@200;300;400;500;600&display=swap');

/* ── Design Tokens ────────────────────────────── */
:root {
  /* Brand — Alupar Green */
  --green-900: #0D2E0A;
  --green-800: #1D4A18;
  --green-700: #2A6023;
  --green-600: #357A2C;
  --green-200: #A8D5A0;
  --green-100: #E2F0DF;
  --green-50:  #F2F8F1;

  /* Slate — Enterprise palette (UI Pro Max: Trust & Authority) */
  --slate-950: #020617;
  --slate-900: #0F172A;
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50:  #F8FAFC;

  /* Semantic */
  --color-text:        var(--slate-900);
  --color-text-muted:  var(--slate-600);
  --color-text-subtle: var(--slate-400);
  --color-bg:          var(--slate-50);
  --color-surface:     #FFFFFF;
  --color-border:      var(--slate-200);
  --color-border-subtle: var(--slate-100);

  /* Semantic Colors */
  --color-error: #DC2626;
  --color-error-bg: #FEF2F2;
  --color-error-border: #FECACA;
  --color-warning: #D97706;
  --color-warning-bg: #FFFBEB;
  --color-warning-border: #FDE68A;
  --color-info: #2563EB;
  --color-info-bg: #EFF6FF;
  --color-ai: #7C3AED;
  --color-ai-bg: #F5F3FF;
  --color-ai-border: #C4B5FD;

  /* Typography (UI Pro Max: Plus Jakarta Sans + Inter) */
  --font-heading: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;

  /* Type scale */
  --text-xs:   0.75rem;    /* 12px */
  --text-sm:   0.875rem;   /* 14px */
  --text-base: 1rem;       /* 16px — min mobile per skill */
  --text-lg:   1.125rem;   /* 18px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  1.5rem;     /* 24px */
  --text-3xl:  1.875rem;   /* 30px */
  --text-4xl:  2.25rem;    /* 36px */
  --text-5xl:  3rem;       /* 48px */

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Shadow — barely-there, Apple-grade */
  --shadow-xs: 0 1px 2px rgba(15,23,42,0.04);
  --shadow-sm: 0 2px 8px rgba(15,23,42,0.06), 0 0 0 1px rgba(15,23,42,0.03);
  --shadow-md: 0 4px 16px rgba(15,23,42,0.08), 0 0 0 1px rgba(15,23,42,0.03);
  --shadow-lg: 0 8px 32px rgba(15,23,42,0.10), 0 0 0 1px rgba(15,23,42,0.04);

  /* Transitions — UI Pro Max: 150-300ms ease-out */
  --transition-fast: 150ms ease-out;
  --transition-base: 200ms ease-out;
  --transition-slow: 300ms ease-out;

  /* Z-index scale — UI Pro Max: defined scale */
  --z-base:    10;
  --z-dropdown: 20;
  --z-sticky:  30;
  --z-overlay: 40;
  --z-modal:   50;
}

/* ── Reset ────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* UI Pro Max: viewport-meta minimum 16px mobile */
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  /* UI Pro Max: no horizontal scroll */
  overflow-x: hidden;
}

/* ── Typography ───────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--slate-900);
  line-height: 1.2;
  font-weight: 300;
  /* UI Pro Max: 65-75 chars per line */
  max-width: 72ch;
}

h1 { font-size: clamp(2.25rem, 5vw, var(--text-5xl)); letter-spacing: -0.035em; font-weight: 200; }
h2 { font-size: clamp(1.65rem, 3.5vw, var(--text-3xl)); letter-spacing: -0.03em; font-weight: 300; }
h3 { font-size: clamp(1.2rem, 2.5vw, var(--text-xl));  letter-spacing: -0.02em; font-weight: 300; }
h4 { font-size: var(--text-lg); font-weight: 400; letter-spacing: -0.015em; }

p {
  color: var(--color-text-muted);
  line-height: 1.7;
  max-width: 70ch;
}

a {
  color: var(--green-700);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--green-900); }

/* ── Layout ───────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--space-10);
}

.section      { padding: var(--space-24) 0; }
.section-md   { padding: var(--space-16) 0; }
.section-sm   { padding: var(--space-12) 0; }

/* ── Navigation — Frosted glass, floating ─────── */
/* UI Pro Max: floating navbar top-4 spacing */
.nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  height: 60px;
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--color-border-subtle);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Logo — texto puro, sem ícone */
.logo {
  display: flex;
  flex-direction: column;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
}
.logo-name {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: 0.22em;
  color: var(--green-800);
  line-height: 1;
}
.logo-sub {
  font-size: 11px;
  letter-spacing: 0.07em;
  color: var(--slate-400);
  margin-top: 3px;
  font-weight: 400;
  text-transform: uppercase;
}

/* ── Buttons — UI Pro Max: 44px touch target ──── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 20px;
  min-height: 44px; /* UI Pro Max: 44×44 touch target */
  min-width: 44px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer; /* UI Pro Max: cursor-pointer on all clickable */
  border: none;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  /* UI Pro Max: visible focus state */
  outline: none;
}
.btn:focus-visible {
  outline: 2px solid var(--green-700);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--green-800);
  color: #fff;
}
.btn-primary:hover {
  background: var(--green-900);
  color: #fff;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--slate-100);
  color: var(--slate-700);
}
.btn-secondary:hover {
  background: var(--slate-200);
  color: var(--slate-900);
}

.btn-ghost {
  background: transparent;
  color: var(--slate-600);
  padding: 10px 14px;
}
.btn-ghost:hover {
  background: var(--slate-100);
  color: var(--slate-900);
}

.btn-sm {
  font-size: var(--text-xs);
  padding: 8px 16px;
  min-height: 36px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Pills / Badges ───────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill-green   { background: var(--green-100);   color: var(--green-800); }
.pill-slate   { background: var(--slate-100);   color: var(--slate-600); }
.pill-active  { background: var(--green-800);   color: #fff; }

/* Live indicator dot */
.dot-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ── Cards ────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  cursor: pointer;
}
.card-body { padding: var(--space-8); }

/* ── Metric / KPI ─────────────────────────────── */
.metric-value {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--green-800);
  line-height: 1;
}
.metric-label {
  font-size: var(--text-sm);
  color: var(--slate-500);
  margin-top: var(--space-2);
  line-height: 1.4;
}

/* ── Eyebrow label ────────────────────────────── */
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green-700);
}

/* ── Divider ──────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--color-border-subtle);
  border: none;
}

/* ── Accordion ────────────────────────────────── */
.accordion-item {
  border-bottom: 1px solid var(--color-border-subtle);
}
.accordion-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) 0;
  background: none;
  border: none;
  cursor: pointer; /* UI Pro Max */
  text-align: left;
  font-family: var(--font-body);
  min-height: 44px; /* UI Pro Max: touch target */
  transition: color var(--transition-fast);
}
.accordion-trigger:hover .accordion-title { color: var(--green-800); }
.accordion-trigger:focus-visible {
  outline: 2px solid var(--green-700);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.accordion-title {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--slate-800);
  transition: color var(--transition-fast);
}
.accordion-icon {
  flex-shrink: 0;
  color: var(--slate-400);
  transition: transform var(--transition-base);
}
.accordion-icon.open { transform: rotate(180deg); }
.accordion-body {
  padding-bottom: var(--space-5);
  font-size: var(--text-sm);
  color: var(--slate-600);
  line-height: 1.75;
  max-width: 68ch;
}

/* ── Progress ─────────────────────────────────── */
.progress {
  height: 3px;
  background: var(--slate-100);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--green-700);
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Countdown ────────────────────────────────── */
.countdown-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}
.countdown-digit {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 3.5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--slate-900);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.countdown-sep {
  font-size: 2rem;
  color: var(--slate-300);
  font-weight: 300;
  line-height: 1;
  margin-top: -6px;
  align-self: flex-start;
  padding-top: 6px;
}
.countdown-label {
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate-400);
}

/* ── Step Progress ────────────────────────────── */
.step-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.step-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step-dot-active { background: var(--green-700); color: #fff; }
.step-dot-done   { background: var(--green-100); color: var(--green-700); }
.step-dot-future { background: var(--slate-100); color: var(--slate-400); }
.step-label {
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}
.step-connector {
  width: 24px;
  height: 1px;
  background: var(--slate-200);
  flex-shrink: 0;
}

/* ── Form ─────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--slate-700);
  letter-spacing: -0.005em;
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 11px var(--space-4);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--slate-900);
  background: var(--color-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  min-height: 44px;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--green-700);
  box-shadow: 0 0 0 3px rgba(42, 96, 35, 0.1);
}
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }
.form-error {
  font-size: var(--text-xs);
  color: #DC2626;
  margin-top: var(--space-1);
}

/* ── Tables — admin ───────────────────────────── */
.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--color-border); }
thead th {
  padding: 12px var(--space-5);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--slate-400);
  text-align: left;
}
tbody td {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  color: var(--slate-700);
  border-bottom: 1px solid var(--color-border-subtle);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr {
  transition: background var(--transition-fast);
  cursor: default;
}
tbody tr[data-clickable] { cursor: pointer; }
tbody tr:hover { background: var(--slate-50); }

/* ── Sidebar — admin ──────────────────────────── */
.sidebar {
  width: 240px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  background: var(--slate-900);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-5);
  color: var(--slate-400);
  font-size: var(--text-sm);
  font-weight: 400;
  text-decoration: none;
  border-radius: var(--radius-sm);
  margin: 2px var(--space-3);
  transition: all var(--transition-fast);
  min-height: 44px;
  cursor: pointer;
}
.sidebar-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.sidebar-link.active { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-link:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: 2px;
}

.sidebar-mobile-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--green-800);
  color: #fff;
  border: none;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}

/* ── Animations — UI Pro Max compliant ────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* UI Pro Max: prefers-reduced-motion */
@media (prefers-reduced-motion: no-preference) {
  .animate-fade-up {
    animation: fadeUp 0.5s ease-out forwards;
  }
  .animate-blink {
    animation: blink 2s ease-in-out infinite;
  }
}

/* ── Footer ───────────────────────────────────── */
.footer {
  border-top: 1px solid var(--color-border-subtle);
  padding: var(--space-8) 0;
  background: var(--color-surface);
}

/* ── Responsive ───────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 0 var(--space-5); }
  .section { padding: var(--space-16) 0; }
  .section-md { padding: var(--space-12) 0; }
  .sidebar-mobile-toggle { display: flex; }
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: left 0.3s ease;
  }
  .sidebar.open {
    left: 0;
  }
  .sidebar-overlay.open {
    display: block;
  }
  h1 { font-size: 1.875rem; }
}

/* ── Print styles for Executive Report (PDF) ── */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt !important;
  }
  .sidebar,
  .sidebar-mobile-toggle,
  .no-print,
  .btn,
  button,
  a[href^="/api/admin/export"] {
    display: none !important;
  }
  .admin-layout {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin-bottom: 24px !important;
    page-break-inside: avoid;
  }
  .print-only {
    display: block !important;
  }
  table {
    page-break-inside: auto;
  }
  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }
  thead {
    display: table-header-group;
  }
  @page {
    size: A4 portrait;
    margin: 1.5cm;
  }
}
