/* ══════════════════════════════════════════
   ROCKGEL CHATBOT — Styles
   ══════════════════════════════════════════ */

/* ── Ribbon Tab ── */
.rg-chatbot-ribbon {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 160px;
  background: #091E37;
  border-radius: 12px 0 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  cursor: pointer;
  z-index: 9999;
  animation: ribbonFloat 3s ease-in-out infinite;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s ease;
  box-shadow: -4px 0 20px rgba(14, 49, 87, 0.2);
  border: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.rg-chatbot-ribbon::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  bottom: -2px;
  width: calc(100% + 2px);
  border-radius: 14px 0 0 14px;
  background: linear-gradient(180deg, #D4A853, #3B82F6, #0E3157, #D4A853);
  background-size: 100% 300%;
  animation: ribbonGradient 4s ease infinite;
  z-index: -1;
  opacity: 0.7;
}

.rg-chatbot-ribbon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 16px 0 0 16px;
  box-shadow: -4px 0 25px rgba(212, 168, 83, 0.25),
              -4px 0 25px rgba(59, 130, 246, 0.15);
  animation: ribbonGlow 2s ease-in-out infinite alternate;
  z-index: -2;
  pointer-events: none;
}

.rg-chatbot-ribbon:hover {
  width: 56px;
}

.rg-chatbot-ribbon:hover::after {
  box-shadow: -6px 0 35px rgba(212, 168, 83, 0.4),
              -6px 0 35px rgba(59, 130, 246, 0.25);
}

.rg-chatbot-ribbon--hidden {
  transform: translateY(-50%) translateX(100%);
  pointer-events: none;
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.2s ease;
}

.rg-chatbot-ribbon__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.rg-chatbot-ribbon__text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: #F5F5F5;
  user-select: none;
}

/* ── Notification Badge ── */
.rg-chatbot-ribbon__badge {
  position: absolute;
  top: -6px;
  left: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #D4A853, #E8C97A);
  color: #091E37;
  font-family: 'Outfit', sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(212, 168, 83, 0.5);
}

.rg-chatbot-ribbon__badge--pop {
  animation: badgePop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Ribbon Animations ── */
@keyframes ribbonFloat {
  0%, 100% { transform: translateY(-50%); }
  50%      { transform: translateY(calc(-50% + 6px)); }
}

@keyframes ribbonGradient {
  0%   { background-position: 0% 0%; }
  50%  { background-position: 0% 100%; }
  100% { background-position: 0% 0%; }
}

@keyframes ribbonGlow {
  0%   { opacity: 0.4; }
  100% { opacity: 0.8; }
}

@keyframes badgePop {
  0%   { transform: scale(0); }
  70%  { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ── Chat Window ── */
.rg-chatbot-window {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%) translateX(110%);
  width: 400px;
  height: min(580px, 80vh);
  background: #FAF7F3;
  border-radius: 16px 0 0 16px;
  box-shadow: -8px 0 40px rgba(14, 49, 87, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10000;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.rg-chatbot-window--open {
  transform: translateY(-50%) translateX(0);
}

/* ── Chat Header ── */
.rg-chatbot-header {
  background: linear-gradient(135deg, #0E3157 0%, #1A4F8B 50%, #3B82F6 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: relative;
}

.rg-chatbot-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #D4A853, #3B82F6, #D4A853);
  background-size: 200% 100%;
  animation: headerLine 3s ease infinite;
}

@keyframes headerLine {
  0%   { background-position: 0% 0%; }
  50%  { background-position: 100% 0%; }
  100% { background-position: 0% 0%; }
}

.rg-chatbot-header__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rg-chatbot-header__logo {
  height: 28px;
  width: auto;
}

.rg-chatbot-header__title {
  display: block;
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: #F5F5F5;
}

.rg-chatbot-header__status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  color: rgba(245, 245, 245, 0.65);
}

.rg-chatbot-header__status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #34D399;
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.rg-chatbot-header__close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  color: #F5F5F5;
}

.rg-chatbot-header__close:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

.rg-chatbot-header__close svg {
  width: 18px;
  height: 18px;
}

/* ── Messages Container ── */
.rg-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.rg-chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.rg-chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.rg-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(14, 49, 87, 0.15);
  border-radius: 4px;
}

/* ── Message Bubbles ── */
.rg-chatbot-msg {
  max-width: 85%;
  padding: 12px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  line-height: 1.6;
  word-wrap: break-word;
}

.rg-chatbot-msg--bot {
  align-self: flex-start;
  background: #FFFFFF;
  color: #1A1A2E;
  border: 1px solid rgba(14, 49, 87, 0.08);
  border-radius: 4px 16px 16px 16px;
}

.rg-chatbot-msg--user {
  align-self: flex-end;
  background: #0E3157;
  color: #F5F5F5;
  border-radius: 16px 4px 16px 16px;
}

.rg-chatbot-msg--entering {
  animation: msgSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

/* ── Markdown Content ── */
.rg-chatbot-msg--bot strong { font-weight: 600; color: #0E3157; }
.rg-chatbot-msg--bot em { font-style: italic; }
.rg-chatbot-msg--bot code {
  background: rgba(14, 49, 87, 0.06);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.84rem;
}
.rg-chatbot-msg--bot a {
  color: #3B82F6;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.rg-chatbot-msg--bot a:hover { color: #1A4F8B; }
.rg-chatbot-msg--bot ul,
.rg-chatbot-msg--bot ol {
  margin: 6px 0;
  padding-left: 18px;
}
.rg-chatbot-msg--bot li { margin: 3px 0; }

/* ── Typing Indicator ── */
.rg-chatbot-typing {
  align-self: flex-start;
  background: #FFFFFF;
  border: 1px solid rgba(14, 49, 87, 0.08);
  border-radius: 4px 16px 16px 16px;
  padding: 14px 20px;
  display: flex;
  gap: 5px;
  align-items: center;
  animation: msgSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.rg-chatbot-typing__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6B7280;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.rg-chatbot-typing__dot:nth-child(2) { animation-delay: 0.15s; }
.rg-chatbot-typing__dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-8px); opacity: 1; }
}

/* ── Quick Actions ── */
.rg-chatbot-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px;
  flex-shrink: 0;
}

.rg-chatbot-quick__btn {
  background: transparent;
  border: 1.5px solid rgba(14, 49, 87, 0.15);
  border-radius: 100px;
  padding: 7px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  color: #0E3157;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.rg-chatbot-quick__btn:hover {
  background: #0E3157;
  color: #F5F5F5;
  border-color: #0E3157;
  transform: translateY(-1px);
}

/* ── Input Area ── */
.rg-chatbot-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  background: #FFFFFF;
  border-top: 1px solid rgba(14, 49, 87, 0.08);
  flex-shrink: 0;
  position: relative;
}

.rg-chatbot-input::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #D4A853, #E8C97A);
  transition: width 0.3s ease;
}

.rg-chatbot-input--focused::before {
  width: 100%;
}

.rg-chatbot-input__textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  color: #1A1A2E;
  background: transparent;
  line-height: 1.5;
  max-height: 100px;
  padding: 8px 0;
}

.rg-chatbot-input__textarea::placeholder {
  color: #6B7280;
}

.rg-chatbot-input__send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #D4A853, #E8C97A);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s, opacity 0.2s, box-shadow 0.2s;
}

.rg-chatbot-input__send:disabled {
  opacity: 0.35;
  cursor: default;
}

.rg-chatbot-input__send:not(:disabled):hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(212, 168, 83, 0.4);
}

.rg-chatbot-input__send svg {
  width: 18px;
  height: 18px;
  color: #091E37;
}

/* ── Mobile (< 769px) ── */
@media (max-width: 768px) {
  .rg-chatbot-ribbon {
    top: auto;
    bottom: 0;
    right: 50%;
    transform: translateX(50%);
    width: 160px;
    height: 44px;
    flex-direction: row;
    border-radius: 12px 12px 0 0;
    animation: ribbonFloatMobile 3s ease-in-out infinite;
  }

  .rg-chatbot-ribbon::before {
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: auto;
    width: calc(100% + 4px);
    height: calc(100% + 2px);
    border-radius: 14px 14px 0 0;
    background: linear-gradient(90deg, #D4A853, #3B82F6, #0E3157, #D4A853);
    background-size: 300% 100%;
    animation: ribbonGradientH 4s ease infinite;
  }

  .rg-chatbot-ribbon::after {
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 25px rgba(212, 168, 83, 0.25),
                0 -4px 25px rgba(59, 130, 246, 0.15);
  }

  .rg-chatbot-ribbon__text {
    writing-mode: horizontal-tb;
    text-orientation: initial;
    letter-spacing: 2px;
  }

  .rg-chatbot-ribbon__badge {
    top: -8px;
    left: auto;
    right: -8px;
  }

  .rg-chatbot-ribbon:hover {
    width: 160px;
    height: 48px;
  }

  .rg-chatbot-ribbon--hidden {
    transform: translateX(50%) translateY(100%);
  }

  @keyframes ribbonFloatMobile {
    0%, 100% { transform: translateX(50%); }
    50%      { transform: translateX(50%) translateY(-4px); }
  }

  @keyframes ribbonGradientH {
    0%   { background-position: 0% 0%; }
    50%  { background-position: 100% 0%; }
    100% { background-position: 0% 0%; }
  }

  .rg-chatbot-window {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    transform: translateY(100%);
  }

  .rg-chatbot-window--open {
    transform: translateY(0);
  }

  .rg-chatbot-quick {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .rg-chatbot-quick::-webkit-scrollbar { display: none; }
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
  .rg-chatbot-ribbon,
  .rg-chatbot-ribbon::before,
  .rg-chatbot-ribbon::after,
  .rg-chatbot-header::after,
  .rg-chatbot-header__status-dot,
  .rg-chatbot-typing__dot,
  .rg-chatbot-msg--entering,
  .rg-chatbot-ribbon__badge--pop {
    animation: none;
  }

  .rg-chatbot-window,
  .rg-chatbot-ribbon,
  .rg-chatbot-header__close,
  .rg-chatbot-input__send {
    transition-duration: 0.01ms;
  }
}
