:root {
  --brl-green: #28a745;
  --eur-blue: #4a90e2;
  --usd-green: #00875f;
  --primary-color: var(--brl-green);
  --dark-bg: #1a1a1a;
  --card-bg: #2d2d2d;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --green: #00d4aa;
  --red: #ff6b6b;
  --yellow-warning: #f4b942;
  --border-radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --gradient: linear-gradient(135deg, var(--primary-color), var(--primary-color));
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--dark-bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Increase container width on larger screens for better comparison view */
@media (min-width: 1200px) {
  .container {
    max-width: 1200px;
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 1000px;
  }
}

/* Header Styles */
header {
  text-align: center;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 20px;
  background: var(--gradient);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 700;
}

/* View Toggle */
.view-toggle {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  background: var(--card-bg);
  padding: 8px;
  border-radius: var(--border-radius);
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

.view-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: transparent;
  border: 2px solid transparent;
  color: var(--text-secondary);
  border-radius: calc(var(--border-radius) - 4px);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  font-weight: 500;
}

.view-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.view-btn.active {
  background: linear-gradient(135deg, var(--primary-color), rgba(0, 0, 0, 0.1));
  border-color: var(--primary-color);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
}

.view-icon {
  font-size: 16px;
}

/* Currency Selector */
.currency-selector {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.currency-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  background: var(--card-bg);
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 120px;
  box-shadow: var(--shadow);
}

.currency-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
  border-color: var(--primary-color);
}

.currency-btn.active {
  border-color: var(--primary-color);
  background: linear-gradient(135deg, var(--primary-color), rgba(0, 0, 0, 0.1));
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.currency-symbol {
  font-size: 24px;
  font-weight: bold;
}

.currency-name-full {
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

.currency-name-short {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 1px;
}

/* Main Content */
main {
  flex: 1;
}

/* Single View */
.single-view {
  display: block;
}

.single-view.hidden {
  display: none;
}

/* Price Card */
.price-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 30px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.price-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  animation: slideRight 3s ease-in-out infinite;
}

@keyframes slideRight {
  0% {
    left: -100%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  50% {
    left: 0%;
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    left: 100%;
    opacity: 0;
  }
}

.currency-info {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.currency-flag {
  font-size: 48px;
}

.currency-details {
  flex: 1;
}

.currency-name {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 5px;
}

.currency-code {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 1px;
}

/* Exchange Rates */
.exchange-rates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .exchange-rates {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  h1 {
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    margin-bottom: 18px;
  }
}

.rate-item {
  text-align: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.rate-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}

.rate-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.last-updated {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 15px;
}

/* Converter Section */
.converter-section {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.converter-section h2 {
  font-size: 20px;
  margin-bottom: 20px;
  text-align: center;
  color: var(--text-primary);
}

.converter {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
}

.converter-row {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  max-width: 300px;
}

.converter-row input {
  flex: 2;
  padding: 12px 15px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 500;
}

.converter-row select {
  flex: 1;
  padding: 12px 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--border-radius);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.converter-row select:hover {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.converter-row input:focus,
.converter-row select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  transform: translateY(-1px);
}

.converter-arrow {
  font-size: 24px;
  color: var(--primary-color);
  margin: 5px 0;
}

/* Update Section */
.update-section {
  text-align: center;
  margin-bottom: 30px;
}

.update-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 30px;
  background: linear-gradient(135deg, var(--primary-color), rgba(0, 0, 0, 0.1));
  color: white;
  border: 2px solid var(--primary-color);
  border-radius: var(--border-radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.update-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
  background: linear-gradient(135deg, var(--primary-color), rgba(255, 255, 255, 0.1));
  border-color: var(--primary-color);
}

.update-btn:active:not(:disabled) {
  animation: buttonPress 0.2s ease;
}

.update-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  background: linear-gradient(135deg, var(--primary-color), rgba(0, 0, 0, 0.2));
}

.update-btn.loading {
  background: linear-gradient(135deg, var(--primary-color), rgba(0, 0, 0, 0.1));
  opacity: 0.8;
}

.update-btn.loading .update-icon {
  animation: spin 1s linear infinite;
}

.update-btn.success {
  background: linear-gradient(135deg, var(--green), rgba(0, 0, 0, 0.1));
  border-color: var(--green);
  animation: successPulse 0.6s ease;
}

.update-icon {
  font-size: 18px;
  transition: transform 0.3s ease;
}

/* Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  font-size: 14px;
  color: var(--text-secondary);
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: all 0.3s ease;
}

.status-dot.loading {
  background: var(--yellow-warning);
  animation: pulse 1.5s infinite;
  box-shadow: 0 0 10px rgba(255, 193, 7, 0.5);
}

.status-dot.success {
  background: var(--green);
  animation: successPulse 0.6s ease;
}

.status-dot.error {
  background: var(--red);
  animation: pulse 2s infinite;
}

.status-dot.warning {
  background: var(--yellow-warning);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes buttonPress {
  0% { transform: scale(1); }
  50% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

/* Comparison View */
.comparison-view {
  display: block;
}

.comparison-view.hidden {
  display: none;
}

.comparison-controls {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 25px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.comparison-controls h2 {
  font-size: 24px;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.comparison-note {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 14px;
}

.currency-checkboxes {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.currency-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid rgba(255, 255, 255, 0.1);
  min-width: 170px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.currency-checkbox:hover {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.currency-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.currency-checkbox .custom-checkbox {
  position: relative;
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.currency-checkbox input[type="checkbox"]:checked + .custom-checkbox {
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: scale(1.1);
}

.currency-checkbox input[type="checkbox"]:checked + .custom-checkbox::after {
  content: '✓';
  color: white;
  font-size: 12px;
  font-weight: bold;
  animation: checkmark 0.3s ease-in-out;
}

@keyframes checkmark {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.currency-checkbox input[type="checkbox"]:checked ~ .currency-symbol {
  color: var(--primary-color);
}

/* Comparison Cards */
.comparison-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

/* When only message card is shown, use block layout to match comparison-controls */
.comparison-cards.message-only {
  display: block;
}

.comparison-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 25px;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.comparison-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.comparison-header {
  display: flex;
  align-items: center;
  gap: 15px;
}

.comparison-header .currency-flag {
  font-size: 32px;
}

.comparison-header .currency-info {
  flex: 1;
}

.comparison-header .currency-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 2px;
}

.comparison-header .currency-code {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.comparison-rates {
  margin-bottom: 15px;
}

.comparison-rate {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.comparison-rate:last-child {
  border-bottom: none;
}

.to-currency {
  font-size: 14px;
  font-weight: 500;
}

.rate-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.comparison-updated {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.comparison-update-section {
  text-align: center;
  margin-bottom: 20px;
}

/* Comparison Message Card */
.comparison-message-card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 40px 20px;
  box-shadow: var(--shadow);
  border: 2px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  margin: 0 auto;
}

.comparison-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.message-icon {
  font-size: 48px;
  opacity: 0.7;
}

.message-text {
  font-size: 16px;
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.4;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px 0;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
  color: var(--text-secondary);
  font-size: 14px;
}

footer a {
  color: var(--primary-color);
  text-decoration: underline;
}

footer a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* Utility Classes */
.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;
}

.hidden {
  display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  h1 {
    font-size: 1.8rem;
  }

  .currency-selector {
    gap: 10px;
  }

  .currency-btn {
    min-width: 100px;
    padding: 12px 15px;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
  }

  .currency-symbol {
    font-size: 20px;
  }

  .currency-name-full {
    font-size: 12px;
  }

  .price-card {
    padding: 20px;
  }

  .currency-flag {
    font-size: 36px;
  }

  .currency-name {
    font-size: 20px;
  }

  .rate-value {
    font-size: 24px;
  }

  .currency-checkboxes {
    gap: 10px;
  }

  .currency-checkbox {
    min-width: 140px;
    padding: 12px;
    justify-content: center;
  }

  .comparison-cards {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: clamp(1.4rem, 4vw, 1.8rem);
    margin-bottom: 15px;
  }

  .view-btn {
    padding: 10px 15px;
    font-size: 12px;
  }

  .currency-selector {
    gap: 8px;
  }

  .currency-btn {
    min-width: 80px;
    padding: 8px;
    flex-direction: row;
    justify-content: center;
    gap: 4px;
  }

  .currency-name-full {
    display: none;
  }

  .currency-symbol {
    font-size: 18px;
  }

  .currency-name-short {
    font-size: 11px;
  }

  .converter-row {
    flex-direction: column;
    gap: 8px;
  }

  .converter-row input,
  .converter-row select {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .converter-row select {
    background-size: 18px;
    padding-right: 44px;
  }

  .comparison-message-card {
    padding: 30px 15px;
    margin: 0 auto;
  }

  .message-icon {
    font-size: 36px;
  }

  .message-text {
    font-size: 14px;
  }
}
