@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  /* Tokens alinhados ao lsa-ui — light mode */
  --bg:         #ffffff;               /* --lsa-bg-primary */
  --bg-soft:    #F9FAFB;               /* --lsa-bg-secondary */
  --card:       #ffffff;               /* --color-card */
  --card-2:     #F2F4F7;               /* --color-secondary */
  --border:     #D0D5DD;               /* --lsa-border-primary */
  --border-sub: #EAECF0;               /* --lsa-border-secondary */
  --text:       #101828;               /* --lsa-text-primary */
  --muted:      #475467;               /* --lsa-text-tertiary */
  --brand:      #B8962E;               /* --color-brand */
  --brand-2:    #9A7D25;               /* --color-brand-600 */
  --brand-soft: rgba(184, 150, 46, .08);
  --ok:         #2ecc71;
  --err:        #D92D20;               /* --color-destructive */
  --radius:     14px;
  --font:       "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:       "JetBrains Mono", ui-monospace, monospace;
}

/* Garante que o atributo hidden funcione mesmo em elementos com display explícito */
[hidden] { display: none !important; }

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-soft);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 20px 56px;
}

/* ---------- Header ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  margin-bottom: 22px;
}
.brand-mark {
  font-weight: 700;
  color: #1A1A1A;
  background: linear-gradient(135deg, var(--brand), #d9be65);
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.08em;
}
.brand-sep {
  color: var(--border);
}
.brand-name {
  color: var(--muted);
  font-weight: 500;
}

header h1 {
  margin: 0 0 10px;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sub {
  color: var(--muted);
  margin: 0 0 28px;
  font-size: 1.02rem;
}

/* ---------- Dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.05s ease;
  margin-bottom: 20px;
}
.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--brand-2);
  background: rgba(184, 150, 46, .04);
  outline: none;
}
.dropzone.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: scale(1.005);
}
.dz-icon {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--brand);
  margin-bottom: 12px;
}
.dz-title {
  margin: 0 0 4px;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}
.dz-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border-sub);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}
.card h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: var(--text);
}

/* ---------- Status ---------- */
.status-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}
.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.status {
  color: var(--muted);
  margin: 0;
  min-height: 1.4em;
}
.status.error {
  color: var(--err);
}
.progress {
  width: 100%;
  height: 6px;
  background: var(--card-2);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
  transition: width 0.2s ease;
}

/* ---------- Result ---------- */
.result-file {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--muted);
  word-break: break-all;
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 0 0 20px;
}
.stats div {
  background: var(--bg-soft);
  border: 1px solid var(--border-sub);
  border-radius: 10px;
  padding: 12px 14px;
}
.stats dt {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}
.stats dd {
  margin: 0;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.2s ease, background 0.2s ease;
}
button:active {
  transform: scale(0.98);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #ffffff;
}
.primary:hover {
  opacity: 0.92;
}
.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.ghost:hover {
  border-color: var(--brand-2);
  background: var(--brand-soft);
}
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0;
  margin-top: 18px;
  font-weight: 500;
  font-size: 0.9rem;
}
.link-btn:hover {
  color: var(--brand);
}

.note {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 18px 0 0;
}
.note strong {
  color: var(--text);
}

.error-card h2 {
  color: var(--err);
}

/* ---------- How / footer ---------- */
.how {
  border: 1px solid var(--border-sub);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 28px;
  background: var(--card);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
}
.how summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}
.how p {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 12px 0 0;
}
.how em {
  color: var(--text);
  font-style: normal;
}

footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
footer .dot {
  color: var(--border);
}

@media (max-width: 520px) {
  main {
    padding: 32px 16px 40px;
  }
  header h1 {
    font-size: 1.55rem;
  }
  .actions {
    flex-direction: column;
  }
  .actions button {
    width: 100%;
  }
}
