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

/* Garante que elementos com hidden fiquem invisíveis e sem espaço */
[hidden] { display: none !important; }

:root {
  --blue:        #004577;
  --blue-dark:   #003560;
  --blue-light:  #e8f1f8;
  --blue-mid:    #C2DDF3;
  --white:       #ffffff;
  --gray-50:     #f8fafc;
  --gray-100:    #f1f5f9;
  --gray-200:    #e2e8f0;
  --gray-400:    #94a3b8;
  --gray-600:    #475569;
  --gray-800:    #1e293b;
  --green:       #16a34a;
  --green-light: #dcfce7;
  --red:         #dc2626;
  --red-light:   #fee2e2;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0, 69, 119, 0.10);
  --shadow-sm:   0 1px 4px rgba(0, 69, 119, 0.08);
  --transition:  0.18s ease;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Archivo', system-ui, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────────── */
.header {
  background: var(--blue);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
}

.logo {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.header-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.25);
  flex-shrink: 0;
}

.header-title {
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  opacity: 0.92;
}

/* ── Main layout ──────────────────────────────────────────────── */
.main {
  flex: 1;
  padding: 36px 16px 48px;
  display: flex;
  justify-content: center;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 40px;
  width: 100%;
  max-width: 620px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* ── Section & Labels ─────────────────────────────────────────── */
.section { display: flex; flex-direction: column; gap: 10px; }

.label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.label-optional {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--gray-400);
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── Upload zone ──────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  text-align: center;
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-light);
}

.upload-icon {
  width: 40px;
  height: 40px;
  color: var(--gray-400);
  margin-bottom: 4px;
  transition: color var(--transition);
}

.upload-zone:hover .upload-icon,
.upload-zone.drag-over .upload-icon {
  color: var(--blue);
}

.upload-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-800);
}

.upload-subtext {
  font-size: 0.85rem;
  color: var(--gray-600);
}

.upload-link {
  color: var(--blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.upload-formats {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-top: 4px;
}

/* ── File badge (after selection) ────────────────────────────── */
.file-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--blue-light);
  border: 1px solid var(--blue-mid);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.file-badge-icon {
  width: 20px;
  height: 20px;
  color: var(--blue);
  flex-shrink: 0;
}

.file-badge-name {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--blue-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-badge-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--blue);
  opacity: 0.6;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: opacity var(--transition), background var(--transition);
}

.file-badge-remove:hover { opacity: 1; background: var(--blue-mid); }
.file-badge-remove svg { width: 16px; height: 16px; }

/* ── Type selector ────────────────────────────────────────────── */
.type-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.type-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.type-btn:hover {
  border-color: var(--blue);
  background: var(--blue-light);
}

.type-btn.active {
  border-color: var(--blue);
  background: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(0,69,119,0.10);
}

.type-icon {
  width: 26px;
  height: 26px;
  color: var(--gray-400);
  flex-shrink: 0;
  transition: color var(--transition);
}

.type-btn:hover .type-icon,
.type-btn.active .type-icon {
  color: var(--blue);
}

.type-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.type-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-800);
}

.type-desc {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.type-btn.active .type-label { color: var(--blue-dark); }

/* ── Textarea ─────────────────────────────────────────────────── */
.textarea {
  width: 100%;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'Archivo', sans-serif;
  font-size: 0.875rem;
  color: var(--gray-800);
  resize: vertical;
  min-height: 88px;
  line-height: 1.6;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--white);
}

.textarea::placeholder { color: var(--gray-400); }

.textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,69,119,0.10);
}

/* ── Generate button ──────────────────────────────────────────── */
.btn-generate {
  width: 100%;
  height: 52px;
  background: var(--blue);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Archivo', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: 0.01em;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(0,69,119,0.30);
}

.btn-generate:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0,69,119,0.36);
}

.btn-generate:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-generate svg { width: 20px; height: 20px; }

/* Spinner animation */
.spinner { animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Classe para esconder elementos sem tirar do layout */
.btn-hidden { display: none !important; }

/* ── Status area ──────────────────────────────────────────────── */
.status-area {
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.status-area.status-loading {
  background: var(--blue-light);
  border: 1px solid var(--blue-mid);
  color: var(--blue-dark);
}

.status-area.status-error {
  background: var(--red-light);
  border: 1px solid #fca5a5;
  color: var(--red);
}

.status-area.status-success {
  background: var(--green-light);
  border: 1px solid #86efac;
  color: var(--green);
}

.status-message { flex: 1; font-weight: 500; }

/* ── Download button ──────────────────────────────────────────── */
.btn-download {
  width: 100%;
  height: 52px;
  background: var(--white);
  color: var(--blue);
  border: 2px solid var(--blue);
  border-radius: var(--radius-sm);
  font-family: 'Archivo', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.btn-download:hover {
  background: var(--blue);
  color: var(--white);
  transform: translateY(-1px);
}

.btn-download svg { width: 20px; height: 20px; }

/* ── Footer ───────────────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 20px 16px;
  font-size: 0.78rem;
  color: var(--gray-400);
  border-top: 1px solid var(--gray-100);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 520px) {
  .card { padding: 24px 20px; gap: 22px; }
  .type-selector { grid-template-columns: 1fr; }
  .header-title { display: none; }
  .header-divider { display: none; }
  .upload-zone { padding: 28px 16px; }
}
