/* ============================================================
   Star Medica — Chatbot Widget CSS
   Renk şeması: #001b57 (navy), #496455 (sage), #fbf9f5 (surface)
   ============================================================ */

/* ── Floating Toggle Button ──────────────────────────────── */
#sm-chat-toggle {
  position: fixed;
  bottom: 108px;  /* randevu FAB (32px bottom + 64px yükseklik) + 12px boşluk */
  right: 32px;
  width: 63px;
  height: 63px;
  border-radius: 50%;
  background: #496455;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(73, 100, 85, 0.45);
  z-index: 9998;
  transition: transform 0.2s ease, background 0.2s ease;
}

#sm-chat-toggle:hover {
  background: #3a5244;
  transform: scale(1.08);
}

#sm-chat-toggle .material-symbols-outlined {
  font-size: 32px;
  transition: opacity 0.2s ease;
}

/* Badge (yeni mesaj göstergesi) */
#sm-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e53935;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  display: none;
}

/* ── Chat Panel ──────────────────────────────────────────── */
#sm-chat-panel {
  position: fixed;
  bottom: 176px;
  right: 28px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(0, 27, 87, 0.18);
  display: flex;
  flex-direction: column;
  z-index: 9997;
  overflow: hidden;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1),
              opacity 0.2s ease;
}

#sm-chat-panel.sm-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ─────────────────────────────────────────────── */
#sm-chat-header {
  background: linear-gradient(135deg, #001b57 0%, #0d2d7a 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#sm-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#sm-chat-avatar .material-symbols-outlined {
  font-size: 24px;
  color: #fff;
}

#sm-chat-header-info h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 2px;
  line-height: 1.2;
}

#sm-chat-header-info p {
  font-size: 12px;
  opacity: 0.8;
  margin: 0;
}

#sm-chat-close {
  margin-left: auto;
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}

#sm-chat-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

#sm-chat-close .material-symbols-outlined {
  font-size: 22px;
}

/* ── Messages Area ───────────────────────────────────────── */
#sm-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8f7f4;
  scroll-behavior: smooth;
}

#sm-chat-messages::-webkit-scrollbar {
  width: 4px;
}
#sm-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
#sm-chat-messages::-webkit-scrollbar-thumb {
  background: #d0cec9;
  border-radius: 2px;
}

/* ── Bubble ─────────────────────────────────────────────── */
.sm-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  animation: sm-bubble-in 0.2s ease;
}

@keyframes sm-bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sm-bubble.sm-bot {
  background: #fff;
  color: #1a1a2e;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  align-self: flex-start;
}

.sm-bubble.sm-user {
  background: #001b57;
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  align-self: flex-end;
}

/* Typing indicator */
.sm-bubble.sm-typing {
  background: #fff;
  align-self: flex-start;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 14px 18px;
}

.sm-typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.sm-typing-dots span {
  width: 7px;
  height: 7px;
  background: #496455;
  border-radius: 50%;
  animation: sm-dot 1.2s infinite ease-in-out;
}

.sm-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.sm-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes sm-dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1;   }
}

/* ── Randevu Formu (chat içi) ───────────────────────────── */
#sm-appointment-form-wrap {
  background: #fff;
  border-top: 1px solid #eee;
  padding: 14px 16px;
  flex-shrink: 0;
  display: none;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 300px;
}

#sm-appointment-form-wrap.sm-visible {
  display: flex;
}

#sm-appointment-form-wrap h4 {
  font-size: 14px;
  font-weight: 700;
  color: #001b57;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

#sm-appointment-form-wrap h4 .material-symbols-outlined {
  font-size: 18px;
  color: #496455;
}

.sm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sm-form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sm-form-field.sm-full {
  grid-column: 1 / -1;
}

.sm-form-field label {
  font-size: 11px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sm-form-field input,
.sm-form-field textarea,
.sm-form-field select {
  border: 1.5px solid #e0ddd9;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #1a1a2e;
  background: #fbf9f5;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}

.sm-form-field input:focus,
.sm-form-field textarea:focus,
.sm-form-field select:focus {
  border-color: #001b57;
  background: #fff;
}

.sm-form-field textarea {
  resize: none;
  height: 64px;
}

.sm-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

#sm-form-submit {
  flex: 1;
  background: #496455;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s;
}

#sm-form-submit:hover   { background: #3a5244; }
#sm-form-submit:disabled { opacity: 0.6; cursor: not-allowed; }

#sm-form-cancel {
  background: #f3f2ef;
  color: #555;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

#sm-form-cancel:hover { background: #e8e6e2; }

/* ── Input Area ─────────────────────────────────────────── */
#sm-chat-input-area {
  padding: 12px 14px;
  border-top: 1px solid #eeece9;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #fff;
  flex-shrink: 0;
}

#sm-chat-input {
  flex: 1;
  border: 1.5px solid #e0ddd9;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  resize: none;
  outline: none;
  font-family: inherit;
  color: #1a1a2e;
  background: #fbf9f5;
  max-height: 100px;
  overflow-y: auto;
  transition: border-color 0.15s;
  line-height: 1.4;
}

#sm-chat-input:focus {
  border-color: #001b57;
  background: #fff;
}

#sm-chat-input::placeholder {
  color: #aaa;
}

#sm-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #001b57;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}

#sm-chat-send:hover   { background: #0d2d7a; }
#sm-chat-send:active  { transform: scale(0.93); }
#sm-chat-send:disabled { opacity: 0.45; cursor: not-allowed; }

#sm-chat-send .material-symbols-outlined {
  font-size: 20px;
}

/* ── Quick Reply Chips ───────────────────────────────────── */
#sm-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 0;
  background: #f8f7f4;
}

.sm-chip {
  background: #fff;
  border: 1.5px solid #d9d6d1;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: #001b57;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  animation: sm-bubble-in 0.2s ease;
}

.sm-chip:hover {
  background: #001b57;
  border-color: #001b57;
  color: #fff;
}

/* ── Footer note ─────────────────────────────────────────── */
#sm-chat-footer {
  text-align: center;
  font-size: 10px;
  color: #bbb;
  padding: 4px 0 8px;
  background: #fff;
  flex-shrink: 0;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 420px) {
  #sm-chat-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  #sm-chat-toggle {
    bottom: 108px;
    right: 16px;
  }
}