/* Define CSS variables for theming */
:root {
  --bg-color: #ffffff;
  --text-color: #1f2933;
  --card-bg: #f3f4f6;
  --card-border: #e5e7eb;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --error: #dc2626;
  --text-secondary: #6b7280;
  --input-bg: #ffffff;
  --input-border: #d1d5db;
}

/* Dark mode styles */
body.dark {
  --bg-color: #111827;
  --text-color: #f9fafb;
  --card-bg: #1f2933;
  --card-border: #374151;
  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --text-secondary: #d1d5db;
  --input-bg: #1f2933;
  --input-border: #4b5563;
}

/* Base styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Header styles */
.header {
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-link {
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.logo-link:hover {
  opacity: 0.8;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--accent);
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.theme-toggle:hover {
  background-color: var(--card-bg);
}

/* Main container */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Hero section */
.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.hero-title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: var(--text-color);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Card component */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.converter-card {
  margin-bottom: 2rem;
}

/* Form styles */
.converter-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.form-group label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-color);
}

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

.amount-input,
.result-input,
.currency-select {
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background-color: var(--input-bg);
  color: var(--text-color);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.amount-input:focus,
.result-input:focus,
.currency-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.amount-input,
.result-input {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 600;
}

.result-input {
  cursor: default;
}

.currency-select {
  flex: 0 0 100px;
  font-weight: 500;
}

/* Swap button */
.swap-btn {
  align-self: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--card-border);
  background-color: var(--card-bg);
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-color);
}

.swap-btn:hover {
  background-color: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: rotate(180deg);
}

/* Error message */
.error-message {
  color: var(--error);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  min-height: 1.4rem;
}

/* Primary button */
.primary-btn {
  padding: 0.875rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  background-color: var(--accent);
  color: white;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  width: 100%;
}

.primary-btn:hover {
  background-color: var(--accent-hover);
}

.primary-btn:active {
  transform: scale(0.98);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Rate info */
.rate-info {
  text-align: center;
  padding-top: 1rem;
  border-top: 1px solid var(--card-border);
}

.rate-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Trust section */
.trust-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.trust-item {
  text-align: center;
}

.trust-item h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
  color: var(--text-color);
}

.trust-item p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  border-top: 1px solid var(--card-border);
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 2rem;
}

.footer a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  text-decoration: underline;
}

/* Price Comparison Section */
.comparison-section {
  margin: 3rem 0;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 0.5rem 0;
  color: var(--text-color);
}

.section-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin: 0 0 2rem 0;
}

.comparison-table {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-x: auto;
}

.comparison-header {
  display: grid;
  grid-template-columns: 200px repeat(4, 1fr);
  gap: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--card-border);
  margin-bottom: 1rem;
}

.comparison-header .comparison-cell {
  text-align: center;
  font-weight: 600;
}

.provider-logo {
  font-size: 2rem;
  margin-bottom: 0.25rem;
}

.provider-name {
  font-size: 0.9rem;
  color: var(--text-color);
}

.comparison-row {
  display: grid;
  grid-template-columns: 200px repeat(4, 1fr);
  gap: 0.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--card-border);
  align-items: center;
}

.comparison-row:last-of-type {
  border-bottom: none;
}

.total-row {
  background-color: rgba(37, 99, 235, 0.05);
  border-radius: 6px;
  padding: 1.25rem 0;
  margin-top: 0.5rem;
}

.comparison-label {
  font-size: 0.9rem;
  color: var(--text-color);
  padding-left: 0.5rem;
}

.sublabel {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.comparison-value {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
  padding: 0.5rem;
  border-radius: 6px;
}

.comparison-value.highlight {
  background-color: #d4f4dd;
  color: #166534;
  font-weight: 700;
}

body.dark .comparison-value.highlight {
  background-color: #166534;
  color: #d4f4dd;
}

.comparison-value.markup {
  color: var(--error);
  font-size: 0.95rem;
}

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

.comparison-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  font-style: italic;
}

/* Responsive design */
@media (max-width: 600px) {
  .hero-title {
    font-size: 1.5rem;
  }

  .card {
    padding: 1.5rem;
  }

  .converter-form {
    gap: 1rem;
  }

  .input-wrapper {
    flex-direction: column;
  }

  .currency-select {
    flex: 1;
    width: 100%;
  }

  .trust-section {
    grid-template-columns: 1fr;
  }

  .comparison-header,
  .comparison-row {
    grid-template-columns: 150px repeat(4, 1fr);
    font-size: 0.85rem;
  }

  .comparison-label {
    font-size: 0.8rem;
  }

  .comparison-value {
    font-size: 0.9rem;
    padding: 0.25rem;
  }

  .provider-logo {
    font-size: 1.5rem;
  }

  .provider-name {
    font-size: 0.75rem;
  }

  .section-title {
    font-size: 1.25rem;
  }
}