/* ═══════════════════════════════════════════
   SMRITI AI — SIB Blue Theme Chatbot
   Matches smriti-bakery-school.html design
   ═══════════════════════════════════════════ */

:root {
  --cb-accent:      #1E56C7;
  --cb-accent-deep: #123C93;
  --cb-sky:         #4C86F0;
  --cb-sky-soft:    #DCEAFF;
  --cb-ink:         #0F1D3D;
  --cb-text:        #16264A;
  --cb-muted:       #5C6B85;
  --cb-line:        #DCE7F9;
  --cb-surface:     #FFFFFF;
  --cb-surface2:    #EEF4FF;
  --cb-green:       #1E9E63;
}

/* ── TOGGLE BUTTON ──────────────────────── */
.chatbot-toggle {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--cb-accent);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 9998;
  box-shadow: 0 6px 18px rgba(11, 23, 54, 0.28);
  padding: 0;
  overflow: visible;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1),
              background 0.2s ease-out,
              box-shadow 0.2s ease-out;
}

.chatbot-toggle:hover {
  transform: translateY(-2px);
  background: var(--cb-accent-deep);
  box-shadow: 0 10px 24px rgba(11, 23, 54, 0.32);
}

.chatbot-toggle:active { transform: scale(0.95); }

/* ── TOGGLE SVG (chat bubble icon) ─────── */
.toggle-svg {
  width: 30px; height: 30px;
  overflow: visible;
}

/* Recolor SVG elements from amber → white */
.svg-bubble, .svg-tail { fill: #ffffff !important; }
.svg-eye-left, .svg-eye-right { fill: var(--cb-accent) !important; }
.svg-mouth1, .svg-mouth2, .svg-mouth3 { fill: var(--cb-accent-deep) !important; }

.svg-bubble, .svg-tail {
  animation: bubbleFloat 4s ease-in-out infinite;
  transform-origin: 25px 22px;
}
@keyframes bubbleFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2.5px); }
}

.svg-eye-left, .svg-eye-right {
  animation: eyeBlink 5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
.svg-eye-right { animation-delay: 0.15s; }
@keyframes eyeBlink {
  0%, 90%, 100% { transform: scaleY(1); }
  95%           { transform: scaleY(0.15); }
}

.svg-mouth1 { animation: mouthWave 1.4s ease-in-out infinite 0s; transform-origin: center; }
.svg-mouth2 { animation: mouthWave 1.4s ease-in-out infinite 0.2s; transform-origin: center; }
.svg-mouth3 { animation: mouthWave 1.4s ease-in-out infinite 0.4s; transform-origin: center; }
@keyframes mouthWave {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.5; }
  50%      { transform: translateY(-2px) scale(1.25); opacity: 1; }
}

.svg-antenna-dot {
  fill: rgba(255,255,255,0.85) !important;
  animation: antennaPulse 2s ease-in-out infinite;
  transform-origin: center;
}
@keyframes antennaPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50%      { opacity: 1; transform: scale(1.3); }
}

.chat-badge {
  position: absolute; top: -3px; right: -3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #dc2626; color: white;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  z-index: 2;
}

/* ── CHAT WINDOW ────────────────────────── */
.chatbot-window {
  position: fixed;
  bottom: 96px; right: 24px;
  width: 400px;
  height: 580px;
  max-height: calc(100vh - 140px);
  min-height: 420px;
  display: flex; flex-direction: column;
  z-index: 9997;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(247, 250, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--cb-line);
  box-shadow: 0 20px 60px rgba(11, 23, 54, 0.17), 0 2px 8px rgba(11, 23, 54, 0.06);
  transform: scale(0.88) translateY(30px);
  opacity: 0; pointer-events: none;
  transform-origin: bottom right;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.chatbot-window.open {
  transform: scale(1) translateY(0);
  opacity: 1; pointer-events: all;
}

/* ── HEADER ─────────────────────────────── */
.chatbot-header {
  background: linear-gradient(135deg, var(--cb-accent) 0%, var(--cb-accent-deep) 100%);
  padding: 0 20px;
  height: 68px;
  display: flex; align-items: center;
  justify-content: space-between;
  border-bottom: none;
  flex-shrink: 0;
  position: relative;
}

.chatbot-header::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, rgba(76,134,240,0) 0%, rgba(76,134,240,0.6) 50%, rgba(76,134,240,0) 100%);
}

.chatbot-header-info {
  display: flex; align-items: center; gap: 12px;
  flex: 1; min-width: 0;
}

.chatbot-avatar {
  width: 40px; height: 40px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.chatbot-header-text h4 {
  font-family: 'Fraunces', serif;
  font-size: 1rem; font-weight: 600;
  color: #ffffff; margin: 0 0 2px;
}

.chatbot-header-text span {
  font-size: 12px; color: rgba(255, 255, 255, 0.72);
  font-family: 'Instrument Sans', sans-serif;
  display: block;
}

.chatbot-header-right {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

.chatbot-status {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 20px; padding: 4px 10px;
  font-size: 12px; color: #fff; font-weight: 600;
  font-family: 'Instrument Sans', sans-serif;
}

.chatbot-status::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: #5BF08A;
  animation: statusBlink 1.5s ease-in-out infinite;
}
@keyframes statusBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.chatbot-minimize,
.chatbot-close {
  width: 30px; height: 30px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px; cursor: pointer;
  color: rgba(255, 255, 255, 0.8); font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}

.chatbot-minimize:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.chatbot-close:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  transform: rotate(90deg);
}

/* ── MESSAGES AREA ───────────────────────── */
.chatbot-messages {
  flex: 1; overflow-y: auto;
  padding: 18px 16px;
  display: flex; flex-direction: column; gap: 14px;
  background: var(--cb-surface2);
  min-height: 0;
}

.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: var(--cb-line); border-radius: 4px; }
.chatbot-messages::-webkit-scrollbar-thumb:hover { background: var(--cb-sky); }

.chat-msg {
  display: flex; gap: 10px; align-items: flex-start;
  max-width: 86%;
  animation: msgIn 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 32px; height: 32px; border-radius: 9px;
  background: var(--cb-surface);
  border: 1px solid var(--cb-line);
  display: flex; align-items: center; justify-content: center;
  color: var(--cb-accent); font-size: 12px; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(11, 23, 54, 0.06);
}

.chat-msg.user .chat-msg-avatar {
  background: var(--cb-accent); color: #fff; border-color: var(--cb-accent);
}

.chat-msg-bubble {
  padding: 11px 15px;
  font-size: 0.86rem; line-height: 1.6;
  font-family: 'Instrument Sans', sans-serif;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 2px 8px rgba(11, 23, 54, 0.06);
  word-break: break-word;
}

.chat-msg.bot .chat-msg-bubble {
  background: var(--cb-surface);
  color: var(--cb-text);
  border: 1px solid var(--cb-line);
}

.chat-msg.user .chat-msg-bubble {
  background: linear-gradient(135deg, var(--cb-accent) 0%, var(--cb-accent-deep) 100%);
  color: #ffffff;
  font-weight: 500;
  border-radius: 16px 4px 16px 16px;
}

.chat-msg-bubble strong { font-weight: 700; color: var(--cb-ink); }
.chat-msg.user .chat-msg-bubble strong { color: #fff; }

.chat-msg-bubble a {
  color: var(--cb-accent); font-weight: 600;
  text-decoration: none;
  border-bottom: 1.5px dotted rgba(30, 86, 199, 0.4);
  transition: color 0.2s;
}
.chat-msg.user .chat-msg-bubble a { color: #BCD3FF; border-bottom-color: rgba(188,211,255,.4); }
.chat-msg-bubble a:hover { color: var(--cb-accent-deep); border-bottom-style: solid; }

.chat-msg-time {
  font-size: 12px; color: var(--cb-muted);
  margin-top: 3px; padding: 0 4px;
  font-family: 'Instrument Sans', sans-serif;
}
.chat-msg.user .chat-msg-time { text-align: right; }

/* Typing animation */
.chat-typing .chat-msg-bubble { padding: 12px 18px; }
.typing-dots { display: flex; gap: 5px; align-items: center; height: 12px; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cb-sky);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0) scale(0.8); opacity: 0.4; }
  45%           { transform: translateY(-6px) scale(1.15); opacity: 1; }
}

/* ── SUGGESTIONS ─────────────────────────── */
.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px 16px;
  background: var(--cb-surface);
  border-top: 1px solid var(--cb-line);
  flex-shrink: 0;
}

.chat-suggest-btn {
  background: var(--cb-surface2);
  border: 1px solid var(--cb-line);
  color: var(--cb-text);
  font-size: 12px; font-weight: 500;
  padding: 6px 14px; border-radius: 999px;
  cursor: pointer; font-family: 'Instrument Sans', sans-serif;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex; align-items: center; gap: 6px;
}

.chat-suggest-btn::before {
  content: '→'; color: var(--cb-accent);
  font-weight: 700;
  transition: transform 0.22s ease;
}

.chat-suggest-btn:hover {
  background: var(--cb-accent); color: #fff;
  border-color: var(--cb-accent);
  box-shadow: 0 4px 14px rgba(11, 23, 54, 0.19);
}
.chat-suggest-btn:hover::before { color: #fff; transform: translateX(2px); }

/* ── ENQUIRY FORM ────────────────────────── */
.chat-enquiry-form {
  padding: 16px;
  background: var(--cb-surface);
  border-top: 1px solid var(--cb-line);
  display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
  animation: slideUp 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-enquiry-form strong {
  font-family: 'Fraunces', serif;
  font-size: 0.88rem; color: var(--cb-ink);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
}

.chat-enquiry-form input,
.chat-enquiry-form textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--cb-line);
  border-radius: 10px;
  font-family: 'Instrument Sans', sans-serif; font-size: 0.82rem;
  color: var(--cb-ink); background: var(--cb-surface2);
  outline: none; resize: none;
  transition: all 0.22s;
  box-sizing: border-box;
}

.chat-enquiry-form input::placeholder,
.chat-enquiry-form textarea::placeholder { color: var(--cb-muted); }

.chat-enquiry-form input:focus,
.chat-enquiry-form textarea:focus {
  border-color: var(--cb-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(30, 86, 199, 0.14);
}

.chat-enquiry-form textarea { min-height: 60px; }

.chat-enquiry-submit {
  background: var(--cb-accent);
  color: #ffffff;
  border: none; border-radius: 10px;
  padding: 11px; font-weight: 600; font-size: 0.86rem;
  cursor: pointer; font-family: 'Instrument Sans', sans-serif;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(11, 23, 54, 0.21);
}

.chat-enquiry-submit:hover {
  background: var(--cb-accent-deep);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(11, 23, 54, 0.29);
}

.chat-enquiry-cancel {
  background: none; border: none; color: var(--cb-muted);
  font-size: 12px; cursor: pointer; text-align: center;
  font-family: 'Instrument Sans', sans-serif; transition: color 0.2s;
  padding: 4px;
}
.chat-enquiry-cancel:hover { color: var(--cb-ink); }

/* ── INPUT BAR ───────────────────────────── */
.chatbot-input-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--cb-line);
  background: var(--cb-surface);
  flex-shrink: 0;
}

.chatbot-input {
  flex: 1; padding: 10px 16px;
  border: 1.5px solid var(--cb-line);
  border-radius: 999px;
  font-family: 'Instrument Sans', sans-serif; font-size: 0.86rem;
  color: var(--cb-ink); background: var(--cb-surface2);
  outline: none; transition: all 0.22s;
  min-width: 0;
}

.chatbot-input:focus {
  border-color: var(--cb-accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(30, 86, 199, 0.12);
}

.chatbot-input::placeholder { color: var(--cb-muted); }

.chatbot-send {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--cb-accent); color: #fff;
  border: none;
  cursor: pointer; font-size: 0.84rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.22s;
  box-shadow: 0 4px 12px rgba(11, 23, 54, 0.21);
}

.chatbot-send:hover {
  background: var(--cb-accent-deep);
  transform: scale(1.08);
  box-shadow: 0 6px 18px rgba(11, 23, 54, 0.29);
}

/* ── FOOTER ──────────────────────────────── */
.chatbot-footer-bar {
  text-align: center; padding: 7px 16px;
  font-size: 12px; color: var(--cb-muted);
  font-family: 'Instrument Sans', sans-serif;
  background: var(--cb-surface);
  border-top: 1px solid var(--cb-line);
  flex-shrink: 0;
}
.chatbot-footer-bar span { color: var(--cb-accent); font-weight: 700; }

/* ── TABLET ──────────────────────────────── */
@media (max-width: 768px) {
  .chatbot-window {
    right: 16px; left: 16px;
    width: auto;
    bottom: 96px;
    height: 540px;
  }
}

/* ── MOBILE FULL-SCREEN ──────────────────── */
@media (max-width: 480px) {
  .chatbot-window {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100% !important;
    max-height: 100%; min-height: 100%;
    border-radius: 0; border: none;
    box-shadow: none; z-index: 10000;
    background: var(--cb-surface2);
  }

  .chatbot-window.open { transform: translateY(0) scale(1); }
  .chatbot-window { transform: translateY(100%) scale(1); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease; }

  .chatbot-toggle { right: 16px; bottom: 16px; width: 52px; height: 52px; }

  .chatbot-header { height: 62px; padding: 0 16px; }

  @supports (padding-top: env(safe-area-inset-top)) {
    .chatbot-header {
      padding-top: env(safe-area-inset-top);
      height: calc(62px + env(safe-area-inset-top));
    }
  }

  .chatbot-messages { padding: 14px 12px; }
  .chatbot-input-bar { padding: 10px 12px; }

  @supports (padding-bottom: env(safe-area-inset-bottom)) {
    .chatbot-input-bar {
      padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
  }

  .chat-msg { max-width: 90%; }
  .chat-suggest-btn { font-size: 12px; padding: 5px 12px; }
}