/* ============ Alexa Logistics AI Chat Widget (Riya) ============ */
.sc-widget { position: fixed; z-index: 9999; font-family: "Inter", "Segoe UI", Arial, sans-serif; }

/* ---- Launcher ---- */
.sc-launcher {
  position: fixed; right: 22px; bottom: 158px; z-index: 9999;
  width: 62px; height: 62px; border-radius: 50%; border: 0; cursor: pointer;
  background: linear-gradient(135deg, #0b2447, #1a4a86);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(11, 36, 71, 0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sc-launcher:hover { transform: scale(1.08); box-shadow: 0 14px 32px rgba(249, 115, 22, 0.45); }
.sc-launcher svg { width: 28px; height: 28px; }
.sc-launcher .sc-close-icon { display: none; }
.sc-widget.open .sc-launcher .sc-chat-icon { display: none; }
.sc-widget.open .sc-launcher .sc-close-icon { display: block; }

.sc-teaser {
  position: fixed; right: 96px; bottom: 176px; z-index: 9998;
  background: #fff; color: #212121; border-radius: 16px 16px 4px 16px;
  box-shadow: 0 12px 30px rgba(11, 36, 71, 0.18); padding: 12px 16px;
  font-size: 14px; line-height: 1.45; max-width: 230px; cursor: pointer;
  border: 1px solid #e4eaf3; animation: sc-pop 0.4s ease;
}
.sc-teaser strong { color: #f97316; }
.sc-teaser .sc-teaser-x {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px;
  border-radius: 50%; background: #4a4a4a; color: #fff; border: 0; cursor: pointer;
  font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.sc-teaser .sc-teaser-x:hover { background: #f97316; }
@keyframes sc-pop { from { opacity: 0; transform: translateY(10px) scale(0.95); } to { opacity: 1; transform: none; } }

/* ---- Panel ---- */
.sc-panel {
  position: fixed; right: 22px; bottom: 158px; z-index: 9999;
  width: 390px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 190px);
  background: #fff; border-radius: 18px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(11, 36, 71, 0.28);
  border: 1px solid #e4eaf3;
  transform-origin: bottom right; opacity: 0; transform: scale(0.9); pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.sc-widget.open .sc-panel { opacity: 1; transform: none; pointer-events: auto; }

.sc-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: linear-gradient(135deg, #0b2447, #1a4a86); color: #fff;
}
.sc-avatar {
  width: 42px; height: 42px; border-radius: 50%; background: #fff; color: #f97316;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 19px; flex-shrink: 0; overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}
.sc-avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sc-head-info { flex: 1; min-width: 0; }
.sc-head-name { font-weight: 700; font-size: 15.5px; line-height: 1.2; }
.sc-head-sub { font-size: 12.5px; opacity: 0.95; }
.sc-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.sc-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; display: inline-block; animation: sc-blink 1.6s infinite; }
@keyframes sc-blink { 50% { opacity: 0.45; } }
.sc-close {
  background: transparent; border: 0; color: #fff; cursor: pointer;
  width: 34px; height: 34px; border-radius: 50%; font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.sc-close:hover { background: rgba(255, 255, 255, 0.18); }

.sc-body { flex: 1; overflow-y: auto; padding: 16px; background: #f3f6fb; display: flex; flex-direction: column; gap: 12px; }

.sc-msg { display: flex; gap: 8px; max-width: 88%; animation: sc-in 0.22s ease; }
@keyframes sc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sc-msg .sc-bubble-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: #fff; color: #f97316;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0; border: 1px solid #e4eaf3; margin-top: 2px; overflow: hidden;
}
.sc-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.sc-msg .bubble {
  padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
}
.sc-msg.bot .bubble { background: #fff; color: #212121; border: 1px solid #e4eaf3; border-top-left-radius: 4px; }
.sc-msg.user .bubble { background: #f97316; color: #fff; border-top-right-radius: 4px; }
.sc-msg .bubble a { color: inherit; text-decoration: underline; }

.sc-action-btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sc-action-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px; border-radius: 22px; font-size: 13px; font-weight: 600;
  text-decoration: none !important; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
  background: #f97316; color: #fff; box-shadow: 0 6px 16px rgba(249, 115, 22, 0.32);
}
.sc-action-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(249, 115, 22, 0.42); }
.sc-action-btn.sc-action-app { background: #25d366; box-shadow: 0 6px 16px rgba(37, 211, 102, 0.3); }
.sc-action-btn.sc-action-app:hover { box-shadow: 0 8px 20px rgba(37, 211, 102, 0.38); }

.sc-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.sc-typing span { width: 7px; height: 7px; border-radius: 50%; background: #b8b8b8; animation: sc-ty 1.2s infinite; }
.sc-typing span:nth-child(2) { animation-delay: 0.15s; }
.sc-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes sc-ty { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }

.sc-chips { display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; background: #fff; border-top: 1px solid #f0f2f6; }
.sc-chip {
  flex-shrink: 0; border: 1px solid #fbc9a3; background: #fdf3ea; color: #ea6a0c;
  border-radius: 20px; padding: 7px 14px; font-size: 13px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.sc-chip:hover { background: #f97316; color: #fff; border-color: #f97316; }

.sc-input-row { display: flex; gap: 8px; padding: 12px 14px; background: #fff; border-top: 1px solid #f0f2f6; }
.sc-input {
  flex: 1; border: 1px solid #e4eaf3; border-radius: 22px; padding: 10px 16px;
  font-size: 14px; font-family: inherit; outline: none; background: #f3f6fb;
}
.sc-input:focus { border-color: #f97316; background: #fff; }
.sc-send {
  width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: #f97316; color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease; flex-shrink: 0;
}
.sc-send:hover { background: #ea6a0c; transform: scale(1.05); }
.sc-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.sc-send svg { width: 18px; height: 18px; }
.sc-input-row textarea.sc-input { resize: none; min-height: 40px; max-height: 100px; }

.sc-foot { padding: 6px 14px 8px; background: #fff; border-top: 1px solid #f0f2f6; }
.sc-foot p { margin: 0; font-size: 11px; color: #8a8a8a; text-align: center; }
.sc-foot a { color: #f97316; text-decoration: none; }

/* ---- Small screens ---- */
@media (max-width: 640px) {
  .sc-launcher { right: 16px; bottom: 132px; width: 56px; height: 56px; }
  .sc-teaser { right: 84px; bottom: 148px; }
  .sc-panel {
    right: 0; bottom: 0; width: 100%; height: 100%; max-height: 100%;
    border-radius: 0; border: 0;
  }
}
