@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

* {
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

/* Default Dark Theme */
body {
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 25%, #2a2a2a 50%, #1a1a1a 75%, #0a0a0a 100%);
  color: #e5e5e5;
  min-height: 100vh;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
  transition: all 0.3s ease;
}

body::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 60%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
  z-index: -1;
  transition: all 0.3s ease;
}

/* Light Theme */
body.light {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 25%, #cbd5e1 50%, #e2e8f0 75%, #f8fafc 100%);
  color: #1e293b;
}

body.light::before {
  background:
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 40% 60%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
}

/* Blue Theme */
body.blue {
  background: linear-gradient(135deg, #0f1419 0%, #1e293b 25%, #334155 50%, #1e293b 75%, #0f1419 100%);
  color: #e2e8f0;
}

body.blue::before {
  background:
    radial-gradient(circle at 20% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(37, 99, 235, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 60%, rgba(96, 165, 250, 0.15) 0%, transparent 50%);
}

/* Purple Theme */
body.purple {
  background: linear-gradient(135deg, #1a103d 0%, #2d1b69 25%, #4c1d95 50%, #2d1b69 75%, #1a103d 100%);
  color: #e9d5ff;
}

body.purple::before {
  background:
    radial-gradient(circle at 20% 20%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(168, 85, 247, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 60%, rgba(196, 181, 253, 0.15) 0%, transparent 50%);
}

/* Green Theme */
body.green {
  background: linear-gradient(135deg, #0f1419 0%, #1a2e1a 25%, #2d5a2d 50%, #1a2e1a 75%, #0f1419 100%);
  color: #d1fae5;
}

body.green::before {
  background:
    radial-gradient(circle at 20% 20%, rgba(16, 185, 129, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(34, 197, 94, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 60%, rgba(74, 222, 128, 0.15) 0%, transparent 50%);
}

.container {
  background: linear-gradient(145deg, rgba(31, 41, 55, 0.95) 0%, rgba(17, 24, 39, 0.95) 100%);
  padding: 35px;
  border-radius: 20px;
  width: 480px;
  max-width: 90vw;
  margin: 0 auto;
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(75, 85, 99, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(75, 85, 99, 0.2);
  position: relative;
  backdrop-filter: blur(20px);
  animation: fadeInUp 0.8s ease-out;
  transition: all 0.3s ease;
}

/* Light theme container */
body.light .container {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(226, 232, 240, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(226, 232, 240, 0.2);
}

/* Blue theme container */
body.blue .container {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 20, 25, 0.95) 100%);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Purple theme container */
body.purple .container {
  background: linear-gradient(145deg, rgba(45, 27, 105, 0.95) 0%, rgba(26, 16, 61, 0.95) 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Green theme container */
body.green .container {
  background: linear-gradient(145deg, rgba(26, 46, 26, 0.95) 0%, rgba(15, 20, 25, 0.95) 100%);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg,
    rgba(59, 130, 246, 0.3),
    rgba(139, 92, 246, 0.3),
    rgba(16, 185, 129, 0.3),
    rgba(245, 158, 11, 0.3),
    rgba(239, 68, 68, 0.3)
  );
  border-radius: 22px;
  z-index: -1;
  opacity: 0.5;
  filter: blur(1px);
}

h1 {
  text-align: center;
  margin-bottom: 30px;
  font-size: 2.5em;
  font-weight: 700;
  background: linear-gradient(135deg, #60a5fa, #a78bfa, #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
}

h1::after {
  content: '🔊';
  position: absolute;
  top: -5px;
  right: -25px;
  font-size: 0.8em;
  opacity: 0.8;
}

textarea {
  width: 100%;
  padding: 18px;
  border-radius: 12px;
  border: 2px solid rgba(75, 85, 99, 0.3);
  resize: none;
  background: linear-gradient(145deg, rgba(31, 41, 55, 0.8), rgba(17, 24, 39, 0.8));
  color: #e5e5e5;
  font-size: 16px;
  font-family: 'Inter', sans-serif;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  position: relative;
}

body.light textarea {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.9));
  color: #1e293b;
  border-color: rgba(226, 232, 240, 0.3);
}

body.blue textarea {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(15, 20, 25, 0.8));
  color: #e2e8f0;
}

body.purple textarea {
  background: linear-gradient(145deg, rgba(45, 27, 105, 0.8), rgba(26, 16, 61, 0.8));
  color: #e9d5ff;
}

body.green textarea {
  background: linear-gradient(145deg, rgba(26, 46, 26, 0.8), rgba(15, 20, 25, 0.8));
  color: #d1fae5;
}

textarea::placeholder {
  color: rgba(156, 163, 175, 0.7);
  font-style: italic;
}

textarea:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.2),
    0 0 20px rgba(96, 165, 250, 0.2);
  transform: translateY(-1px);
}

.char-counter {
  text-align: right;
  font-size: 14px;
  margin-top: 8px;
  color: rgba(156, 163, 175, 0.8);
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
}

.sample-texts {
  margin-top: 15px;
  margin-bottom: 10px;
}

.sample-texts label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #d1d5db;
  font-size: 14px;
}

.sample-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sample-btn {
  padding: 8px 12px;
  border: 1px solid rgba(75, 85, 99, 0.3);
  border-radius: 6px;
  background: linear-gradient(145deg, rgba(31, 41, 55, 0.6), rgba(17, 24, 39, 0.6));
  color: #9ca3af;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.sample-btn:hover {
  background: linear-gradient(145deg, rgba(55, 65, 81, 0.8), rgba(31, 41, 55, 0.8));
  color: #e5e5e5;
  border-color: rgba(96, 165, 250, 0.4);
  transform: translateY(-1px);
}

.sample-btn:active {
  transform: translateY(0);
}

label {
  display: block;
  margin-top: 20px;
  margin-bottom: 8px;
  font-weight: 600;
  color: #d1d5db;
  font-size: 16px;
  position: relative;
}

body.light label {
  color: #374151;
}

body.blue label {
  color: #cbd5e1;
}

body.purple label {
  color: #d8b4fe;
}

body.green label {
  color: #a7f3d0;
}

label::before {
  content: '⚙️';
  position: absolute;
  left: -25px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: 0.6;
}

select,
input[type="range"] {
  width: 100%;
  padding: 12px 15px;
  border-radius: 10px;
  border: 2px solid rgba(75, 85, 99, 0.3);
  background: rgba(31, 41, 55, 0.8);
  color: #e5e5e5;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
}

body.light select,
body.light input[type="range"] {
  background: rgba(255, 255, 255, 0.9);
  color: #1e293b;
  border-color: rgba(226, 232, 240, 0.3);
}

body.blue select,
body.blue input[type="range"] {
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
}

body.purple select,
body.purple input[type="range"] {
  background: rgba(45, 27, 105, 0.8);
  color: #e9d5ff;
}

body.green select,
body.green input[type="range"] {
  background: rgba(26, 46, 26, 0.8);
  color: #d1fae5;
}

select:focus,
input[type="range"]:focus {
  outline: none;
  border-color: #60a5fa;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: linear-gradient(90deg, #374151, #4b5563, #6b7280, #9ca3af);
  border-radius: 5px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.buttons {
  display: flex;
  gap: 18px;
  margin-top: 25px;
}

button {
  flex: 1;
  padding: 16px 24px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  text-transform: none;
  letter-spacing: 0.5px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.6s ease;
}

button:hover::before {
  left: 100%;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

button:active {
  transform: translateY(0px);
}

#speak-btn {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

#speak-btn:hover {
  background: linear-gradient(135deg, #15803d, #166534);
}

#stop-btn {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

#stop-btn:hover {
  background: linear-gradient(135deg, #b91c1c, #991b1b);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

button:disabled:hover {
  transform: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

#status {
  margin-top: 25px;
  text-align: center;
  padding: 15px;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(31, 41, 55, 0.8), rgba(17, 24, 39, 0.8));
  border: 2px solid rgba(75, 85, 99, 0.2);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(0, 0, 0, 0.2);
  font-weight: 500;
  color: #e5e5e5;
}

.speaking {
  color: #34d399;
  font-weight: 700;
  animation: pulse 1.5s ease-in-out infinite;
  position: relative;
}

.speaking::before {
  content: '🎵';
  position: absolute;
  left: -25px;
  top: 50%;
  transform: translateY(-50%);
  animation: bounce 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(-50%) scale(1); }
  40% { transform: translateY(-50%) scale(1.2); }
  60% { transform: translateY(-50%) scale(1.1); }
}

/* Tamil language indicator */
option[value*="ta"] {
  background-color: rgba(16, 185, 129, 0.1);
  font-weight: 600;
  color: #10b981;
}

option[value*="ta"]::before {
  content: "🇮🇳 ";
}

option[value*="en"] {
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

option[value*="en"]::before {
  content: "🇺🇸 ";
}

option[value*="es"] {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

option[value*="es"]::before {
  content: "🇪🇸 ";
}

option[value*="fr"] {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

option[value*="fr"]::before {
  content: "🇫🇷 ";
}

option[value*="de"] {
  background-color: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

option[value*="de"]::before {
  content: "🇩🇪 ";
}

option[value*="it"] {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

option[value*="it"]::before {
  content: "🇮🇹 ";
}

option[value*="pt"] {
  background-color: rgba(245, 101, 101, 0.1);
  color: #f56565;
}

option[value*="pt"]::before {
  content: "🇵🇹 ";
}

option[value*="ja"] {
  background-color: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
}

option[value*="ja"]::before {
  content: "🇯🇵 ";
}

option[value*="ko"] {
  background-color: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

option[value*="ko"]::before {
  content: "🇰🇷 ";
}

option[value*="zh"] {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

option[value*="zh"]::before {
  content: "🇨🇳 ";
}

option[value*="hi"] {
  background-color: rgba(168, 85, 247, 0.1);
  color: #a855f7;
}

option[value*="hi"]::before {
  content: "🇮🇳 ";
}

option[value*="ar"] {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

option[value*="ar"]::before {
  content: "🇸🇦 ";
}

option[value*="ru"] {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

option[value*="ru"]::before {
  content: "🇷🇺 ";
}

/* Mobile responsiveness */
@media (max-width: 600px) {
  body {
    padding: 10px;
  }

  .container {
    width: 95%;
    max-width: none;
    padding: 20px;
    margin: 0 auto;
  }

  h1 {
    font-size: 1.8em;
    margin-bottom: 20px;
  }

  textarea {
    padding: 15px;
    font-size: 16px;
  }

  .buttons {
    flex-direction: row;
    gap: 10px;
    margin-top: 20px;
  }

  .sample-buttons {
    flex-direction: column;
    gap: 6px;
  }

  .sample-btn {
    width: 100%;
    padding: 8px;
    font-size: 13px;
  }

  button {
    padding: 12px 16px;
    font-size: 15px;
    flex: 1;
    min-width: 0;
  }

  label {
    margin-top: 15px;
    font-size: 15px;
  }

  select,
  input[type="range"] {
    padding: 10px 12px;
    font-size: 14px;
  }
}
