/* ChainCost – Styles */

/* ═══════════════════════════════════════
   CSS VARIABLES (Design Tokens)
   ═══════════════════════════════════════ */
:root {
  /* Brand Colors */
  --brand-blue: #1E63B6;
  --brand-orange: #FF8A00;
  --accent-cyan: #00B4D8;
  --accent-warm-orange: #FFB347;
  --accent-gold: #F4C430;

  /* Neutral Colors */
  --text-primary: #1F2933;
  --text-secondary: #5F6368;
  --text-muted: #9AA0A6;
  --bg-primary: #FFFFFF;
  --bg-secondary: #F7F9FC;
  --border-light: #E5E7EB;

  /* Status Colors */
  --success: #16A34A;
  --warning: #F59E0B;
  --error: #DC2626;

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, #1E63B6 0%, #00B4D8 40%, #FF8A00 100%);
  --gradient-accent: linear-gradient(135deg, #FF8A00 0%, #FFB347 100%);

  /* Chain Colors */
  --chain-tron: #FF0013;
  --chain-solana: #9945FF;
  --chain-ethereum: #627EEA;
  --chain-polygon: #8247E5;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* ═══════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════ */
h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

h4 {
  font-size: 1rem;
}

.text-muted {
  color: var(--text-muted);
  font-weight: 400;
}

.text-secondary {
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════ */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

main {
  flex: 1;
  padding: var(--space-md) 0;
}

/* ═══════════════════════════════════════
   HEADER
   ═══════════════════════════════════════ */
.header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-xs) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
}

.logo-icon {
  width: 40px;
  height: 40px;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
}

.logo-text .chain {
  color: var(--brand-blue);
}

.logo-text .cost {
  color: var(--brand-orange);
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -4px;
}

.info-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
  font-size: 1.25rem;
}

.info-btn:hover {
  background: var(--bg-secondary);
  color: var(--brand-blue);
}

/* ═══════════════════════════════════════
   LANDING SECTION
   ═══════════════════════════════════════ */
.landing {
  text-align: center;
  padding: var(--space-lg) 0;
}

.landing h1 {
  margin-bottom: var(--space-md);
  font-size: 1.75rem;
}

.landing .subtitle {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  font-size: 0.9375rem;
}

/* ═══════════════════════════════════════
   CARDS
   ═══════════════════════════════════════ */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-md);
}

.card-header {
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
}

/* ═══════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════ */
.form-group {
  margin-bottom: var(--space-md);
}

.form-row {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.form-row .form-group {
  flex: 1;
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-size: 0.8125rem;
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-family: inherit;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(30, 99, 182, 0.1);
}

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

.input-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.input-with-suffix {
  position: relative;
}

.input-suffix {
  position: absolute;
  right: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-weight: 500;
  pointer-events: none;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--space-sm);
}

.tab {
  flex: 1;
  padding: 10px var(--space-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--brand-blue);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--brand-blue);
  border-radius: 2px 2px 0 0;
}

/* Tab Content */
.tab-content {
  display: none;
}

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

/* Swap Row */
.swap-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.swap-row .form-select {
  flex: 1;
}

.swap-on {
  color: var(--text-muted);
  font-size: 0.875rem;
  flex-shrink: 0;
}

/* Checkbox Group */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.checkbox-item {
  flex: 1 1 calc(50% - var(--space-sm));
  min-width: 140px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
  font-weight: 500;
}

.checkbox-label:hover {
  border-color: var(--brand-blue);
  background: var(--bg-secondary);
}

.checkbox-input {
  display: none;
}

.checkbox-input:checked+.checkbox-label {
  border-color: var(--brand-blue);
  background: rgba(30, 99, 182, 0.05);
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.checkbox-input:checked+.checkbox-label .checkbox-custom {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}

.checkbox-custom svg {
  width: 14px;
  height: 14px;
  color: white;
  opacity: 0;
  transition: var(--transition-fast);
}

.checkbox-input:checked+.checkbox-label .checkbox-custom svg {
  opacity: 1;
}

.chain-color {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}

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

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  color: var(--brand-blue);
  border: 2px solid var(--brand-blue);
}

.btn-secondary:hover {
  background: rgba(30, 99, 182, 0.05);
}

.btn-link {
  background: none;
  border: none;
  color: var(--brand-blue);
  padding: var(--space-sm);
  font-weight: 500;
}

.btn-link:hover {
  text-decoration: underline;
}

.btn-full {
  width: 100%;
}

/* ═══════════════════════════════════════
   RESULTS SECTION
   ═══════════════════════════════════════ */
.results-section {
  margin-top: var(--space-xl);
  scroll-margin-top: 60px;
  /* Account for sticky header on mobile scroll */
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.results-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.results-count {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Result Cards */
.result-card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  border: 2px solid transparent;
  transition: var(--transition-fast);
}

.result-card:hover {
  box-shadow: var(--shadow-md);
}

.result-card.cheapest {
  border-color: var(--success);
  background: linear-gradient(to right, rgba(22, 163, 74, 0.03), transparent);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.chain-info {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.chain-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 0.75rem;
}

.chain-name {
  font-weight: 600;
  font-size: 1rem;
}

.chain-symbol {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge {
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background: var(--success);
  color: white;
}

.badge-speed {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.result-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

.result-stat {
  text-align: center;
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value.highlight {
  color: var(--success);
}

.stat-value.fee {
  color: var(--error);
}

/* ═══════════════════════════════════════
   COMPARISON FOOTER
   ═══════════════════════════════════════ */
.comparison-footer {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-top: var(--space-lg);
  text-align: center;
}

.savings-text {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

.savings-amount {
  color: var(--success);
  font-weight: 700;
}

/* ═══════════════════════════════════════
   FEE BREAKDOWN
   ═══════════════════════════════════════ */
.breakdown-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md);
  background: none;
  border: none;
  color: var(--brand-blue);
  font-weight: 500;
  cursor: pointer;
  margin-top: var(--space-md);
}

.breakdown-toggle svg {
  transition: var(--transition-fast);
}

.breakdown-toggle.open svg {
  transform: rotate(180deg);
}

.breakdown-panel {
  display: none;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-light);
}

.breakdown-panel.open {
  display: block;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  font-size: 0.875rem;
}

.breakdown-label {
  color: var(--text-secondary);
}

.breakdown-value {
  font-weight: 500;
}

.breakdown-disclaimer {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ═══════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════ */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--brand-blue);
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
  margin-bottom: var(--space-md);
}

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

/* ═══════════════════════════════════════
   ERROR STATE
   ═══════════════════════════════════════ */
.error-message {
  background: rgba(220, 38, 38, 0.1);
  color: var(--error);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-top: var(--space-md);
}

/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */
.footer {
  background: var(--bg-primary);
  border-top: 1px solid var(--border-light);
  padding: var(--space-lg) 0;
  margin-top: auto;
}

.footer-content {
  text-align: center;
}

.footer-disclaimer {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--brand-blue);
}

/* ═══════════════════════════════════════
   MODAL
   ═══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-normal);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: var(--transition-normal);
}

.modal-overlay.open .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-sm);
  font-size: 1.5rem;
  line-height: 1;
}

.modal-body {
  padding: var(--space-lg);
}

.modal-body p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
  line-height: 1.6;
}

.modal-body ul {
  padding-left: var(--space-lg);
  color: var(--text-secondary);
}

.modal-body li {
  margin-bottom: var(--space-sm);
}

/* ═══════════════════════════════════════
   MANUAL FEE INPUT
   ═══════════════════════════════════════ */
.manual-fees {
  display: none;
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.manual-fees.visible {
  display: block;
}

.manual-fee-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.manual-fee-label {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
}

.manual-fee-input {
  width: 100px;
  padding: var(--space-sm);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  text-align: right;
}

/* ═══════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════ */

/* Tablet and up */
@media (min-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .landing {
    padding: var(--space-md) 0;
  }

  .landing h1 {
    font-size: 2rem;
  }

  .checkbox-item {
    flex: 0 1 auto;
    min-width: auto;
  }

  .result-body {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .app-layout {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: var(--space-lg);
    align-items: start;
  }

  .input-section {
    position: sticky;
    top: 80px;
  }

  .results-section {
    margin-top: 0;
  }
}

/* ═══════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════ */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* ═══════════════════════════════════════
   SEO CONTENT SECTION (SUBTLE)
   ═══════════════════════════════════════ */
.seo-content {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--space-2xl);
  border-top: 1px solid var(--border-light);
  padding-top: var(--space-xl);
}

.seo-content h2, 
.seo-content h3 {
  color: var(--text-secondary);
  font-size: 1.125rem;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
}

.seo-content h4 {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.seo-content p, 
.seo-content li {
  line-height: 1.6;
}

.seo-content strong {
  font-weight: 600;
  color: var(--text-secondary);
}
