/* ==========================================================================
   CONCIERGE VIRTUALE ESPERTO - STUDIO VETRARTE DI PAOLO CORPETTI
   Stile Luxury & Editorial allineato al Design System Elicyon di vetrateartistiche.com
   ========================================================================== */

/* Floating Launcher Button */
#cve-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9990;
  width: 196px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: rgba(250, 248, 245, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(182, 142, 72, 0.45);
  box-shadow: 0 6px 18px rgba(44, 38, 33, 0.12);
  padding: 0 14px;
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--dark, #2C2621);
  font-family: var(--sans, 'Plus Jakarta Sans', sans-serif);
  box-sizing: border-box;
}

#cve-launcher:hover {
  transform: translateY(-2px);
  border-color: var(--gold, #B68E48);
  box-shadow: 0 10px 24px rgba(44, 38, 33, 0.16), 0 0 12px rgba(182, 142, 72, 0.25);
}

#cve-launcher .cve-seal {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #B68E48, #8F6E30);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  box-shadow: 0 2px 5px rgba(143, 110, 48, 0.28);
  position: relative;
}

#cve-launcher .cve-seal::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  background: #10b981;
  border: 2px solid #FAF8F5;
  border-radius: 50%;
}

#cve-launcher .cve-btn-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

#cve-launcher .cve-btn-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--dark, #2C2621);
  letter-spacing: 0.2px;
  line-height: 1.15;
  white-space: nowrap;
}

#cve-launcher .cve-btn-sub {
  font-size: 9px;
  color: var(--gold-dark, #8F6E30);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
}

/* Chat Drawer / Window */
#cve-drawer {
  position: fixed;
  bottom: 92px;
  right: 28px;
  width: 420px;
  height: 600px;
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 120px);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(182, 142, 72, 0.3);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(44, 38, 33, 0.16), 0 0 0 1px rgba(255, 255, 255, 0.6);
  z-index: 9995;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--sans, 'Plus Jakarta Sans', sans-serif);
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

#cve-drawer.cve-active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.cve-header {
  background: linear-gradient(135deg, #FAF8F5, #F5EFE6);
  border-bottom: 1px solid rgba(182, 142, 72, 0.25);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cve-header-identity {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cve-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2C2621;
  border: 1.5px solid var(--gold, #B68E48);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold, #B68E48);
}

.cve-header-titles h3 {
  font-family: var(--serif, 'Playfair Display', serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--dark, #2C2621);
  margin: 0;
  line-height: 1.25;
}

.cve-header-titles p {
  margin: 3px 0 0;
  font-size: 11px;
  color: var(--mid, #685E55);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cve-pulse {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.cve-close-btn {
  background: transparent;
  border: none;
  color: var(--mid, #685E55);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.cve-close-btn:hover {
  background: rgba(182, 142, 72, 0.12);
  color: var(--dark, #2C2621);
}

/* Conversation Body */
.cve-body {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #FAF8F5;
  font-size: 13.5px;
  line-height: 1.55;
  color: #38312a;
}

/* Scrollbar */
.cve-body::-webkit-scrollbar {
  width: 5px;
}
.cve-body::-webkit-scrollbar-thumb {
  background: rgba(182, 142, 72, 0.25);
  border-radius: 10px;
}

/* Messages */
.cve-msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 16px;
  word-wrap: break-word;
  animation: cveFadeIn 0.3s ease-out;
}

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

.cve-bot-msg {
  align-self: flex-start;
  background: #ffffff;
  color: var(--dark, #2C2621);
  border: 1px solid rgba(182, 142, 72, 0.2);
  border-bottom-left-radius: 4px;
  box-shadow: 0 3px 12px rgba(44, 38, 33, 0.04);
}

.cve-user-msg {
  align-self: flex-end;
  background: var(--dark, #2C2621);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.cve-bot-msg strong {
  color: #1a1613;
  font-weight: 600;
}

.cve-bot-msg ul {
  margin: 8px 0 8px 18px;
  padding: 0;
}

.cve-bot-msg li {
  margin-bottom: 4px;
}

/* Spotlight Page Card (Indirizzamento alle pagine del sito) */
.cve-page-card {
  margin-top: 10px;
  background: #ffffff;
  border: 1px solid rgba(182, 142, 72, 0.35);
  border-left: 4px solid var(--gold, #B68E48);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(44, 38, 33, 0.05);
  transition: all 0.25s ease;
}

.cve-page-card:hover {
  border-color: var(--gold, #B68E48);
  box-shadow: 0 6px 18px rgba(182, 142, 72, 0.15);
}

.cve-card-badge {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  color: var(--gold-dark, #8F6E30);
  background: #FDF9F2;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 5px;
}

.cve-page-card h4 {
  font-family: var(--serif, 'Playfair Display', serif);
  font-size: 14px;
  color: var(--dark, #2C2621);
  margin: 0 0 4px 0;
}

.cve-page-card p {
  font-size: 12px;
  color: var(--mid, #685E55);
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.cve-page-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold, #B68E48);
  color: #ffffff !important;
  text-decoration: none !important;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s ease, transform 0.15s ease;
}

.cve-page-link:hover {
  background: var(--gold-dark, #8F6E30);
  transform: translateX(2px);
}

/* Quick Topic Pills */
.cve-topics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.cve-pill {
  background: #ffffff;
  border: 1px solid rgba(182, 142, 72, 0.28);
  color: var(--dark, #2C2621);
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.cve-pill:hover {
  background: #FAF3E6;
  border-color: var(--gold, #B68E48);
  color: var(--gold-dark, #8F6E30);
  transform: translateY(-1px);
}

/* Typing Indicator */
.cve-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(182, 142, 72, 0.2);
  width: fit-content;
  align-self: flex-start;
}

.cve-typing span {
  width: 5px;
  height: 5px;
  background: var(--gold, #B68E48);
  border-radius: 50%;
  animation: cveBlink 1.4s infinite ease-in-out both;
}

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

@keyframes cveBlink {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* Input Area */
.cve-input-bar {
  padding: 14px 16px;
  background: #ffffff;
  border-top: 1px solid rgba(182, 142, 72, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cve-input-bar input {
  flex: 1;
  border: 1px solid rgba(182, 142, 72, 0.3);
  padding: 10px 16px;
  border-radius: 30px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  background: #FAF8F5;
  color: var(--dark, #2C2621);
  transition: border-color 0.2s, background 0.2s;
}

.cve-input-bar input:focus {
  border-color: var(--gold, #B68E48);
  background: #ffffff;
}

.cve-send-btn {
  background: var(--dark, #2C2621);
  color: #FAF8F5;
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.cve-send-btn:hover {
  background: var(--gold, #B68E48);
  color: #fff;
  transform: scale(1.05);
}

.cve-send-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Mobile full-screen */
@media (max-width: 480px) {
  #cve-drawer {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  #cve-launcher {
    bottom: 16px;
    right: 14px;
    width: 172px;
    height: 38px;
    padding: 0 10px;
  }
  #cve-launcher .cve-btn-sub {
    display: none;
  }
}
