:root {
  --primary: #F25A29;
  --secondary: #FFBD29;
  --bg-light: #EFEFEF;
  --bg-soft: #FFF8D6;
  --white: #FFFFFF;
  --text-main: #7A2E19;
  --shadow: 0 10px 30px rgba(242, 90, 41, 0.18);
}
.sf-chat-floating {
  position: fixed;
  right: 25px;
  bottom: 25px;
  width: 90px;
  height: 90px;
  border-radius: 50%; /* Circle form */
  border: 4px solid rgba(255, 255, 255, 0.25); /* Glassy border */
  background: linear-gradient(135deg, var(--primary), #ff5e62, var(--secondary));
  background-size: 200% 200%;
  animation: sf-gradient-move 6s ease infinite;
  color: var(--white);
  display: flex;
  flex-direction: column; /* Vertical alignment */
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 10px 30px rgba(242, 90, 41, 0.4), 0 0 0 0 rgba(242, 90, 41, 0.7);
  cursor: pointer;
  z-index: 9999;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: visible;
}

.sf-chat-floating::before {
  content: '';
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  opacity: 0;
  z-index: -1;
  animation: sf-pulse-ring 2s infinite;
}

.sf-chat-floating:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 20px 40px rgba(242, 90, 41, 0.5);
  border-color: rgba(255, 255, 255, 0.6);
}

.sf-chat-icon {
  font-size: 34px;
  margin-top: -4px;
  animation: sf-robot-float 3s ease-in-out infinite;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.sf-chat-text {
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

@keyframes sf-robot-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

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

@keyframes sf-gradient-move {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.sf-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 90px;
  width: 340px;
  max-height: 560px;
  background: var(--white);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 9999;
  
  /* Transition properties */
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  pointer-events: none;
  visibility: hidden;
}

.sf-chat-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
  visibility: visible;
}
.sf-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
}
.sf-head .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sf-body {
  padding: 16px;
  max-height: 380px;
  overflow-y: auto;
  background: #fcfcfc;
  display: flex;
  flex-direction: column;
  gap: 16px; /* Increased gap for better separation of different senders */
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
.sf-body::-webkit-scrollbar { width: 6px; }
.sf-body::-webkit-scrollbar-track { background: transparent; }
.sf-body::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 10px; }

.sf-bubble {
  max-width: 80%;
  padding: 14px 18px; /* Increased padding */
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  position: relative;
  word-wrap: break-word;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  animation: sf-slide-up 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  transition: all 0.2s ease;
}

@keyframes sf-slide-up {
  0% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

@keyframes sf-pop-in {
  0% { transform: scale(0.98); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.sf-bubble.bot {
  align-self: flex-start;
  background: #FFF8F0; /* Creamy light orange */
  color: #4a4a4a;
  border: 1px solid rgba(242, 90, 41, 0.08);
  border-bottom-left-radius: 4px;
  margin-right: 15%;
}

.sf-bubble.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 4px;
  margin-left: 15%;
  box-shadow: 0 4px 12px rgba(242, 90, 41, 0.2);
  animation: sf-pop-in 0.2s ease-out forwards;
}

.sf-timestamp {
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.6;
  display: block;
  text-align: right;
  line-height: 1;
}
.sf-bubble.bot .sf-timestamp { text-align: left; opacity: 0.5; }
.sf-bubble.user .sf-timestamp { color: rgba(255,255,255,0.8); }

.sf-input {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: var(--white);
  border-top: 1px solid #f0f0f0;
}
.sf-input input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 24px; /* Pill shape */
  padding: 10px 16px;
  background: #f9f9f9;
  transition: all 0.2s ease;
  font-size: 14px;
}
.sf-input input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(242, 90, 41, 0.1);
  outline: none;
}
.sf-input button {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 50%; /* Circular send button */
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  box-shadow: 0 4px 10px rgba(242, 90, 41, 0.3);
  cursor: pointer;
}
.sf-input button:hover {
  transform: scale(1.05);
}
.sf-input button:disabled {
  background: #ccc;
  transform: none;
  box-shadow: none;
  cursor: default;
}

.sf-loading {
  align-self: flex-start;
  display: inline-flex;
  gap: 4px;
  padding: 12px 16px;
  background: #FFF8F0;
  border: 1px solid rgba(242, 90, 41, 0.1);
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  margin-bottom: 10px;
  width: fit-content;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.sf-loading span {
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}
.sf-loading span:nth-child(1) { animation-delay: -0.32s; }
.sf-loading span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}
.sf-fallback-btn {
  cursor: pointer;
}
.sf-call-input {
  font-size: 13px;
}
@media(max-width: 480px){
  .sf-chat-panel{ right: 10px; width: 92%; bottom: 80px; max-height: 70vh; }
  .sf-chat-floating{ 
    right: 15px; 
    bottom: 15px;
    width: 60px;
    height: 60px;
    border-width: 3px;
  }
  .sf-chat-icon {
    font-size: 22px;
    margin-top: -2px;
  }
  .sf-chat-text {
    font-size: 8px;
    letter-spacing: 0.2px;
  }
}
