/* ═══════════════════════════════════════════════════════════════
   Mioquadros Simulador de Frete — app.css
   Tema claro, profissional, limpo e harmonioso
═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --color-bg:           #f5f6f8;
  --color-white:        #ffffff;
  --color-surface:      #ffffff;
  --color-border:       #e2e5ea;
  --color-border-dark:  #c8cdd6;

  --color-primary:      #1a56db;
  --color-primary-hover:#1447c0;

  --color-text:         #111827;
  --color-text-muted:   #6b7280;
  --color-text-subtle:  #9ca3af;

  --color-danger:       #dc2626;
  --color-danger-bg:    #fef2f2;
  --color-danger-border:#fecaca;

  --color-success:      #16a34a;

  --font-body:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;

  --shadow-xs:  0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.05);

  --transition: 150ms ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
ul { list-style: none; }

/* ── Focus styles ──────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Container ─────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 780px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* ── Header ────────────────────────────────────────────────── */
.site-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  padding: 0.875rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-logo {
  height: 36px;
  width: auto;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--color-border-dark);
}

.brand-section {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
}

/* ── Page title area ───────────────────────────────────────── */
.page-hero {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  padding: 2rem 0 1.75rem;
}

.page-hero h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.page-hero p {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

/* ── Main ──────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 2rem 0 3.5rem;
}

/* ── Simulator Card (Primary element) ──────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 1.25rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px solid var(--color-border);
}

/* ── Origin Info Bar (Read-only / Informative) ─────────────── */
.origin-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.875rem;
  margin-bottom: 1.25rem;
}

.origin-info-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.origin-info-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.origin-info-value {
  font-size: 0.875rem;
  color: var(--color-text);
}

.origin-info-value strong {
  font-weight: 600;
  color: var(--color-text);
}

.origin-info-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

/* ── Form ──────────────────────────────────────────────────── */
.form-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  margin-bottom: 1rem;
}

@media (min-width: 580px) {
  .form-row { grid-template-columns: repeat(3, 1fr); }
  .form-group--wide { grid-column: span 2; }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.unit-badge {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  padding: 1px 5px;
  border-radius: 3px;
}

.input-wrapper { position: relative; }

.input-prefix {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: none;
  user-select: none;
}

.form-input {
  width: 100%;
  background: var(--color-white);
  border: 1px solid var(--color-border-dark);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.9375rem;
  padding: 0.5625rem 0.75rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

.form-input--prefixed { padding-left: 2.25rem; }

.form-input::placeholder { color: var(--color-text-subtle); }

.form-input:hover { border-color: #9ca3af; }

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

.form-input.is-invalid {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}

.form-input[type=number]::-webkit-outer-spin-button,
.form-input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
.form-input[type=number] { -moz-appearance: textfield; }

.field-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.field-error {
  font-size: 0.75rem;
  color: var(--color-danger);
  font-weight: 500;
  min-height: 1rem;
  display: block;
}

/* ── Divider ───────────────────────────────────────────────── */
.form-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.25rem 0;
}

/* ── Button ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.625rem 1.5rem;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: var(--shadow-xs);
  margin-top: 1.25rem;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-md);
}

.btn-primary:active { transform: translateY(1px); }

.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

/* Spinner */
.btn-loader {
  display: none;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.btn.loading .btn-text { display: none; }
.btn.loading .btn-loader { display: block; }

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

/* ── Integrated Results Area (inside card) ─────────────────── */
.results-area {
  animation: fadeIn .25s ease;
}

.results-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.75rem 0 1.5rem;
}

.results-header {
  margin-bottom: 0.875rem;
}

.results-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ── Quotes Table ──────────────────────────────────────────── */
.quotes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.quotes-table th {
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.625rem 1rem;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.quotes-table th:last-child,
.quotes-table td:last-child { text-align: right; }

.quotes-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.quotes-table tr:last-child td { border-bottom: none; }

.quotes-table tr:hover td { background: #fafafa; }

.quote-carrier-name {
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.quote-service-name {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 1px;
}

.quote-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
}

.quote-deadline {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.best-badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-success);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ── Disclaimer ────────────────────────────────────────────── */
.disclaimer {
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  margin-top: 0.875rem;
  line-height: 1.6;
}

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--color-text-muted);
}

.empty-icon { font-size: 2rem; margin-bottom: 0.75rem; }

.empty-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.empty-desc { font-size: 0.875rem; }

/* ── Global error ──────────────────────────────────────────── */
.global-error {
  background: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  border-radius: var(--radius-md);
  color: var(--color-danger);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 1rem;
}

/* ── Section Separator ─────────────────────────────────────── */
.section-separator {
  margin: 3rem 0 2.5rem;
  border-top: 1px solid var(--color-border);
}

/* ── Documentation Section (Subordinated level) ────────────── */
.docs-section {
  padding: 0 0.25rem;
}

.docs-header {
  margin-bottom: 1.5rem;
}

.docs-main-title {
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.docs-intro {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.65;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

@media (min-width: 620px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .info-block--full {
    grid-column: 1 / -1;
  }
}

.info-block {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-block-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.35;
}

.info-block p {
  font-size: 0.8125rem;
  color: #4b5563;
  line-height: 1.55;
}

.info-summary-box {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-md);
  padding: 0.875rem 1.25rem;
  margin-top: 1.25rem;
  box-shadow: var(--shadow-xs);
}

.info-summary-box p {
  font-size: 0.8125rem;
  color: var(--color-text);
  line-height: 1.55;
}

.info-summary-box strong {
  color: var(--color-text);
  font-weight: 600;
}

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  padding: 1.25rem 0;
  border-top: 1px solid var(--color-border);
  background: var(--color-white);
}

.footer-text {
  color: var(--color-text-subtle);
  font-size: 0.75rem;
  text-align: center;
}

/* ── Utility ───────────────────────────────────────────────── */
[hidden] { display: none !important; }
