:root {
  --bg-color: #0d0f17;
  --panel-bg: rgba(22, 26, 38, 0.85);
  --accent-gold: #d4af37;
  --accent-gold-hover: #f3cf55;
  --purple-glow: #6366f1;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --border-color: rgba(212, 175, 55, 0.25);
  --user-bubble: #1e293b;
  --ai-bubble: #1e1b4b;
  --font-heading: 'Cinzel', serif;
  --font-body: 'Inter', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(at 20% 20%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 80% 80%, rgba(212, 175, 55, 0.1) 0px, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-body);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 12px;
}

.app-container {
  width: 100%;
  max-width: 800px;
  height: 92vh;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(13, 15, 23, 0.4);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.laurel-icon {
  font-size: 28px;
}

.logo h1 {
  font-family: var(--font-heading);
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--accent-gold);
}

.subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.controls-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.select-input {
  background: #111420;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  outline: none;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.2s;
}

.icon-btn:hover {
  transform: rotate(30deg);
}

/* Transcript Container */
.transcript-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

.system-message {
  text-align: center;
  background: rgba(99, 102, 241, 0.1);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  padding: 14px;
  border-radius: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.system-message .badge {
  display: inline-block;
  background: var(--accent-gold);
  color: #000;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  margin-bottom: 6px;
}

/* Chat Messages */
.message-row {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  gap: 4px;
}

.message-row.user {
  align-self: flex-end;
}

.message-row.ai {
  align-self: flex-start;
}

.bubble {
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.5;
  position: relative;
}

.message-row.user .bubble {
  background: var(--user-bubble);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-right-radius: 4px;
}

.message-row.ai .bubble {
  background: var(--ai-bubble);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
  color: #f8fafc;
}

.latin-text {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.spanish-translation {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  color: #cbd5e1;
  font-style: italic;
}

.audio-play-btn {
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid var(--accent-gold);
  color: var(--accent-gold);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s;
}

.audio-play-btn:hover {
  background: var(--accent-gold);
  color: #000;
}

/* Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 24px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
}

.status-dot.listening {
  background: #ef4444;
  animation: pulse-red 1s infinite;
}

.status-dot.thinking {
  background: #f59e0b;
  animation: pulse-amber 1s infinite;
}

.status-dot.speaking {
  background: #6366f1;
  animation: pulse-blue 1s infinite;
}

@keyframes pulse-red {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* Footer & Input */
.input-section {
  padding: 16px 24px;
  background: rgba(13, 15, 23, 0.6);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
}

.mic-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.mic-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold), #b38f20);
  border: none;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
  transition: all 0.2s;
}

.mic-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.6);
}

.mic-btn.active {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.8);
  animation: mic-active 1.2s infinite;
}

@keyframes mic-active {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.mic-icon {
  width: 26px;
  height: 26px;
}

.mic-hint {
  font-size: 10px;
  color: var(--text-muted);
}

.text-input-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: #111420;
  border: 1px solid var(--border-color);
  border-radius: 28px;
  padding: 4px 6px 4px 16px;
}

.text-input-box input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 14px;
  outline: none;
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--purple-glow);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.send-btn:hover {
  background: #4f46e5;
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: #161a26;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 450px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-card h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--accent-gold);
}

.text-field {
  background: #0d0f17;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent-gold);
  color: #000;
  font-weight: bold;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
