/* styles.css — Dr. Vinay Dental Companion & Mascot PWA */

:root {
  --bg-primary: #070d14;
  --bg-secondary: #0b1520;
  --bg-card: #0e1c2a;
  --teal-primary: #14b8a6;
  --teal-hover: #0d9488;
  --teal-glow: rgba(20, 184, 166, 0.25);
  --teal-dark: #042f2e;
  --emerald-btn: #065f46;
  --emerald-text: #34d399;
  --red-pulse: #dc2626;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #1e3a52;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at 50% 20%, #102538 0%, #070d14 75%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  user-select: none;
}

/* Background grid styling */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(20, 184, 166, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20, 184, 166, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* App Header */
.app-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(11, 21, 32, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--teal-primary);
  box-shadow: 0 0 10px var(--teal-glow);
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--teal-primary);
  font-weight: 500;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Voice language selector upfront */
.lang-select-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 28, 42, 0.9);
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid var(--teal-primary);
}

.lang-select-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--teal-primary);
}

.lang-select {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.lang-select option {
  background: var(--bg-card);
  color: #fff;
}

/* Utility buttons */
.btn-util {
  background: rgba(14, 28, 42, 0.85);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-util:hover {
  border-color: var(--teal-primary);
  background: rgba(20, 184, 166, 0.15);
  transform: translateY(-1px);
}

.btn-pip {
  background: linear-gradient(135deg, #0d9488 0%, #065f46 100%);
  border-color: var(--teal-primary);
  box-shadow: 0 0 12px var(--teal-glow);
  color: #fff;
}

.btn-install {
  background: #2563eb;
  border-color: #60a5fa;
  color: #fff;
}

/* Wake word pill */
.wake-pill {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(6, 95, 70, 0.4);
  border: 1px solid var(--emerald-text);
  color: var(--emerald-text);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  animation: pulse-soft 2.5s infinite;
}

@keyframes pulse-soft {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.6; }
}

/* Main Interactive Stage */
.main-stage {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 16px;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

/* Mascot Stage & Canvas */
.mascot-container {
  position: relative;
  width: 240px;
  height: 240px;
  margin-bottom: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#avatarCanvas {
  width: 220px;
  height: 220px;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.65));
  transition: transform 0.15s ease-out;
}

.mascot-container:hover #avatarCanvas {
  transform: scale(1.03);
}

/* Hidden video for Mobile Canvas Stream PiP */
#pipVideo {
  position: absolute;
  top: -9999px;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Speech Bubble directly below Mascot */
.speech-bubble {
  width: 100%;
  max-width: 520px;
  background: var(--bg-secondary);
  border: 2px solid var(--teal-primary);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px var(--teal-glow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Speech pointer arrow pointing UP towards mascot's feet */
.bubble-pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid var(--teal-primary);
}

.bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(14, 28, 42, 0.95);
  border-bottom: 1px solid var(--border-color);
}

.bubble-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bubble-category {
  font-size: 11px;
  background: rgba(20, 184, 166, 0.2);
  color: var(--teal-primary);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--teal-primary);
  font-weight: 600;
}

/* Text speech area with non-truncated layout & teal scrollbar */
.bubble-text-area {
  padding: 14px 16px;
  min-height: 110px;
  max-height: 240px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.55;
  color: #f8fafc;
  user-select: text;
}

.bubble-text-area::-webkit-scrollbar {
  width: 6px;
}
.bubble-text-area::-webkit-scrollbar-track {
  background: #070d14;
}
.bubble-text-area::-webkit-scrollbar-thumb {
  background: var(--teal-primary);
  border-radius: 4px;
}

.question-quote {
  color: var(--teal-primary);
  font-weight: 600;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(20, 184, 166, 0.3);
}

/* Quick inquiries triage chips */
.triage-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  background: rgba(7, 13, 20, 0.5);
  border-top: 1px solid rgba(20, 184, 166, 0.15);
  scrollbar-width: none;
}
.triage-chips::-webkit-scrollbar {
  display: none;
}

.chip {
  background: #112233;
  color: #94a3b8;
  border: 1px solid #1e3a52;
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  background: var(--teal-dark);
  color: var(--teal-primary);
  border-color: var(--teal-primary);
}

/* Bottom input bar */
.bubble-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(14, 28, 42, 0.95);
  border-top: 1px solid var(--border-color);
}

.btn-mic {
  background: var(--emerald-btn);
  color: var(--emerald-text);
  border: 1px solid var(--emerald-text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-mic.listening {
  background: var(--red-pulse);
  color: #fff;
  border-color: #f87171;
  animation: pulse-red 1s infinite alternate;
}

@keyframes pulse-red {
  from { transform: scale(1); box-shadow: 0 0 4px #dc2626; }
  to { transform: scale(1.05); box-shadow: 0 0 14px #dc2626; }
}

.input-question {
  flex: 1;
  background: #070d14;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-question:focus {
  border-color: var(--teal-primary);
  box-shadow: 0 0 8px var(--teal-glow);
}

.btn-submit {
  background: var(--teal-primary);
  color: #042f2e;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-submit:hover {
  background: var(--teal-hover);
  box-shadow: 0 0 10px var(--teal-glow);
}

.btn-web {
  background: #1e3a52;
  color: #67e8f9;
  border: 1px solid #38bdf8;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Mascot Actions Toolbar */
.actions-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  width: 100%;
  max-width: 520px;
}

.btn-action {
  background: rgba(14, 28, 42, 0.7);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-action:hover {
  background: rgba(20, 184, 166, 0.15);
  border-color: var(--teal-primary);
  color: #fff;
}

/* Mobile responsive adjustments */
@media (max-width: 600px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px 12px;
  }
  .header-controls {
    justify-content: space-between;
  }
  .mascot-container {
    width: 200px;
    height: 200px;
    margin-bottom: 8px;
  }
  #avatarCanvas {
    width: 180px;
    height: 180px;
  }
  .bubble-text-area {
    min-height: 90px;
    font-size: 13px;
  }
}
