/* CSS Variables */
:root {
  --bg-gradient-top: #4c1d95;
  --bg-gradient-bottom: #1e1b4b;
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --input-bg: #374151;
  --input-border: #4b5563;
  --select-bg: #374151;
  --select-border: #4b5563;
  --select-hover: #4b5563;
  --listen-btn-bg: #dc2626;
  --listen-btn-hover: #b91c1c;
  --highlight-color: #dc2626;
  --feature-bg: rgba(255, 255, 255, 0.1);
  --feature-border: rgba(255, 255, 255, 0.2);
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  --glow: 0 0 20px rgba(220, 38, 38, 0.3);
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  background: linear-gradient(
    180deg,
    var(--bg-gradient-top) 0%,
    var(--bg-gradient-bottom) 100%
  );
  min-height: 100vh;
  color: var(--text-primary);
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
}

/* Background Animation */
body::before {
  content: '';
  position: absolute;
  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%
    ),
    radial-gradient(
      circle at 40% 40%,
      rgba(120, 219, 255, 0.2) 0%,
      transparent 50%
    );
  animation: backgroundShift 20s ease-in-out infinite;
  z-index: -1;
}

@keyframes backgroundShift {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* Container */
.container {
  width: 100%;
  max-width: 700px;
  padding: 2rem;
  z-index: 1;
}

/* Main Card */
.converter-card {
  text-align: center;
  animation: fadeIn 0.8s ease-out;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 3rem 2rem;
  border: 1px solid var(--feature-border);
  box-shadow: var(--shadow);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Title */
.title {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 2.5rem;
  color: var(--text-primary);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  letter-spacing: -0.02em;
}

.highlight {
  color: var(--highlight-color);
  text-decoration: underline;
  text-decoration-color: var(--text-primary);
  text-underline-offset: 6px;
  text-decoration-thickness: 3px;
  position: relative;
}

.highlight::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--highlight-color);
  box-shadow: var(--glow);
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0%,
  100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* Text Input Container */
.text-input-container {
  margin-bottom: 2.5rem;
  position: relative;
}

.text-input {
  width: 100%;
  background: var(--input-bg);
  border: 2px solid var(--input-border);
  border-radius: 16px;
  padding: 2rem;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 200px;
  outline: none;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

.text-input::placeholder {
  color: var(--text-secondary);
  font-style: italic;
}

.text-input:focus {
  border-color: var(--highlight-color);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2),
    0 0 0 4px rgba(220, 38, 38, 0.1), var(--glow);
  transform: translateY(-2px);
}

/* Controls */
.controls {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

/* Language Selector */
.language-selector {
  position: relative;
}

.voice-select {
  background: var(--select-bg);
  border: 2px solid var(--select-border);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  min-width: 250px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.5em;
}

.voice-select:hover {
  background-color: var(--select-hover);
  border-color: var(--highlight-color);
  transform: translateY(-2px);
  box-shadow: var(--glow);
}

.voice-select:focus {
  outline: none;
  border-color: var(--highlight-color);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.voice-select option {
  background: var(--select-bg);
  color: var(--text-primary);
  padding: 0.5rem;
}

/* Listen Button */
.listen-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, var(--listen-btn-bg), #ef4444);
  border: none;
  border-radius: 12px;
  padding: 1rem 2rem;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.listen-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.listen-btn:hover::before {
  left: 100%;
}

.listen-btn:hover {
  background: linear-gradient(135deg, var(--listen-btn-hover), #dc2626);
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(220, 38, 38, 0.4);
}

.listen-btn:active {
  transform: translateY(-1px);
}

.play-icon {
  font-size: 1.2rem;
  font-weight: bold;
}

/* Features Section */
.features {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: var(--feature-bg);
  border: 1px solid var(--feature-border);
  border-radius: 16px;
  padding: 1.5rem 1rem;
  min-width: 150px;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.feature-item:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--highlight-color);
  box-shadow: var(--glow);
}

.feature-icon {
  font-size: 2rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.feature-item span:last-child {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 1.5rem;
  }

  .converter-card {
    padding: 2rem 1.5rem;
  }

  .title {
    font-size: 2.25rem;
    margin-bottom: 2rem;
  }

  .text-input {
    min-height: 150px;
    padding: 1.5rem;
  }

  .controls {
    flex-direction: column;
    gap: 1rem;
  }

  .voice-select {
    width: 100%;
    min-width: auto;
  }

  .listen-btn {
    width: 100%;
    justify-content: center;
  }

  .features {
    gap: 1rem;
  }

  .feature-item {
    min-width: 120px;
    padding: 1.25rem 0.75rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1rem;
  }

  .converter-card {
    padding: 1.5rem 1rem;
    border-radius: 20px;
  }

  .title {
    font-size: 2rem;
  }

  .text-input {
    min-height: 120px;
    padding: 1.25rem;
  }

  .feature-item {
    min-width: 100px;
    padding: 1rem 0.5rem;
  }

  .feature-icon {
    font-size: 1.5rem;
  }
}

/* Focus States for Accessibility */
.voice-select:focus,
.listen-btn:focus,
.text-input:focus {
  outline: 2px solid var(--highlight-color);
  outline-offset: 2px;
}

/* Custom Scrollbar */
.text-input::-webkit-scrollbar {
  width: 8px;
}

.text-input::-webkit-scrollbar-track {
  background: #2d3748;
  border-radius: 4px;
}

.text-input::-webkit-scrollbar-thumb {
  background: #4a5568;
  border-radius: 4px;
}

.text-input::-webkit-scrollbar-thumb:hover {
  background: #718096;
}

/* Print Styles */
@media print {
  .converter-card {
    color: #000;
    background: white;
  }

  .voice-select,
  .listen-btn {
    display: none;
  }
}

/* Loading Animation */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.loading {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}
