/* ============================================================
   TARIFF REFUND ANALYZER - LIGHT PREMIUM THEME
   Navy (#20334C) + Gold (#C8A74E) on light background
   ============================================================ */

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

:root {
  --navy: #20334C;
  --navy-light: #3a5068;
  --gold: #C8A74E;
  --gold-light: #d9be76;
  --gold-dark: #a8893d;
  
  --bg: #f8f9fb;
  --bg-card: #ffffff;
  --bg-subtle: #f1f3f7;
  
  --text: #20334C;
  --text-secondary: #5a6a7e;
  --text-muted: #8b98a8;
  
  --border: #e2e6ec;
  --border-hover: #c8cdd6;
  
  --success: #0d9f6f;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  
  --shadow-sm: 0 1px 2px rgba(32, 51, 76, 0.05);
  --shadow: 0 4px 12px rgba(32, 51, 76, 0.08);
  --shadow-lg: 0 12px 40px rgba(32, 51, 76, 0.12);
  
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-icon {
  font-size: 1.5rem;
  color: var(--gold);
}

.logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--navy);
}

.logo-text span {
  color: var(--gold);
}

.legal-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 0.5rem 1rem;
  border-radius: 100px;
}

.legal-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, #2d4560 100%);
  padding: 4rem 2rem;
  text-align: center;
}

.hero-content {
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.75rem;
  font-weight: 700;
  color: white;
  margin: 0 0 1rem;
  line-height: 1.2;
}

.hero h1 span {
  color: var(--gold);
}

.hero-sub {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.75);
  margin: 0;
  font-weight: 400;
}

/* ============================================================
   MAIN GRID
   ============================================================ */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 2rem;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* ============================================================
   LEFT COLUMN - UPLOAD
   ============================================================ */
.upload-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.upload-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.upload-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.step-badge {
  width: 28px;
  height: 28px;
  background: var(--navy);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.upload-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg-subtle);
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--gold);
  background: rgba(200, 167, 78, 0.05);
}

.upload-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.upload-svg {
  width: 48px;
  height: 48px;
  color: var(--gold);
}

.upload-text {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.upload-text strong {
  color: var(--navy);
  font-size: 15px;
}

.upload-text span {
  color: var(--text-muted);
  font-size: 13px;
}

.upload-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 12px;
}

.upload-divider::before,
.upload-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.upload-actions {
  display: flex;
  gap: 0.75rem;
}

.upload-actions .btn {
  flex: 1;
}

.paste-area {
  margin-top: 1rem;
}

.paste-area textarea {
  width: 100%;
  height: 140px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  background: var(--bg-subtle);
}

.paste-area textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.paste-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Info Card */
.info-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
}

.info-card h3 {
  margin: 0 0 1rem;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.check-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.check {
  color: var(--success);
  font-weight: 600;
}

.info-note {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* ============================================================
   RIGHT COLUMN - RESULTS
   ============================================================ */
.results-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.results-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.placeholder-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  color: var(--border);
}

.placeholder-icon svg {
  width: 100%;
  height: 100%;
}

.results-placeholder h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  color: var(--navy);
}

.results-placeholder p {
  margin: 0;
  color: var(--text-muted);
  max-width: 300px;
}

/* Sample Banner */
.sample-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--warning-bg);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--warning);
}

.sample-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Summary Row */
.summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.summary-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.summary-card.primary {
  background: linear-gradient(135deg, var(--navy) 0%, #2d4560 100%);
  border: none;
}

.summary-card.primary .summary-label {
  color: rgba(255,255,255,0.7);
}

.summary-card.primary .summary-value {
  color: var(--gold);
}

.summary-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

.summary-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy);
}

/* Data Section */
.data-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.data-tabs {
  display: flex;
  gap: 0.25rem;
}

.data-tab {
  background: none;
  border: none;
  padding: 0.625rem 1rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.data-tab:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.data-tab.active {
  color: var(--navy);
  background: var(--bg-subtle);
}

.data-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-input {
  padding: 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 160px;
  transition: all 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--gold);
}

.filter-select {
  padding: 0.5rem 2rem 0.5rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a6a7e'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  appearance: none;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--gold);
}

.data-content {
  display: none;
}

.data-content.active {
  display: block;
}

.filter-row {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem 0;
}

/* Table */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead tr {
  background: var(--bg-subtle);
}

th {
  padding: 0.875rem 1.25rem;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
}

th:hover {
  color: var(--navy);
}

td {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

tr:hover td {
  background: var(--bg-subtle);
}

td:first-child {
  font-weight: 500;
  color: var(--navy);
}

.code-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: rgba(200, 167, 78, 0.1);
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
}

.type-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
}

.type-tag.ch99 {
  background: var(--success-bg);
  color: var(--success);
}

.type-tag.standard {
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.amount-refund {
  color: var(--success);
  font-weight: 600;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.page-btn {
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
}

.page-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Reference Grid */
.reference-grid {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

.ref-card {
  padding: 1.25rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
}

.ref-card h4 {
  margin: 0 0 0.5rem;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.ref-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.ref-note {
  margin-top: 0.5rem !important;
  font-size: 12px !important;
  color: var(--text-muted) !important;
}

.code-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.code-examples code {
  padding: 0.25rem 0.5rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--gold-dark);
}

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

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
  opacity: 0.3;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--gold);
  color: white;
  border-color: var(--gold);
}

.btn-primary:hover {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
}

.btn-secondary {
  background: var(--navy);
  color: white;
  border-color: var(--navy);
}

.btn-secondary:hover {
  background: var(--navy-light);
  border-color: var(--navy-light);
}

.btn-outline {
  background: white;
  color: var(--navy);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--navy);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-subtle);
}

.btn-icon {
  padding: 0.5rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 14px;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 51, 76, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: modalIn 0.3s ease-out;
}

@keyframes modalIn {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg-subtle);
  border-radius: 50%;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.modal-box h2 {
  margin: 0 0 0.5rem;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  color: var(--navy);
}

@keyframes countPop {
  0% { transform: scale(0.8); opacity: 0; }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.modal-box p {
  color: var(--text-secondary);
  margin: 0 0 1.5rem;
  font-size: 14px;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0.75rem 0 1.5rem;
}

.modal-range-wrap {
  margin: 1rem 0 0.5rem;
}

.modal-range-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.modal-range-amounts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.modal-amount {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  color: var(--success);
}

.modal-amount-low {
  font-size: 2rem;
  opacity: 0.75;
}

.modal-amount-high {
  font-size: 2.5rem;
}

.modal-range-dash {
  font-size: 1.5rem;
  color: var(--text-muted);
}

.lead-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

.lead-input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.lead-input:focus {
  outline: none;
  border-color: var(--navy);
}

.lead-error {
  color: #dc2626;
  font-size: 13px;
  text-align: center;
}

.lead-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.25rem 0;
}

.lead-check-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.4;
}

.lead-check-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--navy);
  cursor: pointer;
}

/* ============================================================
   LOADER
   ============================================================ */
#loader-overlay > div {
  background: white !important;
  border-radius: var(--radius) !important;
  padding: 2rem 3rem !important;
  box-shadow: var(--shadow-lg) !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  
  .upload-section {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
  }
  
  .results-placeholder {
    display: none;
  }
}

@media (max-width: 768px) {
  .hero h1 {
    font-size: 2rem;
  }
  
  .summary-row {
    grid-template-columns: 1fr;
  }
  
  .data-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .data-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  
  .search-input {
    flex: 1;
    min-width: 140px;
  }
}

@media (max-width: 480px) {
  .topbar {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .hero {
    padding: 2.5rem 1.5rem;
  }
  
  .main-grid {
    padding: 1rem;
  }
  
  .upload-actions {
    flex-direction: column;
  }
}
