/* ==========================================================================
   Chorvoq AI — Professional Joytop.uz Design System (No Emojis, Pure SVG)
   Matches Joytop brand: Coral Orange (#ff7e47), Clean White, Crisp Typography
   ========================================================================== */

:root {
  --cai-primary: #ff7e47;
  --cai-primary-hover: #ff6426;
  --cai-primary-gradient: linear-gradient(135deg, #ff7e47 0%, #ea580c 100%);
  --cai-primary-subtle: #fff7ed;
  --cai-primary-border: #fed7aa;
  --cai-bg-white: #ffffff;
  --cai-bg-page: #f8fafc;
  --cai-text-heading: #0f172a;
  --cai-text-body: #334155;
  --cai-text-muted: #64748b;
  --cai-border: #e2e8f0;
  --cai-shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.05);
  --cai-shadow-elevated: 0 20px 45px -10px rgba(255, 126, 71, 0.28), 0 10px 25px rgba(0, 0, 0, 0.08);
  --cai-radius-lg: 20px;
  --cai-radius-md: 12px;
  --cai-radius-pill: 9999px;
}

/* ─── 1. FLOATING LAUNCHER BUTTON ── */
#cai-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999990;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 12px;
  background: var(--cai-primary-gradient);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: var(--cai-radius-pill);
  box-shadow: 0 10px 25px -5px rgba(255, 126, 71, 0.55), 0 0 15px rgba(234, 88, 12, 0.3);
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

#cai-launcher:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 15px 32px -5px rgba(255, 126, 71, 0.65), 0 0 20px rgba(234, 88, 12, 0.4);
}

#cai-launcher:active {
  transform: translateY(0) scale(0.98);
}

/* Hide launcher when modal is open */
body.cai-open-state #cai-launcher {
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px) scale(0.9);
}

.cai-launcher-icon {
  width: 34px;
  height: 34px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.cai-launcher-label {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.cai-launcher-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cai-launcher-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.cai-online-dot {
  width: 7px;
  height: 7px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 6px #22c55e;
  display: inline-block;
  animation: cai-pulse 2s infinite;
}

@keyframes cai-pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.cai-launcher-sub {
  font-size: 11px;
  opacity: 0.92;
  font-weight: 500;
}

/* ─── 2. CHAT MODAL WINDOW (LIGHT THEME MATCHING JOYTOP) ──────────────── */
#cai-window {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 410px;
  max-width: calc(100vw - 32px);
  height: 640px;
  max-height: calc(100vh - 64px);
  background: #ffffff;
  border: 1px solid var(--cai-border);
  border-radius: var(--cai-radius-lg);
  box-shadow: var(--cai-shadow-elevated);
  display: flex;
  flex-direction: column;
  z-index: 999999;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#cai-window.cai-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.cai-header {
  padding: 16px 18px;
  background: var(--cai-primary-gradient);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 15px rgba(234, 88, 12, 0.2);
}

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

.cai-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.cai-meta h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.2px;
}

.cai-meta h3 span {
  font-size: 10px;
  background: rgba(255, 255, 255, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.cai-meta p {
  margin: 2px 0 0 0;
  font-size: 11.5px;
  opacity: 0.9;
  font-weight: 500;
}

.cai-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cai-lang-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.cai-lang-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.cai-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  transition: background 0.2s;
}

.cai-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Body */
.cai-body {
  flex: 1;
  padding: 18px 16px;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cai-body::-webkit-scrollbar {
  width: 5px;
}

.cai-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.cai-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
  animation: cai-fadeIn 0.25s ease-out;
}

@keyframes cai-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.cai-msg-user {
  align-self: flex-end;
}

.cai-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.cai-msg-bot .cai-bubble {
  background: #ffffff;
  color: var(--cai-text-heading);
  border: 1px solid var(--cai-border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cai-msg-user .cai-bubble {
  background: var(--cai-primary-gradient);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(255, 126, 71, 0.25);
}

/* Chips in Chat */
.cai-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.cai-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: var(--cai-text-body);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--cai-radius-pill);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.cai-chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: color 0.2s;
}

.cai-chip:hover {
  background: var(--cai-primary-subtle);
  border-color: var(--cai-primary-border);
  color: #ea580c;
  transform: translateY(-1px);
}

.cai-chip:hover .cai-chip-icon {
  color: #ea580c;
}

/* Property Cards */
.cai-cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  width: 100%;
}

.cai-card {
  background: #ffffff;
  border: 1px solid var(--cai-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: all 0.25s;
}

.cai-card:hover {
  border-color: #fdba74;
  box-shadow: 0 8px 20px rgba(255, 126, 71, 0.15);
  transform: translateY(-2px);
}

.cai-card-img-wrap {
  position: relative;
  width: 100%;
  height: 150px;
  background: #e2e8f0;
  overflow: hidden;
}

.cai-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.cai-card:hover .cai-card-img {
  transform: scale(1.04);
}

.cai-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.cai-card-content {
  padding: 12px 14px;
}

.cai-card-title {
  margin: 0 0 6px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--cai-text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cai-card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--cai-text-muted);
  margin-bottom: 8px;
}

.cai-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cai-card-price {
  font-size: 14px;
  font-weight: 800;
  color: #ea580c;
  margin-bottom: 10px;
}

.cai-card-price span {
  font-size: 11px;
  color: var(--cai-text-muted);
  font-weight: 500;
}

.cai-card-btn {
  display: block;
  text-align: center;
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
}

.cai-card-btn:hover {
  background: var(--cai-primary-gradient);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(255, 126, 71, 0.35);
}

/* Typing Indicator */
.cai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--cai-border);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.cai-dot {
  width: 6px;
  height: 6px;
  background: #ff7e47;
  border-radius: 50%;
  animation: cai-bounce 1.4s infinite ease-in-out;
}

.cai-dot:nth-child(1) { animation-delay: -0.32s; }
.cai-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes cai-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Footer */
.cai-footer {
  padding: 12px 14px;
  background: #ffffff;
  border-top: 1px solid var(--cai-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cai-input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  transition: all 0.2s;
  color: var(--cai-text-heading);
}

.cai-input:focus {
  border-color: #ff7e47;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 126, 71, 0.15);
}

.cai-send-btn {
  width: 40px;
  height: 40px;
  background: var(--cai-primary-gradient);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(255, 126, 71, 0.35);
}

.cai-send-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

/* ─── 3. HERO SMART SEARCH BAR (TEMPORARILY HIDDEN) ─────────────────────── */
.cai-hero-bar {
  display: none !important;
  max-width: 1200px;
  margin: 16px auto 24px auto;
  padding: 16px 20px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.07), 0 0 1px rgba(0, 0, 0, 0.05);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  transition: all 0.3s ease;
}

.cai-hero-bar:hover {
  box-shadow: 0 14px 35px -8px rgba(255, 126, 71, 0.15), 0 0 1px rgba(0, 0, 0, 0.05);
  border-color: #fed7aa;
}

.cai-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.cai-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #ea580c;
  padding: 5px 14px;
  border-radius: var(--cai-radius-pill);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.cai-hero-badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ff7e47;
}

.cai-hero-hint {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.cai-hero-input-wrap {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 4px 6px 4px 14px;
  transition: all 0.25s;
}

.cai-hero-input-wrap:focus-within {
  border-color: #ff7e47;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(255, 126, 71, 0.2);
}

.cai-hero-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #0f172a;
  font-size: 14.5px;
  padding: 10px 0;
  font-family: inherit;
}

.cai-hero-input::placeholder {
  color: #94a3b8;
  font-size: 13.5px;
}

.cai-hero-submit {
  background: var(--cai-primary-gradient);
  border: none;
  border-radius: 10px;
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(255, 126, 71, 0.35);
}

.cai-hero-submit:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 126, 71, 0.45);
}

.cai-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.cai-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--cai-radius-pill);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cai-hero-chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: color 0.2s, transform 0.2s;
}

.cai-hero-chip:hover {
  background: #fff7ed;
  border-color: #ff7e47;
  color: #ea580c;
  transform: translateY(-1px);
}

.cai-hero-chip:hover .cai-hero-chip-icon {
  color: #ea580c;
  transform: scale(1.1);
}

/* Mobile Responsiveness */
@media (max-width: 1023px) {
  #cai-launcher {
    bottom: 20px;
    right: 16px;
    padding: 8px 14px 8px 10px;
  }
  .cai-launcher-title { font-size: 13px; }
  .cai-launcher-sub { display: none; }

  #cai-window {
    bottom: 16px;
    right: 12px;
    left: 12px;
    width: auto;
    height: calc(100vh - 32px);
    max-height: none;
    border-radius: 16px;
  }

  .cai-hero-bar {
    margin: 10px 12px 18px 12px;
    padding: 14px;
  }
  .cai-hero-hint { display: none; }
}
