/* Samira Chatbot Widget — self-contained styles, z-index 9000+ */

/* ── Bubble button ─────────────────────────────────────── */
#samira-chat-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #111111;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 0;
  outline: none;
}

#samira-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
}

#samira-chat-bubble:focus-visible {
  outline: 2px solid #B8975A;
  outline-offset: 3px;
}

#samira-chat-bubble svg {
  display: block;
  flex-shrink: 0;
}

/* Gold pulse on first load — stops after first click */
#samira-chat-bubble.pulse::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid #B8975A;
  animation: sc-pulse 2s ease-out infinite;
  pointer-events: none;
}

@keyframes sc-pulse {
  0%   { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.5); }
}

/* ── Panel ─────────────────────────────────────────────── */
#samira-chat-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 370px;
  height: 540px;
  background: #ffffff;
  border: 1px solid #E8E0D8;
  border-radius: 14px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  z-index: 9001;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.92) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
}

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

/* ── Panel header ──────────────────────────────────────── */
.sc-header {
  background: #111111;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px 14px 0 0;
  flex-shrink: 0;
}

.sc-header-mark {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}

.sc-header-mark span {
  display: block;
  width: 8px;
  height: 8px;
  background: #B8975A;
}

.sc-header-mark span:nth-child(2) {
  margin-left: 4px;
}

.sc-header-text {
  flex: 1;
  min-width: 0;
}

.sc-header-title {
  display: block;
  color: #ffffff;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.sc-header-sub {
  display: block;
  color: #B8975A;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.03em;
  margin-top: 2px;
}

.sc-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.sc-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.sc-close:focus-visible {
  outline: 2px solid #B8975A;
  outline-offset: 2px;
}

/* ── Messages area ─────────────────────────────────────── */
.sc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.sc-messages::-webkit-scrollbar { width: 4px; }
.sc-messages::-webkit-scrollbar-track { background: transparent; }
.sc-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 4px; }

/* Message bubbles */
.sc-msg {
  max-width: 82%;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

.sc-msg.sc-bot {
  align-self: flex-start;
  background: #F7F3EE;
  color: #111111;
  padding: 10px 13px;
  border-radius: 4px 12px 12px 12px;
}

.sc-msg.sc-user {
  align-self: flex-end;
  background: #111111;
  color: #ffffff;
  padding: 10px 13px;
  border-radius: 12px 4px 12px 12px;
}

.sc-msg p {
  margin: 0 0 6px;
}
.sc-msg p:last-child {
  margin-bottom: 0;
}
.sc-msg strong {
  font-weight: 600;
}

/* Typing indicator */
.sc-typing {
  align-self: flex-start;
  background: #F7F3EE;
  padding: 12px 16px;
  border-radius: 4px 12px 12px 12px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.sc-typing span {
  width: 7px;
  height: 7px;
  background: #B8975A;
  border-radius: 50%;
  animation: sc-dot 1.2s ease-in-out infinite;
  display: block;
}

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

@keyframes sc-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ── Input area ────────────────────────────────────────── */
.sc-input-area {
  border-top: 1px solid #E8E0D8;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #ffffff;
  flex-shrink: 0;
}

.sc-input {
  flex: 1;
  border: 1px solid #E8E0D8;
  border-radius: 8px;
  padding: 9px 12px;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 13.5px;
  color: #111111;
  background: #FAFAF9;
  resize: none;
  min-height: 38px;
  max-height: 100px;
  line-height: 1.45;
  outline: none;
  transition: border-color 0.15s;
}

.sc-input::placeholder {
  color: #aaa;
}

.sc-input:focus {
  border-color: #B8975A;
  background: #fff;
}

.sc-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sc-send {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #B8975A;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
  padding: 0;
}

.sc-send:hover:not(:disabled) {
  background: #a07a46;
  transform: scale(1.05);
}

.sc-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.sc-send:focus-visible {
  outline: 2px solid #B8975A;
  outline-offset: 2px;
}

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 600px) {
  #samira-chat-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: none;
    transform-origin: bottom center;
  }

  .sc-header {
    border-radius: 0;
  }

  #samira-chat-bubble {
    bottom: 16px;
    right: 16px;
  }
}
