/* Customs Checker home page. Buttons, forms, cards, modal chrome, and
   typography come from shared.css + css/components/*; only this page's
   unique layout and one-off elements live here.

   .reassess-btn shares the solid-yellow button look with the modal's
   .btn-yellow but needs its own soft/outlined variant below, so both
   selectors are defined together here rather than duplicated. */
.reassess-btn,
.btn-yellow {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--accent-yellow);
  color: #07090f;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 20px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: opacity var(--transition-fast), transform 0.1s;
}
.btn-yellow:hover, .reassess-btn:hover { opacity: 0.88; }
.btn-yellow:active, .reassess-btn:active { transform: scale(0.97); }
.btn-yellow:disabled, .reassess-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.reassess-btn {
  width: 100%;
  margin-top: 18px;
  background: rgba(232,197,71,0.1);
  color: var(--accent-yellow);
  border: 1px solid rgba(232,197,71,0.3);
  justify-content: center;
}
.reassess-btn:hover {
  background: rgba(232,197,71,0.18);
  border-color: rgba(232,197,71,0.5);
  opacity: 1;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 24px 60px;
  /* Gradient moved to ::before pseudo-element below so it is painted
     once and fixed — not repainted on every scroll frame. */
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(0,229,160,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 80% 90%, rgba(0,144,255,0.06) 0%, transparent 60%);
}

html.light body::before {
  background-image:
    radial-gradient(ellipse 60% 40% at 20% 10%, rgba(0,166,115,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 80% 90%, rgba(0,112,204,0.04) 0%, transparent 60%);
}

.page-top,
.wrapper,
.history-section {
  position: relative;
  z-index: 1;
}

.page-top {
  width: 100%;
  max-width: 420px;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
  margin-top: 8px;
}

.theme-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity var(--transition-fast);
}
.theme-btn:hover { opacity: 0.75; }

.wrapper { width: 100%; max-width: 420px; }

header { margin-bottom: 28px; }

h1 { font-size: 26px; }
h1 span { color: var(--accent-green); }

.result { display: none; }
.result.visible { display: block; }

.result-error {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--danger);
  font-size: 13px;
}

.article-id {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
  margin-bottom: 2px;
}

.receiver { font-size: 12px; color: var(--muted); margin-bottom: 18px; }

.fee-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.fee-row:last-child { border-bottom: none; }

.fee-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fee-value { font-size: 14px; font-weight: 500; color: var(--text); text-align: right; }

.fee-row.highlight .fee-label { color: var(--accent-green); }
.fee-row.highlight .fee-value {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-green);
}
.fee-row.secondary .fee-value { color: var(--accent-blue); }

.taxes-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 16px 0 4px;
}

.taxes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.tax-cell { background: var(--bg); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; transition: background var(--transition-base); }
.tax-cell-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.tax-cell-value { font-size: 14px; font-weight: 500; color: var(--text); }

.loading-msg { font-size: 13px; color: var(--muted); }

/* History */
.history-section { margin-top: 20px; width: 100%; max-width: 420px; }
.history-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.history-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); }
.history-clear {
  background: transparent; border: none; font-family: var(--font-mono); font-size: 10px;
  color: var(--muted); cursor: pointer; padding: 2px 4px; border-radius: 4px; transition: color var(--transition-fast);
}
.history-clear:hover { color: var(--danger); opacity: 1; transform: none; }
.history-list { display: flex; flex-direction: column; gap: 5px; }
.history-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 9px 13px; cursor: pointer; transition: opacity var(--transition-fast); gap: 10px;
}
.history-item:hover { opacity: 0.75; }
.history-item-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.history-id { font-size: 13px; font-weight: 500; color: var(--text); letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 10px; color: var(--muted); }
.history-amount { font-family: var(--font-sans); font-size: 13px; font-weight: 700; color: var(--accent-green); white-space: nowrap; flex-shrink: 0; }
.history-amount.zero { color: var(--muted); }

/* Reassessment wizard, modal-specific content */
.reassess-type-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.type-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 10px; text-align: center; cursor: pointer; transition: border-color var(--transition-fast), background var(--transition-fast); user-select: none; }
.type-card:hover { border-color: rgba(232,197,71,0.4); background: rgba(232,197,71,0.04); }
.type-card.selected { border-color: var(--accent-yellow); background: rgba(232,197,71,0.08); }
.type-card .type-icon { font-size: 22px; margin-bottom: 5px; }
.type-card .type-label { font-family: var(--font-sans); font-size: 11px; font-weight: 700; color: var(--muted); transition: color var(--transition-fast); }
.type-card.selected .type-label { color: var(--accent-yellow); }

.upload-zone { border: 1.5px dashed var(--border); border-radius: 10px; padding: 20px; text-align: center; cursor: pointer; transition: border-color var(--transition-base), background var(--transition-base); position: relative; }
.upload-zone:hover { border-color: rgba(232,197,71,0.5); background: rgba(232,197,71,0.03); }
.upload-zone.has-files { border-color: rgba(0,229,160,0.4); background: rgba(0,229,160,0.04); }
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-icon { font-size: 24px; margin-bottom: 6px; }
.upload-text { font-size: 12px; color: var(--muted); line-height: 1.5; }
.upload-text strong { color: var(--accent-yellow); font-family: var(--font-sans); }

.file-list { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.file-chip { display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px; font-size: 11px; color: var(--accent-green); }
.file-chip .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .remove-file { cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; padding: 0 2px; transition: color var(--transition-fast); background: transparent; border: none; font-family: var(--font-mono); }
.file-chip .remove-file:hover { color: var(--danger); }

.ai-spinner { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; padding: 24px 0; }

.letter-toolbar { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.letter-toolbar span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-right: 4px; }

.toolbar-btn {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px;
  font-family: var(--font-mono); font-size: 11px; color: var(--muted); cursor: pointer; transition: color var(--transition-fast), border-color var(--transition-fast);
}
.toolbar-btn:hover { color: var(--text); border-color: var(--muted); opacity: 1; }

#letterEditor {
  width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 16px;
  font-family: var(--font-mono); font-size: 13px; color: var(--text); line-height: 1.75; min-height: 360px;
  resize: vertical; outline: none; transition: border-color var(--transition-base); letter-spacing: 0.02em;
}
#letterEditor:focus { border-color: var(--accent-yellow); }

.receipts-preview { margin-top: 14px; }
.receipts-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-bottom: 8px; }
.receipts-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.receipt-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.receipt-doc-chip { display: flex; align-items: center; gap: 6px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 11px; color: var(--accent-green); max-width: 160px; }
.receipt-doc-chip .chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.print-footer-note { font-size: 11px; color: var(--muted); margin-top: 10px; line-height: 1.5; }

@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea {
    position: absolute; left: 0; top: 0; width: 100%; background: white; color: black;
    font-family: Georgia, serif; font-size: 13pt; line-height: 1.8; padding: 40px 60px;
  }
  #printArea .print-letter-body { white-space: pre-wrap; margin-bottom: 40px; }
  #printArea .print-receipt-title {
    font-size: 11pt; font-weight: bold; border-top: 1px solid #ccc; padding-top: 16px;
    margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  }
  #printArea img { max-width: 100%; max-height: 300px; object-fit: contain; display: block; margin: 10px 0; border: 1px solid #ddd; }
}