/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
  margin: 0;
  position: relative;
  overflow: hidden;
}

/* Background Animation */
.background-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.floating-shapes {
  position: relative;
  width: 100%;
  height: 100%;
}

.shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  animation: float 6s ease-in-out infinite;
}

.shape-1 {
  width: 80px;
  height: 80px;
  top: 20%;
  left: 10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 120px;
  height: 120px;
  top: 60%;
  right: 10%;
  animation-delay: 2s;
}

.shape-3 {
  width: 60px;
  height: 60px;
  bottom: 20%;
  left: 20%;
  animation-delay: 4s;
}

.shape-4 {
  width: 100px;
  height: 100px;
  top: 10%;
  right: 30%;
  animation-delay: 1s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

/* Main Container */
.container {
  width: 100%;
  max-width: 600px;
  position: relative;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* App Header */
.app-header {
  text-align: center;
  margin-bottom: 1rem;
  color: white;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

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

.logo h1 {
  font-size: 2rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

/* Converter Card */
.converter-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

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

.amount-section label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.amount-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.amount-input-container input {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 600;
  background: white;
  transition: all 0.3s ease;
}

.amount-input-container input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.amount-actions {
  position: absolute;
  right: 12px;
}

.clear-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.clear-btn:hover {
  background: #f3f4f6;
  color: #6b7280;
}

/* Currency Selector */
.currency-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.currency-box {
  flex: 1;
}

.currency-box label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.currency-input {
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 4px;
  transition: all 0.3s ease;
}

.currency-input:focus-within {
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.flag-container {
  padding: 8px 12px;
}

.flag-container img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
}

.currency-input select {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  color: #374151;
  padding: 12px 8px;
  cursor: pointer;
}

.currency-input i {
  color: #9ca3af;
  margin-right: 12px;
  transition: transform 0.2s ease;
}

.currency-input:focus-within i {
  transform: rotate(180deg);
}

/* Swap Button */
.swap-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.swap-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.swap-btn:active {
  transform: scale(0.95);
}

/* Result Section */
.result-section {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-radius: 16px;
  padding: 1.2rem;
  margin-bottom: 1.5rem;
  border: 1px solid #e2e8f0;
}

.exchange-rate {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e2e8f0;
}

.rate-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #64748b;
}

.last-updated {
  font-size: 0.8rem;
  color: #94a3b8;
}

.conversion-result {
  text-align: center;
}

.result-amount {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.amount-value {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
}

.currency-code {
  font-size: 1.2rem;
  font-weight: 600;
  color: #64748b;
}

/* Convert Button */
.convert-btn {
  width: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 12px;
  padding: 16px;
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.convert-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

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

.convert-btn i {
  transition: transform 0.3s ease;
}

.convert-btn:hover i {
  transform: rotate(180deg);
}

/* Features Section */
.features-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.feature-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.feature-card i {
  font-size: 1.5rem;
  color: #667eea;
  margin-bottom: 8px;
}

.feature-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
}

.feature-card p {
  font-size: 0.75rem;
  color: #6b7280;
  line-height: 1.3;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  flex-direction: column;
  gap: 1rem;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-overlay p {
  color: white;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 5px;
  }
  
  .container {
    max-height: calc(100vh - 10px);
  }
  
  .app-header {
    margin-bottom: 0.8rem;
  }
  
  .logo h1 {
    font-size: 1.8rem;
  }
  
  .converter-card {
    padding: 1.2rem;
    margin-bottom: 0.8rem;
  }
  
  .currency-selector {
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
  }
  
  .swap-btn {
    transform: rotate(90deg);
  }
  
  .features-section {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  
  .amount-value {
    font-size: 1.8rem;
  }
  
  .result-section {
    padding: 1rem;
    margin-bottom: 1.2rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 3px;
  }
  
  .container {
    max-height: calc(100vh - 6px);
  }
  
  .logo {
    flex-direction: column;
    gap: 4px;
  }
  
  .logo h1 {
    font-size: 1.6rem;
  }
  
  .app-header {
    margin-bottom: 0.6rem;
  }
  
  .converter-card {
    padding: 1rem;
    margin-bottom: 0.6rem;
  }
  
  .amount-section {
    margin-bottom: 1.2rem;
  }
  
  .currency-selector {
    margin-bottom: 1rem;
  }
  
  .result-section {
    padding: 0.8rem;
    margin-bottom: 1rem;
  }
  
  .exchange-rate {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
  }
  
  .amount-value {
    font-size: 1.6rem;
  }
  
  .features-section {
    margin-bottom: 0.5rem;
  }
  
  .feature-card {
    padding: 0.8rem;
  }
}

@media (max-height: 600px) {
  .features-section {
    display: none;
  }
  
  .converter-card {
    margin-bottom: 0.5rem;
  }
}

@media (max-height: 500px) {
  .app-header {
    margin-bottom: 0.5rem;
  }
  
  .logo h1 {
    font-size: 1.4rem;
  }
  
  .subtitle {
    font-size: 0.9rem;
  }
  
  .converter-card {
    padding: 1rem;
  }
  
  .amount-section {
    margin-bottom: 1rem;
  }
  
  .currency-selector {
    margin-bottom: 1rem;
  }
  
  .result-section {
    padding: 0.8rem;
    margin-bottom: 1rem;
  }
}

/* Smooth animations for all interactive elements */
* {
  transition: all 0.2s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5a67d8;
}