/* Modern Professional Currency Converter Styles */

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

:root {
  /* Light theme colors */
  --primary-color: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #3b82f6;
  --secondary-color: #64748b;
  --success-color: #059669;
  --warning-color: #d97706;
  --error-color: #dc2626;
  --background-color: #f8fafc;
  --card-background: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Light theme gradients */
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --feature-bg: rgba(255, 255, 255, 0.95);
  --header-bg: rgba(255, 255, 255, 0.95);
  --footer-bg: rgba(255, 255, 255, 0.95);
}

/* Dark theme colors */
[data-theme="dark"] {
  --primary-color: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #60a5fa;
  --secondary-color: #94a3b8;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --background-color: #0f172a;
  --card-background: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.5);
  
  /* Dark theme gradients */
  --bg-gradient: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
  --card-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --feature-bg: rgba(30, 41, 59, 0.95);
  --header-bg: rgba(30, 41, 59, 0.95);
  --footer-bg: rgba(30, 41, 59, 0.95);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 16px;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: var(--transition);
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
  transition: var(--transition);
}

[data-theme="dark"] body::before {
  background: 
    radial-gradient(circle at 20% 80%, rgba(59, 130, 246, 0.2) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(168, 85, 247, 0.2) 0%, transparent 50%);
}

/* Header */
.app-header {
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: var(--transition);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.logo i {
  font-size: 2rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  background: var(--card-background);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
  font-size: 1rem;
}

.theme-toggle:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: scale(1.05);
}

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-icon {
  transition: var(--transition);
}

[data-theme="dark"] .theme-toggle .fa-moon {
  display: none;
}

[data-theme="dark"] .theme-toggle::before {
  content: '\f185';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--success-color);
  font-weight: 500;
  font-size: 0.875rem;
}

.pulse {
  width: 8px;
  height: 8px;
  background: var(--success-color);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

/* Main Container */
.main-container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Converter Card */
.converter-card {
  background: var(--card-background);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transition: var(--transition);
}

.converter-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

.card-header {
  background: var(--card-gradient);
  color: white;
  padding: 2rem;
  text-align: center;
}

.card-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.subtitle {
  opacity: 0.9;
  font-size: 1rem;
}

.converter-body {
  padding: 2rem;
}

/* Input Section */
.input-section {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.currency-input-group {
  display: flex;
  flex-direction: column;
}

.currency-input-group label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrapper {
  position: relative;
}

.currency-select {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--card-background);
  color: var(--text-primary);
  appearance: none;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

.currency-select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.select-arrow {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  transition: var(--transition);
}

.currency-select:focus + .select-arrow {
  color: var(--primary-color);
  transform: translateY(-50%) rotate(180deg);
}

/* Swap Button */
.swap-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.swap-btn {
  width: 48px;
  height: 48px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  background: var(--card-background);
  color: var(--primary-color);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

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

/* Amount Section */
.amount-section {
  margin-bottom: 2rem;
}

.amount-section label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.amount-input-wrapper {
  position: relative;
}

#amount {
  width: 100%;
  padding: 1rem 3rem 1rem 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--card-background);
  color: var(--text-primary);
  transition: var(--transition);
}

#amount:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.currency-symbol {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Convert Button */
.convert-btn {
  width: 100%;
  padding: 1rem 2rem;
  background: var(--card-gradient);
  color: white;
  border: none;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
}

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

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

.convert-btn.loading .btn-text,
.convert-btn.loading .btn-icon {
  opacity: 0;
}

.convert-btn.loading .btn-loader {
  opacity: 1;
}

.btn-loader {
  position: absolute;
  opacity: 0;
  transition: var(--transition);
}

/* Result Section */
.result-section {
  text-align: center;
}

.result {
  background: var(--feature-bg);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(10px);
  transition: var(--transition);
}

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

.result-placeholder i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.result-placeholder p {
  font-size: 1.1rem;
}

.result-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--success-color);
  margin-bottom: 0.5rem;
}

.result-text {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.exchange-rate {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.last-updated {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.feature-card {
  background: var(--feature-bg);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  border: 1px solid var(--border-color);
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.feature-card i {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.feature-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Footer */
.app-footer {
  background: var(--footer-bg);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  padding: 2rem;
  text-align: center;
  margin-top: 4rem;
  color: var(--text-secondary);
  transition: var(--transition);
}

.disclaimer {
  font-size: 0.75rem;
  margin-top: 0.5rem;
  opacity: 0.8;
}

/* Responsive Design - Mobile First Approach */
@media (max-width: 1024px) {
  .main-container {
    max-width: 90%;
    padding: 0 1rem;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  
  .header-content {
    padding: 0 1rem;
    flex-direction: row;
    justify-content: space-between;
  }
  
  .header-actions {
    gap: 0.75rem;
  }
  
  .theme-toggle {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }
  
  .logo {
    font-size: 1.25rem;
  }
  
  .logo i {
    font-size: 1.5rem;
  }
  
  .live-indicator {
    font-size: 0.75rem;
  }
  
  .main-container {
    padding: 0 1rem;
    margin: 1rem auto;
  }
  
  .converter-card {
    margin: 0;
    border-radius: var(--radius-lg);
  }
  
  .card-header {
    padding: 1.5rem 1rem;
  }
  
  .card-header h1 {
    font-size: 1.5rem;
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .card-header h1 i {
    font-size: 2rem;
  }
  
  .subtitle {
    font-size: 0.875rem;
    margin-top: 0.5rem;
  }
  
  .converter-body {
    padding: 1.5rem 1rem;
  }
  
  .input-section {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
  }
  
  .swap-container {
    order: 2;
    margin: 1rem 0;
    justify-self: center;
  }
  
  .currency-input-group:first-child {
    order: 1;
  }
  
  .currency-input-group:last-child {
    order: 3;
  }
  
  .currency-select {
    padding: 1rem 0.75rem;
    font-size: 1rem;
  }
  
  #amount {
    padding: 1rem;
    font-size: 1.1rem;
  }
  
  .convert-btn {
    padding: 1rem;
    font-size: 1rem;
    margin-bottom: 2rem;
  }
  
  .result {
    padding: 1.5rem;
  }
  
  .result-value {
    font-size: 2rem;
  }
  
  .result-text {
    font-size: 1rem;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 2rem 0;
  }
  
  .feature-card {
    padding: 1.5rem;
  }
  
  .feature-card i {
    font-size: 2rem;
  }
  
  .feature-card h3 {
    font-size: 1.1rem;
  }
  
  .app-footer {
    padding: 1.5rem 1rem;
    margin-top: 2rem;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }
  
  .app-header {
    padding: 0.75rem 0;
  }
  
  .header-content {
    padding: 0 0.75rem;
  }
  
  .header-actions {
    gap: 0.5rem;
  }
  
  .theme-toggle {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }
  
  .logo span {
    display: none;
  }
  
  .logo {
    font-size: 1rem;
  }
  
  .logo i {
    font-size: 1.25rem;
  }
  
  .live-indicator {
    font-size: 0.7rem;
  }
  
  .main-container {
    padding: 0 0.75rem;
    margin: 0.75rem auto;
  }
  
  .converter-card {
    box-shadow: var(--shadow-md);
  }
  
  .card-header {
    padding: 1.25rem 0.75rem;
  }
  
  .card-header h1 {
    font-size: 1.25rem;
  }
  
  .card-header h1 i {
    font-size: 1.5rem;
  }
  
  .subtitle {
    font-size: 0.8rem;
  }
  
  .converter-body {
    padding: 1.25rem 0.75rem;
  }
  
  .currency-input-group label {
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
  }
  
  .currency-select {
    padding: 0.9rem 0.6rem;
    font-size: 0.9rem;
  }
  
  .select-arrow {
    right: 0.75rem;
    font-size: 0.8rem;
  }
  
  .swap-btn {
    width: 44px;
    height: 44px;
    font-size: 1rem;
  }
  
  .amount-section label {
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
  }
  
  #amount {
    padding: 0.9rem 2.5rem 0.9rem 0.9rem;
    font-size: 1rem;
  }
  
  .currency-symbol {
    right: 0.75rem;
    font-size: 1rem;
  }
  
  .convert-btn {
    padding: 0.9rem 1.5rem;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
  }
  
  .btn-text {
    display: block;
  }
  
  .btn-icon {
    display: none;
  }
  
  .result {
    padding: 1.25rem 0.75rem;
  }
  
  .result-placeholder i {
    font-size: 2rem;
  }
  
  .result-placeholder p {
    font-size: 0.95rem;
  }
  
  .result-value {
    font-size: 1.75rem;
    word-break: break-all;
  }
  
  .result-text {
    font-size: 0.9rem;
  }
  
  .exchange-rate {
    font-size: 0.8rem;
  }
  
  .last-updated {
    font-size: 0.7rem;
  }
  
  .features-grid {
    margin: 1.5rem 0;
    gap: 0.75rem;
  }
  
  .feature-card {
    padding: 1.25rem 0.75rem;
  }
  
  .feature-card i {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
  }
  
  .feature-card h3 {
    font-size: 1rem;
    margin-bottom: 0.4rem;
  }
  
  .feature-card p {
    font-size: 0.8rem;
  }
  
  .app-footer {
    padding: 1.25rem 0.75rem;
    margin-top: 1.5rem;
  }
  
  .app-footer p {
    font-size: 0.8rem;
  }
  
  .disclaimer {
    font-size: 0.7rem;
  }
}

@media (max-width: 360px) {
  .main-container {
    padding: 0 0.5rem;
  }
  
  .converter-card {
    border-radius: var(--radius-md);
  }
  
  .card-header {
    padding: 1rem 0.5rem;
  }
  
  .card-header h1 {
    font-size: 1.1rem;
  }
  
  .subtitle {
    font-size: 0.75rem;
  }
  
  .converter-body {
    padding: 1rem 0.5rem;
  }
  
  .currency-select,
  #amount {
    padding: 0.8rem 0.5rem;
    font-size: 0.85rem;
  }
  
  #amount {
    padding-right: 2.25rem;
  }
  
  .currency-symbol {
    right: 0.5rem;
    font-size: 0.9rem;
  }
  
  .convert-btn {
    padding: 0.8rem 1rem;
    font-size: 0.9rem;
  }
  
  .result {
    padding: 1rem 0.5rem;
  }
  
  .result-value {
    font-size: 1.5rem;
    line-height: 1.2;
    word-break: break-word;
  }
  
  .features-grid {
    gap: 0.5rem;
  }
  
  .feature-card {
    padding: 1rem 0.5rem;
  }
  
  .app-footer {
    padding: 1rem 0.5rem;
  }
}

/* Landscape orientation for mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .main-container {
    margin: 0.5rem auto;
  }
  
  .card-header {
    padding: 1rem;
  }
  
  .card-header h1 {
    font-size: 1.4rem;
    flex-direction: row;
    gap: 0.5rem;
  }
  
  .converter-body {
    padding: 1rem;
  }
  
  .input-section {
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: end;
  }
  
  .swap-container {
    order: initial;
    margin: 0;
  }
  
  .currency-input-group:first-child {
    order: initial;
  }
  
  .currency-input-group:last-child {
    order: initial;
  }
  
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }
  
  .feature-card {
    padding: 1rem;
  }
  
  .feature-card i {
    font-size: 1.5rem;
  }
  
  .feature-card h3 {
    font-size: 0.9rem;
  }
  
  .feature-card p {
    font-size: 0.75rem;
  }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
  .currency-select,
  #amount,
  .convert-btn,
  .swap-btn {
    min-height: 44px;
  }
  
  .convert-btn:hover {
    transform: none;
  }
  
  .feature-card:hover {
    transform: none;
  }
  
  .swap-btn:hover {
    transform: none;
    background: var(--primary-color);
    color: white;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Dark mode specific styles */
[data-theme="dark"] .currency-select option {
  background: var(--card-background);
  color: var(--text-primary);
}

[data-theme="dark"] .convert-btn:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
}

[data-theme="dark"] .swap-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

[data-theme="dark"] input::-webkit-outer-spin-button,
[data-theme="dark"] input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

[data-theme="dark"] input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* System theme preference detection - only as fallback */
@media (prefers-color-scheme: dark) {
  /* Remove automatic dark mode detection to always default to light */
  /* Users can manually toggle to dark mode using the theme toggle button */
}

/* Theme transition animations */
* {
  transition: background-color var(--transition), 
              border-color var(--transition), 
              color var(--transition),
              box-shadow var(--transition);
}

/* Smooth theme switching */
.theme-switching * {
  transition: none !important;
}

/* Loading Animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Smooth transitions for all interactive elements */
button, select, input {
  transition: var(--transition);
}

/* Focus styles for accessibility */
button:focus,
select:focus,
input:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Error states */
.error {
  color: var(--error-color);
  border-color: var(--error-color);
}

.success {
  color: var(--success-color);
}
