:root {
  /* Base (modo normal) */
  --paper: #F7F5F2;
  --surface: #FFFFFF;
  --ink: #12100E;

  /* Texto secundário com mais contraste */
  --taupe: #3F3A36;
  --stone: #514A44;

  /* Bordas mais visíveis */
  --borderLight: #756D66;
  --link: #064F9E;
  --danger: #8B1E1E;
  --success: #166534;

  /* Acessibilidade (tokens) */
  --a11y-yellow: #FFFF00;
  --a11y-blue: #00FFFF;
  --a11y-red: #FF0000;

  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  background-color: var(--paper);
  color: var(--ink);
  transition: background-color 0.5s var(--ease-standard), color 0.5s var(--ease-standard);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* reforça contraste mesmo usando Tailwind classes no HTML */
.text-taupe { color: var(--taupe) !important; }
.text-stone { color: var(--stone) !important; }
.text-red-700,
.text-red-800 { color: var(--danger) !important; }
.text-green-800 { color: var(--success) !important; }

a {
  color: inherit;
}

a.text-\[\#0563C1\] {
  color: var(--link) !important;
}

.editorial-shadow {
  box-shadow: 0 10px 40px -10px rgba(18, 16, 14, 0.14);
}

.editorial-card {
  background-color: var(--surface);
  border: 1px solid var(--borderLight);
}

#panel-profile > .space-y-8 > .editorial-card,
#panel-shared-jobs .editorial-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 360px;
}

.contrast-surface {
  background-color: var(--surface);
  color: var(--ink);
}

.editorial-input {
  width: 100%;
  padding: 1rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--borderLight);
  border-radius: 1rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

textarea.editorial-input {
  overflow: hidden;
  resize: vertical;
}

.editorial-input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(18, 16, 14, 0.2);
}

.dashboard-tab.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.dashboard-tabs {
  scrollbar-width: none;
}

.dashboard-tabs::-webkit-scrollbar {
  display: none;
}

.dashboard-tab:not(.is-active):hover,
button:not(:disabled):hover {
  text-decoration: underline;
  text-underline-offset: 0.22rem;
}

.is-busy,
button:disabled {
  cursor: not-allowed;
  border-color: var(--ink) !important;
  box-shadow: inset 0 0 0 2px var(--surface);
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: 9999px;
  border: 1px solid var(--borderLight);
  background: var(--surface);
  padding: 0.45rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
}

.contrast-chip {
  background-color: var(--surface);
  color: var(--ink);
}

.load-status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--borderLight);
  border-radius: 9999px;
  background: var(--surface);
  color: var(--taupe);
  font-size: 0.75rem;
  font-weight: 700;
}

.load-status.hidden {
  display: none;
}

.load-status.is-loading::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid var(--borderLight);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: statusSpin 0.8s linear infinite;
}

.load-status.is-loaded {
  border-color: var(--success);
  color: var(--success);
}

.load-status.is-error {
  border-color: var(--danger);
  color: var(--danger);
}

.tag-pill button {
  font-weight: 900;
  color: var(--danger);
}

.profile-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.75rem;
}

.profile-card {
  position: relative;
  min-height: 7.25rem;
  border: 1px solid var(--borderLight);
  border-radius: 1rem;
  background: var(--surface);
  padding: 0.8rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.profile-card.is-active {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.profile-card__select {
  width: 100%;
  height: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.profile-card__icon {
  width: 2.55rem;
  height: 2.55rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: var(--paper);
  border: 1px solid var(--borderLight);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.profile-card.is-active .profile-card__icon {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.profile-card__delete {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  color: var(--danger);
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  padding: 0.4rem;
}

.skip-link {
  position: absolute;
  top: -5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.5rem;
  z-index: 1000;
  transition: all 0.3s ease;
  border-radius: 9999px;
}
.skip-link:focus { top: 1.5rem; }

/* Foco acessível */
*:focus-visible {
  outline: 4px solid var(--ink) !important;
  outline-offset: 4px;
}

/* =========================
   High contrast mode
   - contraste por cores dedicadas
   ========================= */
body.high-contrast {
  background-color: #000 !important;
  color: #fff !important;
  color-scheme: dark;
}

body.high-contrast nav,
body.high-contrast table thead {
  background-color: #000 !important;
  border-color: #fff !important;
  color: #fff !important;
}

/* Cards com borda amarela (alto contraste) */
body.high-contrast .editorial-card {
  background-color: #000 !important;
  border: 3px solid var(--a11y-yellow) !important;
  color: #fff !important;
}

body.high-contrast .bg-white,
body.high-contrast .profile-card,
body.high-contrast .tag-pill,
body.high-contrast .contrast-surface,
body.high-contrast .contrast-chip,
body.high-contrast fieldset {
  background-color: #000 !important;
  border-color: #fff !important;
  color: #fff !important;
}

body.high-contrast #skills-list > *,
body.high-contrast #languages-list > *,
body.high-contrast #projects-list article,
body.high-contrast #experiences-list article,
body.high-contrast #courses-list article,
body.high-contrast #certifications-list article,
body.high-contrast #match-history article,
body.high-contrast #resume-files-list article {
  background-color: #000 !important;
  border-color: #fff !important;
  color: #fff !important;
}

body.high-contrast .profile-card__icon {
  background-color: #000 !important;
  border-color: #fff !important;
  color: #fff !important;
}

body.high-contrast tbody tr:hover {
  background-color: #000 !important;
  outline: 2px solid var(--a11y-yellow);
  outline-offset: -2px;
}

/* Inputs: texto amarelo, borda branca, foco ciano */
body.high-contrast .editorial-input {
  background-color: #000 !important;
  border: 2px solid #fff !important;
  color: var(--a11y-yellow) !important;
}

body.high-contrast .editorial-input::placeholder {
  color: rgba(255, 255, 255, 0.75) !important;
}

body.high-contrast .editorial-input:focus {
  border-color: var(--a11y-blue) !important;
  box-shadow: 0 0 0 3px rgba(0, 255, 255, 0.25) !important;
}

/* Botões: borda ciano, texto ciano, fundo preto */
body.high-contrast button {
  border: 2px solid var(--a11y-blue) !important;
  background-color: #000 !important;
  color: var(--a11y-blue) !important;
}

/* Botões primários (bg-ink): CTA ciano */
body.high-contrast button.bg-ink {
  background-color: var(--a11y-blue) !important;
  color: #000 !important;
  font-weight: 900 !important;
  border-color: var(--a11y-blue) !important;
}

body.high-contrast .dashboard-tab.is-active,
body.high-contrast .profile-card.is-active .profile-card__icon {
  background-color: var(--a11y-yellow) !important;
  border-color: var(--a11y-yellow) !important;
  color: #000 !important;
}

body.high-contrast .profile-card.is-active {
  border-color: var(--a11y-yellow) !important;
  box-shadow: inset 0 0 0 2px var(--a11y-yellow);
}

/* Textos utilitários no alto contraste */
body.high-contrast .text-stone,
body.high-contrast .text-taupe {
  color: #fff !important;
  opacity: 1 !important;
}

body.high-contrast .text-red-700,
body.high-contrast .text-red-800,
body.high-contrast .profile-card__delete,
body.high-contrast .tag-pill button {
  color: #ff8f8f !important;
}

body.high-contrast .text-green-800 {
  color: #8dffac !important;
}

body.high-contrast .load-status {
  background-color: #000 !important;
  border-color: #fff !important;
  color: #fff !important;
}

body.high-contrast .load-status.is-loading::before {
  border-color: #fff;
  border-top-color: var(--a11y-blue);
}

body.high-contrast .load-status.is-loaded {
  border-color: #8dffac !important;
  color: #8dffac !important;
}

body.high-contrast .load-status.is-error {
  border-color: #ff8f8f !important;
  color: #ff8f8f !important;
}

body.high-contrast a {
  color: var(--a11y-yellow) !important;
}

body.high-contrast [class*="text-paper"] {
  color: #fff !important;
  opacity: 1 !important;
}

body.high-contrast input[type="checkbox"] {
  accent-color: var(--a11y-blue);
}

body.high-contrast .is-busy,
body.high-contrast button:disabled {
  border-color: #fff !important;
  background-color: #000 !important;
  color: #fff !important;
}

/* foco no alto contraste: vermelho */
body.high-contrast *:focus-visible {
  outline: 4px solid var(--a11y-red) !important;
  outline-offset: 4px;
}

/* animação */
.modal-enter {
  animation: modalFadeIn 0.4s var(--ease-standard) forwards;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes statusSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 639px) {
  #nav-actions {
    min-width: 0;
  }

  #nav-actions span {
    max-width: calc(100vw - 6.5rem);
    overflow-wrap: anywhere;
  }

  .editorial-input {
    padding: 0.875rem;
    font-size: 1rem;
  }

  #panel-profile button[type="submit"],
  #panel-matching button[type="submit"],
  #panel-shared-jobs button,
  #auth-modal button[type="submit"],
  #application-modal button[type="submit"] {
    min-height: 3rem;
  }

  .profile-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr));
  }

  .jobs-list-wrap {
    overflow: visible;
  }

  .jobs-table,
  .jobs-table tbody,
  .jobs-table tr,
  .jobs-table td {
    display: block;
    width: 100%;
  }

  .jobs-table thead {
    display: none;
  }

  .jobs-table tbody {
    display: grid;
    gap: 1rem;
  }

  .jobs-table tbody tr {
    overflow: hidden;
    border: 1px solid var(--borderLight);
    border-radius: 1.25rem;
    background: var(--surface);
  }

  .jobs-table tbody td:not(.jobs-empty) {
    border: 0;
    text-align: left;
  }

  .jobs-table tbody td:not(.jobs-empty):not(:first-child)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.45rem;
    color: var(--stone);
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    text-transform: uppercase;
  }

  .jobs-table .jobs-empty {
    border: 1px solid var(--borderLight);
    border-radius: 1.25rem;
    background: var(--surface);
  }

  .job-actions button {
    margin-top: 0.6rem;
    margin-right: 1rem;
    margin-left: 0 !important;
  }

  #projects-list article > div,
  #experiences-list article > div,
  #courses-list article > div,
  #certifications-list article > div,
  #resume-files-list article > div,
  #match-history article > div {
    flex-direction: column;
  }

  #toast-root > * {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* VLibras sempre acima */
[vw-access-button],
[vw-plugin-wrapper] {
  z-index: 99999 !important;
}
