/* ============================================================
   LUMOS — Global Styles
   Reset, typography, utilities
   ============================================================ */

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  transition: background var(--transition-slow), color var(--transition-slow);
}

::selection { background: var(--brand-gold-soft); color: var(--text-primary); }

/* Foco visível só para teclado (sem contorno azul ao clicar) */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition),
              background var(--transition-slow);
}
/* Altura confortável (toque) apenas em campos de formulário */
.form-group input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
.form-group select,
.input-wrap input { min-height: 44px; }
textarea { min-height: 100px; }
input:hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled) { border-color: var(--border-light); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
  background: var(--surface);
}
/* Autofill do Chrome (fundo azul claro quebrava o tema escuro) */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary);
  caret-color: var(--text-primary);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  transition: background-color 9999s ease-out 0s;
}
input:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset, var(--ring); }
select { cursor: pointer; }
textarea { resize: vertical; }
ul, ol { list-style: none; }
img, svg { display: block; }
svg { flex-shrink: 0; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ---- TYPOGRAPHY ---- */
h1, h2, h3 { letter-spacing: -.015em; text-wrap: balance; }
p { text-wrap: pretty; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1.375rem; font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
h4 { font-size: 1rem;     font-weight: 600; }
h5 { font-size: .875rem;  font-weight: 600; }

.text-sm    { font-size: .875rem; }
.text-xs    { font-size: .75rem; }
.text-muted { color: var(--text-secondary); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary-color { color: var(--primary); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

/* ---- LAYOUT UTILITIES ---- */
.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.flex-1     { flex: 1; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-4  { gap: .25rem; }
.gap-8  { gap: .5rem; }
.gap-12 { gap: .75rem; }
.gap-16 { gap: 1rem; }
.gap-20 { gap: 1.25rem; }
.gap-24 { gap: 1.5rem; }
.w-full { width: 100%; }
.text-center { text-align: center; }

/* ---- SPACING ---- */
.mt-4  { margin-top: .25rem; }
.mt-8  { margin-top: .5rem; }
.mt-16 { margin-top: 1rem; }
.mt-24 { margin-top: 1.5rem; }
.mb-8  { margin-bottom: .5rem; }
.mb-16 { margin-bottom: 1rem; }
.mb-24 { margin-bottom: 1.5rem; }

/* ---- CARD ---- */
.card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm), var(--highlight);
  transition: background var(--transition-slow), border-color var(--transition-slow),
              box-shadow .3s var(--ease-out), transform .3s var(--ease-out);
}
.card:hover {
  box-shadow: var(--shadow-lg), var(--highlight);
  transform: translateY(-2px);
  border-color: var(--border-light);
}
.card-title {
  font-size: 1rem;
  font-weight: 800;
  font-family: 'Poppins', 'Inter', sans-serif;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-secondary);
  margin-bottom: .875rem;
  display: flex;
  align-items: center;
  gap: .45rem;
}

/* ---- BUTTONS ---- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  letter-spacing: -.005em;
  cursor: pointer;
  border: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition),
              box-shadow var(--transition), transform .15s var(--ease-out), opacity var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 16px; height: 16px; }
.btn:active:not(:disabled) { transform: scale(.98); }

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--text-inverse);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 1px 2px rgba(0,0,0,.25);
}
.btn-primary:hover { background: var(--btn-primary-bg-hover); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), var(--shadow-glow), var(--shadow-md); }
.btn-primary:focus-visible { box-shadow: inset 0 1px 0 rgba(255,255,255,.35), var(--ring); }

/* Estado de carregamento inline (spinner dentro do botão) */
.btn-spinner {
  display: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  opacity: .75;
  animation: spin .7s linear infinite;
}
.btn.is-loading { cursor: progress; }
.btn.is-loading .btn-spinner { display: inline-block; }
.btn.is-loading:disabled { opacity: .85; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--primary); color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1.5px solid var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }

.btn-sm { padding: 7px 14px; font-size: .8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* Icon-only button */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-icon:hover { background: var(--surface-hover); color: var(--primary); border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-icon svg { width: 16px; height: 16px; }

/* ---- BADGE ---- */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info    { background: var(--info-soft);    color: var(--info); }
.badge-muted   { background: var(--surface-2);    color: var(--text-muted); border: 1px solid var(--border); }

/* ---- FORM ELEMENTS ---- */
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.form-hint { font-size: .75rem; color: var(--text-muted); }
.form-error { font-size: .75rem; color: var(--danger); display: none; }
.form-error.show { display: block; }
.input-error { border-color: var(--danger) !important; }

/* Input with icon */
.input-wrap { position: relative; }
.input-wrap svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.input-wrap input { padding-left: 40px; }

/* ---- SEPARATOR ---- */
.sep {
  display: flex; align-items: center; gap: .75rem;
  color: var(--text-muted); font-size: .8rem;
}
.sep::before, .sep::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}

/* ---- EMPTY STATE ---- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--text-muted);
  text-align: center;
}
.empty-state .empty-icon { font-size: 3rem; opacity: .5; }
.empty-state p { max-width: 280px; font-size: .9rem; line-height: 1.6; }

/* ---- LOADING SPINNER ---- */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem;
}

/* ---- PAGE HEADER ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-header-left { display: flex; flex-direction: column; gap: .25rem; }
.page-header-title { font-size: 1.375rem; font-weight: 700; }
.page-header-sub { font-size: .875rem; color: var(--text-secondary); }

/* ---- SECTION TITLE ---- */
.section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

/* ---- COLOR DOT ---- */
.color-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 641px) {
  .show-mobile { display: none !important; }
}

/* ---- ACESSIBILIDADE: movimento reduzido ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
