/*
  Voltz — identidade visual compartilhada
  Painel administrativo + checkout público.

  Tema: cinza strato, branco suave e grafite.
  Tipografia do sistema, sem recursos externos.
*/

:root {
  /* Paleta cinza strato */
  --vz-strato-50: #f8f7f5;
  --vz-strato-100: #f0efec;
  --vz-strato-200: #e5e3df;
  --vz-strato-300: #d3d0ca;
  --vz-strato-400: #77746e;
  --vz-strato-500: #65625d;
  --vz-strato-600: #55524d;
  --vz-strato-700: #45423e;
  --vz-strato-800: #353330;
  --vz-strato-900: #272623;

  /* Compatibilidade com variáveis existentes */
  --vz-purple-50: var(--vz-strato-50);
  --vz-purple-100: var(--vz-strato-100);
  --vz-purple-300: var(--vz-strato-400);
  --vz-purple-500: var(--vz-strato-600);
  --vz-purple-600: var(--vz-strato-700);
  --vz-purple-700: var(--vz-strato-800);
  --vz-purple-glow: rgba(53, 51, 48, 0.12);
  --vz-purple-bg: rgba(85, 82, 77, 0.08);

  --vz-graphite-900: var(--vz-strato-900);
  --vz-graphite-800: var(--vz-strato-800);
  --vz-graphite-700: var(--vz-strato-700);
  --vz-graphite-600: var(--vz-strato-600);
  --vz-graphite-400: var(--vz-strato-500);
  --vz-graphite-300: #96928b;
  --vz-graphite-200: var(--vz-strato-300);
  --vz-graphite-100: var(--vz-strato-100);

  /* Superfícies */
  --vz-white: #ffffff;
  --vz-bg: var(--vz-strato-200);
  --vz-surface: #ffffff;
  --vz-surface-soft: var(--vz-strato-50);

  /* Estados */
  --vz-success: #257044;
  --vz-success-bg: #eaf3ed;

  --vz-warning: #8a570e;
  --vz-warning-bg: #faf0df;

  --vz-danger: #b53434;
  --vz-danger-bg: #faeded;

  --vz-info: #315f91;
  --vz-info-bg: #ebf1f8;

  /* Bordas */
  --vz-radius-sm: 10px;
  --vz-radius-md: 12px;
  --vz-radius-lg: 20px;
  --vz-radius-xl: 24px;

  /* Sombras suaves */
  --vz-shadow-xs: 0 1px 2px rgba(39, 38, 35, 0.03);
  --vz-shadow-sm: 0 3px 12px rgba(39, 38, 35, 0.04);
  --vz-shadow-md: 0 10px 30px rgba(39, 38, 35, 0.07);
  --vz-shadow-lg: 0 20px 48px rgba(39, 38, 35, 0.10);

  /* Tipografia e transições */
  --vz-font: -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --vz-transition: 180ms ease;
}

/* --- Base --- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/*
  Mantém telas alternadas via JavaScript ocultas,
  mesmo quando outras classes definem display.
*/
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--vz-font);
  background: var(--vz-bg);
  color: var(--vz-graphite-900);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5em;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--vz-strato-700);
  text-decoration: none;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

svg {
  display: block;
}

/* Foco visível para navegação por teclado */
:focus-visible {
  outline: 3px solid var(--vz-strato-600);
  outline-offset: 3px;
}

/* --- Marca --- */

.vz-brand {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--vz-strato-800);
}

.vz-brand .vz-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--vz-strato-700);
  color: var(--vz-white);
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: var(--vz-shadow-xs);
}

/* --- Botões --- */

.vz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 46px;
  padding: 0.75em 1.25em;
  border-radius: var(--vz-radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
  transition:
    background-color var(--vz-transition),
    border-color var(--vz-transition),
    box-shadow var(--vz-transition),
    color var(--vz-transition);
}

.vz-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

a.vz-btn:hover {
  text-decoration: none;
}

.vz-btn:active {
  transform: none;
}

.vz-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.vz-btn-primary {
  background: var(--vz-strato-700);
  color: var(--vz-white);
  border-color: var(--vz-strato-700);
  box-shadow: var(--vz-shadow-xs);
}

.vz-btn-primary:hover:not(:disabled) {
  background: var(--vz-strato-800);
  border-color: var(--vz-strato-800);
  box-shadow: var(--vz-shadow-sm);
}

.vz-btn-primary:active:not(:disabled) {
  background: var(--vz-strato-900);
  border-color: var(--vz-strato-900);
}

.vz-btn-secondary {
  background: var(--vz-surface-soft);
  color: var(--vz-strato-800);
  border-color: var(--vz-strato-300);
}

.vz-btn-secondary:hover:not(:disabled) {
  background: var(--vz-strato-100);
  border-color: var(--vz-strato-400);
  color: var(--vz-strato-900);
}

.vz-btn-ghost {
  background: transparent;
  color: var(--vz-strato-600);
}

.vz-btn-ghost:hover:not(:disabled) {
  background: rgba(85, 82, 77, 0.07);
  color: var(--vz-strato-900);
}

.vz-btn-danger {
  background: var(--vz-white);
  color: var(--vz-danger);
  border-color: rgba(181, 52, 52, 0.3);
}

.vz-btn-danger:hover:not(:disabled) {
  background: var(--vz-danger-bg);
  border-color: var(--vz-danger);
}

.vz-btn-sm {
  min-height: 36px;
  padding: 0.5em 0.9em;
  font-size: 0.8rem;
}

.vz-icon-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0.65em;
  line-height: 0;
}

/* --- Formulários --- */

.vz-field {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  margin-bottom: 1.25em;
}

.vz-field label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--vz-strato-700);
}

.vz-field .vz-hint {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--vz-strato-500);
}

.vz-input,
.vz-select,
.vz-textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.8em 0.95em;
  border-radius: var(--vz-radius-sm);
  border: 1px solid var(--vz-strato-400);
  background: var(--vz-surface-soft);
  color: var(--vz-strato-900);
  font-size: 1rem;
  line-height: 1.5;
  box-shadow: none;
  transition:
    background-color var(--vz-transition),
    border-color var(--vz-transition),
    box-shadow var(--vz-transition);
}

.vz-input::placeholder,
.vz-textarea::placeholder {
  color: var(--vz-strato-400);
  opacity: 1;
}

.vz-input:focus,
.vz-select:focus,
.vz-textarea:focus {
  background: var(--vz-white);
  border-color: var(--vz-strato-700);
  box-shadow: 0 0 0 3px rgba(85, 82, 77, 0.15);
  outline: 2px solid var(--vz-strato-700);
  outline-offset: 2px;
}

.vz-input:disabled,
.vz-select:disabled,
.vz-textarea:disabled {
  background: var(--vz-strato-100);
  color: var(--vz-strato-500);
  cursor: not-allowed;
}

.vz-input[aria-invalid="true"],
.vz-select[aria-invalid="true"],
.vz-textarea[aria-invalid="true"] {
  border-color: var(--vz-danger);
}

.vz-input[aria-invalid="true"]:focus,
.vz-select[aria-invalid="true"]:focus,
.vz-textarea[aria-invalid="true"]:focus {
  outline-color: var(--vz-danger);
  box-shadow: 0 0 0 3px rgba(181, 52, 52, 0.12);
}

.vz-textarea {
  min-height: 120px;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--vz-strato-700);
}

/* --- Linhas e organização dos campos --- */

.vz-row {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.vz-row > * {
  flex: 1 1 200px;
  min-width: 0;
}

/* --- Cards e seções --- */

.vz-card {
  background: var(--vz-surface);
  border-radius: var(--vz-radius-lg);
  box-shadow: var(--vz-shadow-sm);
  border: 1px solid var(--vz-strato-300);
  padding: clamp(1.25rem, 3vw, 2rem);
  transition: box-shadow var(--vz-transition);
}

.vz-section-title {
  display: flex;
  align-items: center;
  gap: 0.65em;
  margin-bottom: 1.1rem;
  font-size: 1.0625rem;
  font-weight: 650;
  color: var(--vz-strato-800);
}

.vz-section-title svg {
  color: var(--vz-strato-500);
  flex-shrink: 0;
}

.vz-divider {
  margin: 1.5rem 0;
  border: none;
  border-top: 1px solid var(--vz-strato-200);
}

/* --- Badges --- */

.vz-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.35em 0.8em;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: 0;
}

.vz-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.vz-badge-success {
  background: var(--vz-success-bg);
  color: var(--vz-success);
}

.vz-badge-warning {
  background: var(--vz-warning-bg);
  color: var(--vz-warning);
}

.vz-badge-danger {
  background: var(--vz-danger-bg);
  color: var(--vz-danger);
}

.vz-badge-info {
  background: var(--vz-info-bg);
  color: var(--vz-info);
}

.vz-badge-neutral {
  background: var(--vz-strato-100);
  color: var(--vz-strato-600);
}

/* --- Tabelas --- */

.vz-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.vz-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--vz-strato-600);
  font-weight: 700;
  padding: 0.85em 1em;
  background: var(--vz-strato-100);
  border-bottom: 1px solid var(--vz-strato-300);
}

.vz-table th:first-child {
  border-top-left-radius: var(--vz-radius-sm);
}

.vz-table th:last-child {
  border-top-right-radius: var(--vz-radius-sm);
}

.vz-table td {
  padding: 0.9em 1em;
  border-bottom: 1px solid var(--vz-strato-200);
  vertical-align: middle;
}

.vz-table tbody tr {
  transition: background-color var(--vz-transition);
}

.vz-table tbody tr:hover {
  background: var(--vz-strato-50);
}

.vz-table tbody tr:last-child td {
  border-bottom: none;
}

.vz-cell-title {
  font-weight: 600;
  color: var(--vz-graphite-900);
}

.vz-actions-cell {
  display: flex;
  gap: 0.4em;
  flex-wrap: wrap;
}

/* --- Estados: carregando / vazio / erro --- */

.vz-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  padding: 2.5em 1em;
  color: var(--vz-strato-500);
  text-align: center;
}

.vz-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid var(--vz-strato-300);
  border-top-color: var(--vz-strato-700);
  animation: vz-spin 0.8s linear infinite;
}

@keyframes vz-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Notificações --- */

.vz-toast-container {
  position: fixed;
  top: 1em;
  right: 1em;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  max-width: calc(100vw - 2em);
}

.vz-toast {
  background: var(--vz-strato-800);
  color: var(--vz-white);
  padding: 0.85em 1.1em;
  border-radius: var(--vz-radius-md);
  box-shadow: var(--vz-shadow-md);
  font-size: 0.85rem;
  line-height: 1.5;
  animation: vz-toast-in 180ms ease;
  width: fit-content;
  max-width: min(320px, 100%);
  overflow-wrap: anywhere;
}

.vz-toast-success {
  border-left: 4px solid var(--vz-success);
}

.vz-toast-error {
  border-left: 4px solid var(--vz-danger);
}

@keyframes vz-toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- Acessibilidade --- */

.vz-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Responsividade --- */

@media (max-width: 720px) {
  .vz-row {
    flex-direction: column;
    gap: 0;
  }

  /*
    Evita aplicar a base de 200px à altura dos campos
    quando o flex passa a ser vertical.
  */
  .vz-row > * {
    flex: 1 1 auto;
    width: 100%;
  }

  .vz-card {
    padding: 1.25rem;
    border-radius: 16px;
  }

  .vz-section-title {
    font-size: 1rem;
  }
}

/* --- Preferência por movimento reduzido --- */

@media (prefers-reduced-motion: reduce) {
  :root {
    --vz-transition: 0ms;
  }

  .vz-toast {
    animation: none;
  }

  .vz-spinner {
    animation: none;
  }
}