:root {
  --bg-dark: #0e1217;
  --panel-dark: #1b2028;
  --input-dark: #242b35;
  --accent-purple: #862682;
  --accent-purple-light: #a54aa0;
  --text-light: #e5e7eb;
  --text-muted: #9ca3af;
  --shadow: rgba(0, 0, 0, 0.45);
  
}

/* --- Reset & Base --- */
* {
  box-sizing: border-box;
  font-family: "Poppins", "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  background: linear-gradient(135deg, var(--bg-dark) 0%, #151a21 50%, var(--bg-dark) 100%);
  color: var(--text-light);
  overflow-x: hidden;
}

/* --- Translator Container (Balanced, Not Oversized) --- */
.translator-container {
  width: 95%;
  max-width: 1200px;
  height: calc(100vh - 140px); /* leaves room for header/sidebar */
  background: var(--panel-dark);
  border-radius: 16px;
  padding: 2rem;
  margin: 40px auto;
  box-shadow: 0 0 25px var(--shadow);
  border: 1px solid rgba(134, 38, 130, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* --- Language Bar --- */
.language-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.lang-select {
  background: var(--input-dark);
  border: 1.5px solid rgba(134, 38, 130, 0.5);
  color: var(--text-light);
  padding: 0.8rem 1rem;
  border-radius: 10px;
  font-size: 1rem;
  flex: 1;
  min-width: 180px;
  transition: all 0.3s ease;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg fill='%239d2e7d' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 15px center;
  background-size: 20px;
  padding-right: 40px;
}

.lang-select:focus {
  outline: none;
  border-color: var(--accent-purple-light);
  box-shadow: 0 0 8px rgba(134, 38, 130, 0.4);
}

.swap-btn {
  background: linear-gradient(135deg, var(--accent-purple), #6b1f67);
  border: none;
  color: #fff;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.swap-btn:hover {
  transform: rotate(180deg);
  box-shadow: 0 0 12px rgba(134, 38, 130, 0.7);
}

/* --- Translation Panel --- */
.translation-panel {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  overflow: hidden;
}

.translation-panel h5 {
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  border-left: 4px solid var(--accent-purple);
  padding-left: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
}

.translation-panel i {
  color: var(--accent-purple);
}

/* --- Input Section --- */
.input-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#recognizedText {
  flex: 1;
  width: 100%;
  background: var(--input-dark);
  border: 1.5px solid rgba(134, 38, 130, 0.5);
  border-radius: 10px;
  padding: 1rem;
  color: var(--text-light);
  font-size: 1rem;
  resize: none;
  transition: all 0.3s ease;
}

#recognizedText:focus {
  border-color: var(--accent-purple-light);
  box-shadow: 0 0 10px rgba(134, 38, 130, 0.3);
  outline: none;
}

#recognizedText::placeholder {
  color: var(--text-muted);
}

/* --- Buttons --- */
.button-group {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.translate-btn,
.mic-btn {
  flex: 1;
  padding: 0.9rem;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.translate-btn {
  background: var(--accent-purple);
  color: #fff;
  box-shadow: 0 4px 12px rgba(134, 38, 130, 0.4);
}

.translate-btn:hover {
  background: #6b1f67;
  transform: translateY(-2px);
}

.mic-btn {
  background: var(--input-dark);
  border: 1.5px solid rgba(134, 38, 130, 0.5);
  color: var(--text-light);
}

.mic-btn:hover {
  background: var(--accent-purple);
  color: #fff;
}

.mic-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --- Output Section --- */
.output-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.translation-box {
  flex: 1;
  background: var(--input-dark);
  border: 1.5px solid rgba(134, 38, 130, 0.5);
  border-radius: 10px;
  padding: 1rem;
  overflow-y: auto;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.3);
}

.translation-box::-webkit-scrollbar {
  width: 8px;
}

.translation-box::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.translation-box::-webkit-scrollbar-thumb {
  background: var(--accent-purple);
  border-radius: 10px;
}

.translation-box:empty::before {
  content: 'Translation will appear here...';
  color: var(--text-muted);
  font-style: italic;
}

/* --- Chat Bubble --- */
.chat-bubble {
  background: #262d38;
  border-left: 4px solid var(--accent-purple);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: var(--text-light);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* --- Responsiveness --- */
@media (max-width: 900px) {
  .translation-panel {
    grid-template-columns: 1fr;
  }

  .button-group {
    flex-direction: column;
  }

  .translate-btn,
  .mic-btn {
    width: 100%;
  }

  .translator-container {
    height: auto;
    margin: 20px auto;
  }
}

@media (max-height: 800px) {
  .translator-container {
    height: calc(100vh - 100px);
    padding: 1.5rem;
  }
}


