.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

.nav-tab {
  flex: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 44px;
}
[data-theme="dark"] .nav-tab { color: #94a3b8; }
.nav-tab.active { color: #4f46e5; border-bottom-color: #4f46e5; }
[data-theme="dark"] .nav-tab.active { color: #818cf8; border-bottom-color: #818cf8; }

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.25s ease; }

.mode-btn {
  flex: 1;
  min-width: 0;
  padding: 8px 6px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  color: #374151;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  min-height: 44px;
}
[data-theme="dark"] .mode-btn { background: #1e293b; color: #e2e8f0; border-color: #475569; }
.mode-btn.active { border-color: #4f46e5; background: #eef2ff; color: #4f46e5; }
[data-theme="dark"] .mode-btn.active { background: #312e81; color: #a5b4fc; border-color: #6366f1; }

.pill-btn {
  padding: 6px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 20px;
  background: white;
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 34px;
}
[data-theme="dark"] .pill-btn { background: #1e293b; color: #94a3b8; border-color: #475569; }
.pill-btn.active[data-tone] { border-color: #059669; color: #059669; background: rgba(5,150,105,0.08); }
[data-theme="dark"] .pill-btn.active[data-tone] { background: rgba(5,150,105,0.15); color: #34d399; border-color: #059669; }
.pill-btn.active[data-provider] { border-color: #4f46e5; color: #4f46e5; background: #eef2ff; }
[data-theme="dark"] .pill-btn.active[data-provider] { background: #312e81; color: #a5b4fc; border-color: #6366f1; }

.action-btn {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 34px;
}
[data-theme="dark"] .action-btn { background: #1e293b; color: #e2e8f0; border-color: #475569; }
.action-btn:active { transform: scale(0.96); }

.output-area.tool-result { font-size: 14px; line-height: 1.7; }
.output-area.tool-result .tool-header { font-weight: 700; font-size: 15px; margin: 12px 0 4px; color: #4f46e5; }
[data-theme="dark"] .output-area.tool-result .tool-header { color: #818cf8; }

.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.confidence-high { background: #d1fae5; color: #065f46; }
.confidence-medium { background: #fef3c7; color: #92400e; }
.confidence-review { background: #fecaca; color: #991b1b; }
[data-theme="dark"] .confidence-high { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .confidence-medium { background: #78350f; color: #fcd34d; }
[data-theme="dark"] .confidence-review { background: #7f1d1d; color: #fca5a5; }

.bottom-btn {
  flex: 1;
  max-width: 140px;
  padding: 8px 4px;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-height: 52px;
}
.bottom-btn:active { transform: scale(0.95); }
.bottom-btn.primary { background: #4f46e5; color: white; }
[data-theme="dark"] .bottom-btn.primary { background: #6366f1; }
.bottom-btn.secondary { background: #f3f4f6; color: #374151; border: 1.5px solid #e5e7eb; }
[data-theme="dark"] .bottom-btn.secondary { background: #1e293b; color: #e2e8f0; border-color: #475569; }

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
}

.toggle-switch {
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: #d1d5db;
  border: none;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
[data-theme="dark"] .toggle-switch { background: #475569; }
.toggle-switch.active { background: #4f46e5; }
.toggle-switch::after {
  content: '';
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-switch.active::after { left: 23px; }

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(79,70,229,0.2);
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
[data-theme="dark"] .loading-spinner { border-color: rgba(129,140,248,0.2); border-top-color: #818cf8; }

.loading-spinner-white {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.mic-btn.recording {
  animation: micPulse 1s ease infinite;
  box-shadow: 0 0 0 8px rgba(239,68,68,0.2);
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(239,68,68,0.2); }
  50% { box-shadow: 0 0 0 12px rgba(239,68,68,0.08); }
}

.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1f2937;
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
[data-theme="dark"] .toast { background: #e2e8f0; color: #0f172a; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.vocab-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s ease;
}
[data-theme="dark"] .vocab-card { background: #1e293b; border-color: #334155; }

.vocab-phrase-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: 12px;
  border-bottom: 1px solid #f3f4f6;
}
[data-theme="dark"] .vocab-phrase-row { border-bottom-color: #1e293b; }
.vocab-phrase-row:last-child { border-bottom: none; }

.almaz-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: fadeIn 0.3s ease;
}
.almaz-msg.user {
  flex-direction: row-reverse;
}
.almaz-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  box-shadow: 0 2px 6px rgba(245,158,11,0.3);
}
.almaz-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.almaz-msg.user .almaz-avatar {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  box-shadow: 0 2px 6px rgba(79,70,229,0.3);
}
.almaz-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.almaz-msg.assistant .almaz-bubble {
  background: white;
  border: 1px solid #e5e7eb;
  border-top-left-radius: 4px;
  color: #1f2937;
}
[data-theme="dark"] .almaz-msg.assistant .almaz-bubble {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
.almaz-msg.user .almaz-bubble {
  background: #4f46e5;
  color: white;
  border-top-right-radius: 4px;
}
[data-theme="dark"] .almaz-msg.user .almaz-bubble {
  background: #6366f1;
}
.almaz-bubble strong {
  font-weight: 700;
}
.almaz-bubble ul, .almaz-bubble ol {
  padding-left: 1.2em;
}
.almaz-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}
.almaz-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: typingDot 1.4s ease infinite;
}
.almaz-typing span:nth-child(2) { animation-delay: 0.2s; }
.almaz-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.bottom-btn-almaz {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  border: 3px solid white;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-top: -16px;
  position: relative;
  z-index: 10;
}
[data-theme="dark"] .bottom-btn-almaz { border-color: #1e293b; }
.bottom-btn-almaz:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5); }
.bottom-btn-almaz:active { transform: scale(0.95); }

.almaz-ptt-btn {
  position: relative;
}
.almaz-ptt-btn.recording {
  background: #ef4444 !important;
  animation: pttPulse 1s ease infinite;
}
@keyframes pttPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(239,68,68,0.3); }
  50% { box-shadow: 0 0 0 12px rgba(239,68,68,0.1); }
}

#almaz-voice-btn {
  position: relative;
}
#almaz-voice-btn.bg-red-500::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 14px;
  border: 2px solid rgba(239, 68, 68, 0.5);
  animation: voicePulse 1.5s ease infinite;
}
@keyframes voicePulse {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.3); }
}

.almaz-streaming-cursor::after {
  content: '|';
  animation: blink 0.7s step-end infinite;
  color: #4f46e5;
  font-weight: bold;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.convo-recording {
  animation: convoRecordPulse 1s ease-in-out infinite;
}
@keyframes convoRecordPulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(0,0,0,0.15), 0 0 0 0 rgba(239,68,68,0.4); transform: scale(1); }
  50% { box-shadow: 0 4px 14px rgba(0,0,0,0.15), 0 0 0 12px rgba(239,68,68,0); transform: scale(1.02); }
}
.convo-recording.bg-blue-500,
.convo-recording.bg-amber-500 {
  background: #ef4444 !important;
}
.convo-recording:hover {
  background: #dc2626 !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fadeIn {
  animation: fadeIn 0.3s ease;
}
