/* ==========================================================================
   SMART SEARCH / TRA CỨU NHANH - CORNER CHAT BOT WIDGET
   DEVYT Odoo Enterprise Design System
   Rule-based, lightweight, responsive, accessible, zero-cost AI assistant UX
   ========================================================================== */

/* Navbar Quick Search Trigger Button */
.odoo-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f8fafc;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  margin-right: 8px;
}
.odoo-search-trigger:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}
.odoo-search-trigger .shortcut-badge {
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.72rem;
  color: #cbd5e1;
  font-family: monospace;
}

/* ==========================================================================
   FLOATING ACTION BUTTON (BOTTOM-RIGHT CORNER)
   ========================================================================== */
.ss-bot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px -3px rgba(2, 132, 199, 0.45), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.35);
  z-index: 99998;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
  user-select: none;
}
.ss-bot-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 30px -2px rgba(2, 132, 199, 0.55), 0 6px 10px -2px rgba(0, 0, 0, 0.1);
}
.ss-bot-fab:active {
  transform: scale(0.95);
}
.ss-bot-fab .ss-fab-icon {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ss-bot-fab .ss-fab-status-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #10b981;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
}
.ss-bot-fab-tooltip {
  position: absolute;
  right: 68px;
  background: #0f172a;
  color: #f8fafc;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}
.ss-bot-fab:hover .ss-bot-fab-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* ==========================================================================
   CORNER CHAT BOT WINDOW WIDGET
   ========================================================================== */
.ss-chat-widget {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 420px;
  max-width: calc(100vw - 32px);
  height: 620px;
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 48px -8px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  z-index: 99999;
  overflow: hidden;
  font-family: inherit;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.22s;
}
.ss-chat-widget.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.ss-chat-header {
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.ss-chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ss-chat-bot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 3px 8px rgba(2, 132, 199, 0.3);
}
.ss-chat-bot-avatar svg {
  width: 22px;
  height: 22px;
}
.ss-chat-status-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
}
.ss-chat-title-wrap {
  display: flex;
  flex-direction: column;
}
.ss-chat-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}
.ss-chat-subtitle {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 2px;
}
.ss-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ss-chat-header-btn {
  background: transparent;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ss-chat-header-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Chat Body (Message Stream) */
.ss-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
  scroll-behavior: smooth;
}
.ss-chat-body::-webkit-scrollbar {
  width: 6px;
}
.ss-chat-body::-webkit-scrollbar-track {
  background: transparent;
}
.ss-chat-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
.ss-chat-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Chat Rows & Bubbles */
.ss-msg-row {
  display: flex;
  gap: 8px;
  max-width: 94%;
}
.ss-msg-user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.ss-msg-bot {
  align-self: flex-start;
}
.ss-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.ss-msg-avatar svg {
  width: 16px;
  height: 16px;
}
.ss-msg-bubble {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.ss-msg-user .ss-msg-bubble {
  background: #0284c7;
  color: #ffffff;
  border-bottom-right-radius: 3px;
}
.ss-msg-bot .ss-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 3px;
  width: 100%;
}
.ss-msg-bot .ss-msg-bubble b,
.ss-msg-bot .ss-msg-bubble strong {
  font-weight: 600;
  color: #0f172a;
}
.ss-msg-headline {
  margin-bottom: 6px;
  line-height: 1.4;
}
.ss-msg-breakdown {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 8px;
}

/* Recognized Condition Badges in Bot Bubble */
.ss-bot-conditions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.ss-bot-cond-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: #0284c7;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Category Filter Tabs inside Bot Bubble */
.ss-chat-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 8px 0;
  margin-bottom: 6px;
  border-bottom: 1px dashed #e2e8f0;
}
.ss-chat-tabs::-webkit-scrollbar {
  display: none;
}
.ss-chat-tab-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 0.73rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.ss-chat-tab-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.ss-chat-tab-pill.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

/* Compact Link Cards List (The core feature requested by user) */
.ss-compact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.ss-compact-card {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  cursor: pointer;
  position: relative;
}
.ss-compact-card:hover {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.12);
  transform: translateY(-1px);
}
.ss-compact-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.ss-compact-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: #ede9fe;
  color: #6d28d9;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ss-compact-status {
  font-size: 0.7rem;
  color: #166534;
  background: #dcfce7;
  padding: 1px 7px;
  border-radius: 4px;
  font-weight: 500;
}
.ss-compact-title {
  font-size: 0.86rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
}
.ss-compact-card:hover .ss-compact-title {
  color: #0284c7;
}
.ss-compact-subtitle {
  font-size: 0.76rem;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.3;
}
.ss-compact-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #e2e8f0;
}
.ss-compact-price {
  font-size: 0.84rem;
  font-weight: 700;
  color: #0284c7;
}
.ss-compact-open-btn {
  font-size: 0.76rem;
  font-weight: 600;
  color: #0284c7;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.ss-compact-card:hover .ss-compact-open-btn {
  color: #0369a1;
  text-decoration: underline;
}

/* Follow-up Suggestion Chips */
.ss-suggest-label {
  font-size: 0.74rem;
  color: #64748b;
  margin-top: 10px;
  margin-bottom: 4px;
}
.ss-suggested-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.ss-suggest-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #0369a1;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.77rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.ss-suggest-chip:hover {
  background: #f0f9ff;
  border-color: #38bdf8;
  color: #0284c7;
}
.ss-suggest-chip:active {
  transform: scale(0.97);
}

/* Ambiguous Question Box inside chat */
.ss-chat-ambiguous {
  background: #fffbeb;
  border: 1px solid #fef3c7;
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 8px;
}
.ss-chat-ambiguous-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 6px;
}
.ss-chat-ambiguous-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ss-choice-pill {
  background: #ffffff;
  border: 1px solid #fcd34d;
  color: #b45309;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ss-choice-pill:hover {
  background: #fef3c7;
}

/* Typing Indicator (bouncing dots) */
.ss-typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  border-bottom-left-radius: 3px;
  width: fit-content;
}
.ss-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: ssTypingBounce 1.4s infinite ease-in-out both;
}
.ss-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ss-typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes ssTypingBounce {
  0%, 80%, 100% { transform: scale(0.4); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Input Footer */
.ss-chat-footer {
  padding: 10px 14px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}
.ss-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ss-chat-input-row:focus-within {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
  background: #ffffff;
}
.ss-chat-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.88rem;
  color: #0f172a;
  padding: 6px 0;
}
.ss-chat-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0284c7;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.ss-chat-send-btn:hover {
  background: #0369a1;
}
.ss-chat-send-btn:active {
  transform: scale(0.92);
}
.ss-chat-send-btn svg {
  width: 15px;
  height: 15px;
}
.ss-chat-hint {
  font-size: 0.68rem;
  color: #94a3b8;
  text-align: center;
  margin-top: 5px;
  user-select: none;
}

/* Empty State / Welcome Starter */
.ss-welcome-box {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
  margin-top: 6px;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .ss-chat-widget {
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .ss-bot-fab {
    bottom: 16px;
    right: 16px;
  }
}


/* Search interaction and keyboard states */
.ss-bot-fab[hidden], .odoo-search-trigger[hidden] { display: none !important; }
.ss-compact-card:focus-visible, .ss-chat-tab-pill:focus-visible, .ss-more-btn:focus-visible,
.ss-suggest-chip:focus-visible, .ss-chat-header-btn:focus-visible, .ss-bot-fab:focus-visible {
  outline: 3px solid #0284c7;
  outline-offset: 2px;
}
.ss-msg-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.ss-suggestion-area, .ss-typo-area { margin-top: 8px; }
.ss-typo-area { font-size: .8rem; color: #475569; }
.ss-expand-time { background: #eff6ff; border-color: #bfdbfe; font-weight: 600; }
.ss-more-btn {
  margin-top: 10px; padding: 7px 10px; border: 1px solid #cbd5e1;
  border-radius: 8px; background: #fff; color: #0369a1; cursor: pointer;
  font-size: .8rem; font-weight: 600;
}
.ss-more-btn:hover { background: #eff6ff; border-color: #0284c7; }
.ss-more-hint { margin-top: 8px; color: #64748b; font-size: .76rem; }
.smart-search-location-detail { display: grid; gap: 10px; margin: 0; }
.smart-search-location-detail div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; }
.smart-search-location-detail dt { color: #64748b; }
.smart-search-location-detail dd { margin: 0; overflow-wrap: anywhere; }


/* Global button padding must not squeeze small search controls. */
.ss-chat-header-btn, .ss-chat-send-btn { padding: 0; flex-shrink: 0; }
.ss-chat-header-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.ss-chat-send-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.ss-chat-input { min-width: 0; }
.ss-chat-header-actions { flex-shrink: 0; }

/* Road option detail modal: styles allowed by the existing CSP. */
[data-costing-style="6ce4581124"] { margin-top:10px; width:100%; }
[data-costing-style="36e81f8612"] { margin-top:4px; }
[data-costing-style="4c81dce9fe"] { background:#f8fafc; border:1px solid #e2e8f0; border-radius:6px; padding:10px 14px; margin-top:12px; }
[data-costing-style="75c2299ec6"] { font-weight:600; color:#334155; }
[data-costing-style="903efef07c"] { background:#f0fdf4; border:1px solid #bbf7d0; border-radius:6px; padding:8px 12px; margin-top:12px; color:#166534; font-size:0.85rem; }
[data-costing-style="dd1404a45b"] { display:flex; justify-content:space-between; align-items:center; border-bottom:1px solid #e2e8f0; padding-bottom:10px; margin-bottom:12px; }
[data-costing-style="451d13ae38"] { margin-left:6px; }
[data-costing-style="fc46a9548e"] { font-size:0.85rem; }
[data-costing-style="04f022f9ae"] { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:12px; }
[data-costing-style="969c37bf53"] { background:#f8fafc; padding:10px 12px; border-radius:6px; border:1px solid #f1f5f9; }
[data-costing-style="baede227e9"] { font-size:0.8rem; text-transform:uppercase; }
[data-costing-style="f3c4aa45e9"] { color:#0369a1; }
[data-costing-style="d1dc646165"] { margin-top:2px; }
[data-costing-style="998aa3df46"] { color:#64748b; }
[data-costing-style="3b739adcaf"] { margin-top:4px; font-weight:600; }
[data-costing-style="942941faa2"] { display:grid; gap:12px; grid-template-columns: repeat(4, 1fr); margin-bottom:12px; }
[data-costing-style="6783001e68"] { font-size:1.15rem; }
[data-costing-style="5b6a1b5273"] { font-size:0.8rem; }
[data-costing-style="726e8b317f"] { margin-top:10px; }
[data-costing-style="1bcd452056"] { cursor:pointer; font-weight:600; color:#1e293b; }

.costing-modal-detail { overflow-wrap:anywhere; }
@media (max-width:640px) {
 [data-costing-style="04f022f9ae"] { grid-template-columns:1fr; }
 [data-costing-style="942941faa2"] { grid-template-columns:repeat(2,minmax(0,1fr)); }
 [data-costing-style="dd1404a45b"] { flex-wrap:wrap; gap:8px; }
 .smart-search-location-detail div { grid-template-columns:100px minmax(0,1fr); gap:8px; }
}
