/**
 * DESIGN SYSTEM TRỢ LÝ ẢO B2B CẢNG LONG THÀNH (LTP ENTERPRISE AI ASSISTANT V5.0)
 * Tuân thủ Bộ Quy Chuẩn GCT Hybrid AI 3 Lớp & B2B Port Standards
 * File: longthanh-port-chatbot.css
 * 
 * Bảng màu nhận diện Hàng hải & Sonadezi:
 * - Harbor Navy: #07162c, #0b2545
 * - Sonadezi Orange: #ea580c, #c2410c
 * - Ocean Cyan Glow: #38bdf8, #0284c7
 * - Pure White & Slate: #ffffff, #f8fafc, #64748b
 */

:root {
  --ltp-navy-dark: #07162c;
  --ltp-navy-mid: #0b2545;
  --ltp-navy-light: #133e68;
  --ltp-orange: #ea580c;
  --ltp-orange-dark: #c2410c;
  --ltp-cyan: #38bdf8;
  --ltp-cyan-dark: #0284c7;
  --ltp-bg-body: #f8fafc;
  --ltp-text-main: #0f172a;
  --ltp-text-muted: #64748b;
  --ltp-white: #ffffff;
  --ltp-shadow-lg: 0 20px 40px -15px rgba(7, 22, 44, 0.35), 0 0 25px rgba(234, 88, 12, 0.15);
  --ltp-shadow-sm: 0 4px 12px rgba(7, 22, 44, 0.1);
  --ltp-radius-panel: 24px;
  --ltp-radius-bubble: 18px;
}

#ltp-chatbot-root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ltp-text-main);
  position: relative;
  z-index: 2147483640;
}

/* ====================================================
   1. LAUNCHER TOGGLE BUTTON, PORTAL WINDOW & TEASER CALLOUT
   ==================================================== */
#ltp-chatbot-toggle {
  position: fixed !important;
  bottom: 28px !important;
  right: 28px !important;
  width: 110px !important;
  height: 130px !important;
  border-radius: 55px 55px 16px 16px !important;
  background: linear-gradient(180deg, #38bdf8 0%, #e0f2fe 100%) !important;
  border: 7px solid #f8fafc !important;
  border-bottom: 18px solid #07162c !important;
  box-shadow: 
    inset 0 12px 24px rgba(0, 0, 0, 0.15),
    inset 0 0 18px rgba(255, 255, 255, 0.9),
    0 0 0 3.5px #ea580c,
    0 15px 35px rgba(7, 22, 44, 0.3) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  padding: 0 !important;
  outline: none !important;
  z-index: 2147483645 !important;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease !important;
}

#ltp-chatbot-toggle:hover {
  transform: translateY(-5px) scale(1.04) !important;
  box-shadow: 
    inset 0 10px 20px rgba(0, 0, 0, 0.1),
    0 0 0 4.5px #f97316,
    0 20px 45px rgba(7, 22, 44, 0.4) !important;
}

#ltp-chatbot-toggle.ltp-toggle-opened {
  transform: scale(0) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Kính cửa sổ lướt sáng (Sun Glare) */
#ltp-chatbot-toggle::before {
  content: "";
  position: absolute;
  top: -40px;
  left: -70px;
  width: 35px;
  height: 230px;
  background: rgba(255, 255, 255, 0.6);
  transform: rotate(35deg);
  pointer-events: none;
  z-index: 5;
  transition: left 0.7s ease;
}

#ltp-chatbot-toggle:hover::before {
  left: 140px;
}

/* Đám mây nhỏ trôi ngoài cửa sổ */
#ltp-chatbot-toggle::after {
  content: "";
  position: absolute;
  top: 25px;
  left: 16px;
  width: 28px;
  height: 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 10px -6px 0 2px rgba(255, 255, 255, 0.9), 18px 2px 0 0 rgba(255, 255, 255, 0.9);
  pointer-events: none;
  z-index: 1;
}

.ltp-portal-sill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: #ea580c;
  pointer-events: none;
  z-index: 4;
}

.ltp-mascot-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  overflow: visible;
}

.ltp-mascot-canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

.ltp-toggle-badge {
  position: absolute;
  top: -8px;
  right: -6px;
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 3px 8px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(234, 88, 12, 0.5);
  border: 1.5px solid #ffffff;
  white-space: nowrap;
  animation: ltpPulseBadge 2.5s infinite;
  z-index: 10;
}

@keyframes ltpPulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* Floating Algorithmic Mascot DOM Container */
#ltp-roaming-pet {
  user-select: none;
  filter: drop-shadow(0 12px 24px rgba(7, 22, 44, 0.35));
  will-change: transform;
}

/* Teaser Speech Bubble Callout */
.ltp-teaser {
  position: fixed !important;
  right: 155px !important;
  bottom: 38px !important;
  width: 275px !important;
  background: #ffffff !important;
  padding: 12px 14px !important;
  border-radius: 16px !important;
  box-shadow: 0 14px 40px rgba(7, 22, 44, 0.2), 0 2px 10px rgba(0, 0, 0, 0.05) !important;
  border: 1px solid rgba(7, 22, 44, 0.12) !important;
  border-top: 3.5px solid #ea580c !important;
  cursor: pointer !important;
  transform-origin: bottom right !important;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  z-index: 2147483646 !important;
  user-select: none !important;
}
.ltp-teaser::after {
  content: "";
  position: absolute;
  right: -9px;
  bottom: 24px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 9px solid #ffffff;
}
.ltp-teaser::before {
  content: "";
  position: absolute;
  right: -10px;
  bottom: 24px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 9px solid rgba(7, 22, 44, 0.15);
}
.ltp-teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 13px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.ltp-teaser-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.ltp-teaser-sender {
  font-size: 12px;
  font-weight: 700;
  color: #07162c;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 18px;
}
.ltp-teaser-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: ltpDotPulse 2s infinite;
}
@keyframes ltpDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.8; }
}
.ltp-teaser-text {
  font-size: 13px;
  line-height: 1.45;
  color: #1e293b;
  font-weight: 500;
}
.ltp-teaser-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateX(12px) scale(0.9) !important;
  visibility: hidden;
}

/* ====================================================
   2. CHAT PANEL (MODAL DIALOG)
   ==================================================== */
#ltp-chatbot-panel {
  position: fixed;
  bottom: 105px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 130px);
  background: #ffffff;
  border-radius: var(--ltp-radius-panel);
  box-shadow: var(--ltp-shadow-lg);
  border: 1px solid rgba(7, 22, 44, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483646;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}

#ltp-chatbot-panel.ltp-panel-hidden {
  opacity: 0;
  transform: scale(0.85) translateY(30px);
  pointer-events: none;
  visibility: hidden;
}

#ltp-chatbot-panel.ltp-panel-visible {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
  visibility: visible;
}

/* Header */
.ltp-header {
  background: linear-gradient(135deg, #07162c 0%, #0b2545 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #ea580c;
  color: #ffffff;
}

.ltp-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ltp-header-mascot {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25);
}

.ltp-header-info {
  display: flex;
  flex-direction: column;
}

.ltp-header-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ltp-online-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #10b981;
}

.ltp-header-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 1px;
}

.ltp-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ltp-head-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: all 0.2s;
  padding: 0;
}

.ltp-head-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Quick Actions Strip */
.ltp-quick-actions {
  background: #f1f5f9;
  padding: 8px 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid #e2e8f0;
  scrollbar-width: none;
}

.ltp-quick-actions::-webkit-scrollbar {
  display: none;
}

.ltp-quick-btn {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #0b2545;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.ltp-quick-btn:hover {
  background: #07162c;
  color: #ffffff;
  border-color: #07162c;
}

/* ====================================================
   3. MESSAGES BODY & BUBBLES
   ==================================================== */
.ltp-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.ltp-msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 88%;
  animation: ltpFadeUp 0.3s ease-out;
}

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

.ltp-msg-user {
  align-self: flex-end;
  justify-content: flex-end;
}

.ltp-msg-user .ltp-msg-bubble {
  background: linear-gradient(135deg, #07162c 0%, #0b2545 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(7, 22, 44, 0.15);
}

.ltp-msg-bot {
  align-self: flex-start;
}

.ltp-bot-avatar-tiny {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #07162c;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(7, 22, 44, 0.2);
}

.ltp-msg-bot .ltp-msg-bubble {
  background: #ffffff;
  color: #0f172a;
  border-bottom-left-radius: 4px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.ltp-msg-bubble {
  padding: 11px 14px;
  border-radius: var(--ltp-radius-bubble);
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

/* Typing Indicator */
.ltp-typing-bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}

.ltp-typing-bubble span {
  width: 6px;
  height: 6px;
  background: #ea580c;
  border-radius: 50%;
  animation: ltpBounceDot 1.4s infinite ease-in-out both;
}

.ltp-typing-bubble span:nth-child(1) { animation-delay: -0.32s; }
.ltp-typing-bubble span:nth-child(2) { animation-delay: -0.16s; }

@keyframes ltpBounceDot {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Interactive Option Chips */
.ltp-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.ltp-chip-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #0b2545;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ltp-chip-btn:hover {
  background: #ea580c;
  color: #ffffff;
  border-color: #ea580c;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(234, 88, 12, 0.3);
}

/* Service Card inside Chat */
.ltp-service-card {
  background: #f8fafc;
  border: 1.5px solid #0284c7;
  border-radius: 16px;
  padding: 12px;
  margin-top: 8px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08);
}

.ltp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ltp-card-badge {
  background: #0284c7;
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 8px;
}

.ltp-card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #07162c;
  margin: 0;
}

.ltp-card-desc {
  font-size: 12px;
  color: #475569;
  margin: 4px 0 8px 0;
  line-height: 1.4;
}

.ltp-card-specs {
  font-size: 11.5px;
  color: #1e293b;
  background: #ffffff;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ltp-card-price {
  font-size: 11.5px;
  color: #ea580c;
  font-weight: 600;
  margin-top: 6px;
}

/* Star Rating */
.ltp-stars-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.ltp-star-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  transition: all 0.2s;
}

.ltp-star-btn:hover {
  background: #facc15;
  border-color: #eab308;
  color: #713f12;
}

/* ====================================================
   4. INPUT FORM & FOOTER
   ==================================================== */
.ltp-input-container {
  padding: 12px 14px 8px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}

#ltp-chat-form {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 20px;
  padding: 4px 6px 4px 14px;
  transition: all 0.2s;
}

#ltp-chat-form:focus-within {
  border-color: #ea580c;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}

#ltp-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13.5px;
  color: #0f172a;
  outline: none;
  padding: 6px 0;
}

#ltp-chat-input::placeholder {
  color: #94a3b8;
  font-size: 12.5px;
}

#ltp-send-btn {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%);
  border: none;
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  padding: 0;
}

#ltp-send-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35);
}

.ltp-input-footer {
  text-align: center;
  margin-top: 6px;
  font-size: 10px;
  color: #94a3b8;
  font-weight: 500;
}

/* ====================================================
   5. MOBILE RESPONSIVENESS
   ==================================================== */
@media (max-width: 600px) {
  #ltp-chatbot-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  #ltp-chatbot-toggle {
    bottom: 16px;
    right: 16px;
    width: 64px;
    height: 64px;
  }
}
