/* Multilingual Voice Assistant Stylesheet */

:root {
  --voice-card: #17241e;
  --voice-accent: #2fbf71;
  --voice-accent-2: #1f9d8a;
  --voice-danger: #e5484d;
  --voice-muted: #93a89d;
  --voice-user-bubble: #1f9d8a;
  --voice-ai-bubble: #1e2c26;
  --voice-border: #26362e;
}

.screen {
  display: none;
  min-height: calc(100vh - 120px);
  width: 100%;
}

.screen.active {
  display: flex;
}

.hidden {
  display: none !important;
}

/* ---------- Language selection ---------- */
#screen-select {
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.select-card {
  width: 100%;
  max-width: 720px;
  background: var(--voice-card);
  border: 1px solid var(--voice-border);
  border-radius: 20px;
  padding: 35px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.brand-heading {
  margin: 0 0 10px;
  font-size: 1.8rem;
  text-align: center;
  color: var(--text-color, #ffffff);
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
}

.subtitle {
  margin: 0 0 25px;
  text-align: center;
  color: var(--voice-muted);
  font-size: 1rem;
}

.section-title {
  font-size: 1rem;
  color: var(--voice-muted);
  margin: 15px 0 15px;
  font-weight: 600;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  max-height: 250px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--voice-border);
  border-radius: 12px;
  background: var(--bg-2, #101b17);
}

.lang-card {
  background: var(--bg-2, #101b17);
  border: 1.5px solid var(--voice-border);
  border-radius: 12px;
  padding: 15px 10px;
  text-align: center;
  cursor: pointer;
  color: var(--text-color, #ffffff);
  transition: transform 0.12s, border-color 0.12s, background-color 0.12s;
}

.lang-card:hover {
  transform: translateY(-2px);
  border-color: var(--voice-accent-2);
}

.lang-card.selected {
  border-color: var(--voice-accent);
  background: rgba(31, 157, 138, 0.15);
  box-shadow: 0 0 0 2px var(--voice-accent) inset;
}

.lang-card .native {
  font-size: 1.2rem;
  font-weight: 700;
}

.lang-card .name {
  font-size: 0.8rem;
  color: var(--voice-muted);
  margin-top: 4px;
}

.options-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 15px;
  margin: 25px 0 15px;
}

.opt {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--voice-muted);
}

.opt select {
  background: var(--bg-2, #101b17);
  color: var(--text-color, #ffffff);
  border: 1px solid var(--voice-border);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.9rem;
  outline: none;
}

.primary-btn {
  width: 100%;
  margin-top: 20px;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--voice-accent), var(--voice-accent-2));
  color: #04140d;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.primary-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.primary-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hint {
  color: var(--voice-muted);
  font-size: 0.8rem;
  text-align: center;
  margin: 15px 0 0;
}

/* ---------- Chat ---------- */
#screen-chat {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 20px;
}

.chat-container {
  width: 100%;
  max-width: 640px;
  height: calc(100vh - 180px);
  background: var(--voice-card);
  border: 1px solid var(--voice-border);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--voice-border);
  background: rgba(16, 27, 23, 0.5);
}

.chat-header .title {
  font-weight: 700;
  font-size: 1.1rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--text-color, #ffffff);
}

.ghost-btn {
  background: transparent;
  color: var(--voice-muted);
  border: 1px solid var(--voice-border);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.12s;
}

.ghost-btn:hover {
  color: #ffffff;
  border-color: var(--voice-danger);
  background: rgba(229, 72, 77, 0.1);
}

.lang-bars {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--voice-border);
  background: rgba(16, 27, 23, 0.25);
}

.lang-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--voice-muted);
}

.lang-bar select {
  background: var(--bg-2, #101b17);
  color: var(--text-color, #ffffff);
  border: 1px solid var(--voice-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
  outline: none;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: rgba(10, 15, 13, 0.2);
}

.msg {
  display: flex;
}

.msg.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 0.98rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: 'DM Sans', sans-serif;
}

.msg.ai .bubble {
  background: var(--voice-ai-bubble);
  color: #eaf3ee;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--voice-border);
}

.msg.user .bubble {
  background: var(--voice-user-bubble);
  color: #04140d;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}

.msg.typing .bubble {
  color: var(--voice-muted);
  font-style: italic;
}

.error-bar {
  margin: 10px 20px;
  padding: 12px;
  background: #3a1c1e;
  color: #ffd7d8;
  border: 1px solid var(--voice-danger);
  border-radius: 10px;
  font-size: 0.88rem;
}

.chat-footer {
  padding: 20px;
  border-top: 1px solid var(--voice-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(16, 27, 23, 0.5);
}

.status-pill {
  font-size: 0.8rem;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--voice-border);
  color: var(--voice-muted);
  font-weight: 500;
  font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase;
}

.status-pill.ready {
  color: var(--voice-muted);
}

.status-pill.listening {
  color: #ff5a5f;
  border-color: #ff5a5f;
  background: rgba(255, 90, 95, 0.1);
}

.status-pill.processing {
  color: #ffd479;
  border-color: #ffd479;
  background: rgba(255, 212, 121, 0.1);
}

.status-pill.thinking {
  color: #9fd0ff;
  border-color: #9fd0ff;
  background: rgba(159, 208, 255, 0.1);
}

.status-pill.speaking {
  color: var(--voice-accent);
  border-color: var(--voice-accent);
  background: rgba(47, 191, 113, 0.1);
}

.mic-btn {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, var(--voice-accent), var(--voice-accent-2));
  display: grid;
  place-items: center;
  box-shadow: 0 10px 25px rgba(47, 191, 113, 0.3);
  transition: transform 0.1s, box-shadow 0.2s;
  outline: none;
}

.mic-btn:active {
  transform: scale(0.96);
}

.mic-btn .mic-icon {
  font-size: 2.2rem;
}

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

.mic-btn .pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--voice-accent);
  opacity: 0;
  pointer-events: none;
}

.mic-btn.recording {
  background: linear-gradient(145deg, #ff5a5f, var(--voice-danger));
  box-shadow: 0 10px 25px rgba(229, 72, 77, 0.4);
}

.mic-btn.recording .pulse {
  animation: pulse 1.3s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.8;
  }
  100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

.mic-caption {
  color: var(--voice-muted);
  font-size: 0.85rem;
  font-family: 'DM Sans', sans-serif;
}

@media (max-width: 768px) {
  .select-card {
    padding: 20px;
    border-radius: 14px;
  }
  .brand-heading {
    font-size: 1.5rem;
  }
  .chat-container {
    height: calc(100vh - 200px);
  }
}
