/* Base styles and variables */
:root {
  --background: 0 0% 98%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 10% 3.9%;
  --radius: 0.5rem;
}

.dark-mode {
  --background: 240 10% 3.9%;
  --foreground: 0 0% 98%;
  --card: 240 10% 3.9%;
  --card-foreground: 0 0% 98%;
  --popover: 240 10% 3.9%;
  --popover-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 240 5.9% 10%;
  --secondary: 240 3.7% 15.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --accent: 240 3.7% 15.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 3.7% 15.9%;
  --input: 240 3.7% 15.9%;
  --ring: 240 4.9% 83.9%;
}

/* Global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
  background: linear-gradient(to bottom, hsl(var(--background)), hsl(var(--background), 0.9));
  color: hsl(var(--foreground));
  min-height: 100vh;
  transition: color 0.3s, background-color 0.3s;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header styles */
.header {
  padding: 1.5rem;
  border-bottom: 1px solid hsla(var(--border), 0.5);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.crown-icon {
  color: #f59e0b;
  font-size: 1.5rem;
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.app-subtitle {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  letter-spacing: 0.05em;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.highlight {
  color: #f59e0b;
}

.donation-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: hsla(var(--primary), 0.05);
  color: hsl(var(--primary));
  border: 1px solid hsla(var(--primary), 0.1);
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.donation-button:hover {
  background-color: hsla(var(--primary), 0.1);
}

/* Main content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2.5rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  transition: opacity 0.5s;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Hero section */
.hero-section {
  text-align: center;
  margin-bottom: 2.5rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background-color: hsla(var(--primary), 0.05);
  color: hsla(var(--primary), 0.9);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  margin-bottom: 0.5rem;
}

.dark-mode .badge {
  background-color: hsla(var(--primary), 0.2);
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: hsl(var(--primary));
  margin-bottom: 0.75rem;
  letter-spacing: -0.025em;
}

.dark-mode .hero-title {
  color: white;
}

.hero-description {
  max-width: 32rem;
  margin: 0 auto;
  color: hsl(var(--muted-foreground));
  font-size: 1rem;
  line-height: 1.5;
}

.dark-mode .hero-description {
  color: hsl(var(--muted-foreground));
}

/* Converter container */
.converter-container {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto 2.5rem;
  padding: 1.5rem;
  background-color: hsla(var(--card), 0.5);
  backdrop-filter: blur(8px);
  border: 1px solid hsla(var(--border), 0.2);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02), 
              0 4px 16px rgba(0, 0, 0, 0.03), 
              0 8px 24px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

.dark-mode .converter-container {
  background-color: hsla(var(--card), 0.4);
  border-color: hsla(var(--border), 0.3);
}

/* Format options */
.format-options-container {
  background-color: hsla(var(--primary), 0.05);
  border: 1px solid hsla(var(--primary), 0.1);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.dark-mode .format-options-container {
  background-color: hsla(var(--primary), 0.1);
  border-color: hsla(var(--primary), 0.2);
}

.format-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.premium-icon {
  color: #f59e0b;
}

.format-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.format-tabs {
  margin-bottom: 1.5rem;
}

.format-tab-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--primary));
  margin-bottom: 0.75rem;
}

.format-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .format-buttons {
    grid-template-columns: repeat(3, 1fr);
  }
}

.format-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
}

.format-button:hover {
  background-color: hsla(var(--secondary), 0.5);
}

.format-button.selected {
  background-color: hsl(var(--secondary));
  border-color: hsla(var(--primary), 0.2);
}

.format-button-icon {
  color: hsl(var(--muted-foreground));
  font-size: 1rem;
  transition: color 0.2s;
}

.format-button.selected .format-button-icon {
  color: hsl(var(--primary));
}

.format-button-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: color 0.2s;
}

.format-button.selected .format-button-text {
  color: hsl(var(--primary));
}

.premium-badge {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  color: #f59e0b;
  font-size: 0.75rem;
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

#theme-toggle-btn {
  background: none;
  border: none;
  color: hsl(var(--foreground));
  cursor: pointer;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

#theme-toggle-btn:hover {
  background-color: hsl(var(--secondary));
}

.light-mode .dark-icon {
  display: inline-block;
}

.light-mode .light-icon {
  display: none;
}

.dark-mode .dark-icon {
  display: none;
}

.dark-mode .light-icon {
  display: inline-block;
}

/* Converter layout */
.converter-layout {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .converter-layout {
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }
}

/* Text area container */
.text-area-container {
  width: 100%;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background-color: hsla(var(--card), 0.6);
  position: relative;
  transition: all 0.3s;
  backdrop-filter: blur(4px);
}

.dark-mode .text-area-container {
  background-color: hsla(var(--card), 0.8);
}

.text-area-container:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: hsla(var(--primary), 0.2);
  transition: width 0.7s ease-in-out;
}

.text-area-container:focus-within:before {
  width: 100%;
}

#input-text {
  width: 100%;
  height: 8rem;
  resize: none;
  padding: 1rem;
  border: none;
  background-color: transparent;
  color: hsl(var(--primary));
  outline: none;
  font-size: 1rem;
}

.dark-mode #input-text {
  color: white;
}

.output-display {
  width: 100%;
  height: 8rem;
  padding: 1rem;
  overflow: auto;
  word-break: break-word;
}

.placeholder-text {
  color: hsl(var(--muted-foreground));
}

.text-area-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border-top: 1px solid hsla(var(--border), 0.5);
}

.char-count {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.circular-progress {
  margin-right: 0.5rem;
  position: relative;
  display: inline-flex;
}

.progress-bg {
  fill: transparent;
  stroke: hsla(var(--muted-foreground), 0.2);
}

.progress-indicator {
  fill: transparent;
  stroke: hsl(var(--primary));
  stroke-dasharray: 63; /* 2 * PI * radius */
  stroke-dashoffset: 63; /* Initial offset (no progress) */
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.3s ease-in-out, stroke 0.3s ease-in-out;
}

.progress-warning .progress-indicator {
  stroke: #f59e0b;
}

.progress-danger .progress-indicator {
  stroke: #dc2626;
}

.input-actions, .output-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auto-convert-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.text-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: color 0.2s;
}

.text-btn:hover:not(:disabled) {
  color: hsl(var(--primary));
}

.text-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Convert button */
.convert-button-container {
  display: flex;
  justify-content: center;
}

.convert-btn {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background-color: hsl(var(--primary));
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.convert-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.convert-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.convert-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.convert-btn.spinning {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Conversion history */
.conversion-history {
  margin-top: 2rem;
  animation: fadeIn 0.4s ease-out;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.history-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.clear-history-btn {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.clear-history-btn:hover {
  color: hsl(var(--destructive));
}

.history-items {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.history-item {
  padding: 0.75rem;
  border-radius: var(--radius);
  background-color: hsla(var(--secondary), 0.5);
  border: 1px solid hsla(var(--border), 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: fadeIn 0.4s ease-out;
  transition: all 0.2s;
}

.history-item-content {
  flex: 1;
  overflow: hidden;
}

.history-item-text {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-meta {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.history-item-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.history-item:hover .history-item-actions {
  opacity: 1;
}

.history-action-btn {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--radius);
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: all 0.2s;
}

.history-action-btn:hover {
  background-color: hsl(var(--muted));
  color: hsl(var(--foreground));
}

/* Features section */
.features-section {
  width: 100%;
  max-width: 36rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.features-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 1rem;
}

.dark-mode .features-title {
  color: white;
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.feature-card {
  padding: 1rem;
  border-radius: var(--radius);
  background-color: hsla(var(--card), 0.6);
  border: 1px solid hsla(var(--border), 0.1);
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02), 0 4px 16px rgba(0, 0, 0, 0.03);
}

.dark-mode .feature-card {
  background-color: hsla(var(--card), 0.6);
  border-color: hsla(var(--border), 0.7);
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.dark-mode .feature-card h3 {
  color: white;
}

.feature-card p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* Footer */
.footer {
  padding: 1.5rem 1rem;
  text-align: center;
  border-top: 1px solid hsla(var(--border), 0.1);
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.dark-mode .footer {
  border-color: hsla(var(--border), 0.8);
}

/* Toast notification */
.toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1rem;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 300px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
}

.toast-description {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.toast-close {
  margin-left: auto;
  background: none;
  border: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

/* Premium effects */
/* Rainbow text */
.text-rainbow {
  background-image: linear-gradient(to right, #ff0000, #ffa500, #ffff00, #008000, #0000ff, #4b0082, #ee82ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbow-animation 6s ease infinite;
  background-size: 400% 100%;
  font-weight: bold;
}

@keyframes rainbow-animation {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Blue gradient text */
.text-gradient-blue {
  background-image: linear-gradient(45deg, #00b4db, #0083b0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: bold;
}

/* Sparkle text */
.sparkle-text {
  display: inline-block;
  position: relative;
  font-weight: bold;
  color: #583eb9;
  animation: sparkle-pulse 2s infinite;
}

@keyframes sparkle-pulse {
  0%, 100% { text-shadow: 0 0 4px rgba(88, 62, 185, 0.3), 0 0 8px rgba(88, 62, 185, 0.2); }
  50% { text-shadow: 0 0 8px rgba(88, 62, 185, 0.5), 0 0 16px rgba(88, 62, 185, 0.4); }
}

/* 3D text */
.text-3d {
  color: #ffffff;
  text-shadow: 1px 1px 0 #4355f9, 2px 2px 0 #4355f9, 3px 3px 0 #4355f9, 4px 4px 0 #4355f9, 
              5px 5px 0 #4355f9, 6px 6px 0 #4355f9, 7px 7px 0 #4355f9, 8px 8px 0 #4355f9;
  font-weight: bold;
  letter-spacing: 1px;
}

/* Glitch text */
.glitch-text {
  position: relative;
  color: #fff;
  font-weight: bold;
  text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75),
              -0.025em -0.05em 0 rgba(0, 255, 0, 0.75),
              0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
  animation: glitch 500ms infinite;
}

@keyframes glitch {
  0% {
    text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75),
                -0.025em -0.05em 0 rgba(0, 255, 0, 0.75),
                0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
  }
  14% {
    text-shadow: 0.05em 0 0 rgba(255, 0, 0, 0.75),
                -0.025em -0.05em 0 rgba(0, 255, 0, 0.75),
                0.025em 0.05em 0 rgba(0, 0, 255, 0.75);
  }
  15% {
    text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75),
                0.025em 0.025em 0 rgba(0, 255, 0, 0.75),
                -0.05em -0.05em 0 rgba(0, 0, 255, 0.75);
  }
  49% {
    text-shadow: -0.05em -0.025em 0 rgba(255, 0, 0, 0.75),
                0.025em 0.025em 0 rgba(0, 255, 0, 0.75),
                -0.05em -0.05em 0 rgba(0, 0, 255, 0.75);
  }
  50% {
    text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75),
                0.05em 0 0 rgba(0, 255, 0, 0.75),
                0 -0.05em 0 rgba(0, 0, 255, 0.75);
  }
  99% {
    text-shadow: 0.025em 0.05em 0 rgba(255, 0, 0, 0.75),
                0.05em 0 0 rgba(0, 255, 0, 0.75),
                0 -0.05em 0 rgba(0, 0, 255, 0.75);
  }
  100% {
    text-shadow: -0.025em 0 0 rgba(255, 0, 0, 0.75),
                -0.025em -0.025em 0 rgba(0, 255, 0, 0.75),
                -0.025em -0.05em 0 rgba(0, 0, 255, 0.75);
  }
}

/* Shadow text */
.shadow-text {
  color: #333;
  font-weight: bold;
  text-shadow: 2px 2px 0px #eee, 4px 4px 0px rgba(0,0,0,0.15), 6px 6px 0px rgba(0,0,0,0.1);
  letter-spacing: 1px;
}

.dark-mode .shadow-text {
  color: #eee;
  text-shadow: 2px 2px 0px #333, 4px 4px 0px rgba(255,255,255,0.15), 6px 6px 0px rgba(255,255,255,0.1);
}

/* Neon text */
.neon-text {
  color: #fff;
  text-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #0073e6, 0 0 20px #0073e6, 0 0 25px #0073e6, 0 0 30px #0073e6, 0 0 35px #0073e6;
  font-weight: bold;
}

/* Frosted text */
.frosted-text {
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  letter-spacing: 3px;
  font-weight: bold;
}

/* Fire text */
.fire-text {
  background-image: linear-gradient(0deg, #ff8a00, #ffc107, #ff0000);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(255, 138, 0, 0.5);
}

/* Liquid text */
.liquid-text {
  background-image: linear-gradient(0deg, #4facfe, #00f2fe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(79, 172, 254, 0.5);
  animation: wave 2s ease infinite;
}

@keyframes wave {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}
