/* ── Chat Widget ── */
.cw-bubble{position:fixed;bottom:24px;right:24px;width:64px;height:64px;border-radius:50%;background:linear-gradient(135deg,#e87722,#f5a623);color:#fff;display:flex;align-items:center;justify-content:center;font-size:28px;cursor:pointer;box-shadow:0 6px 24px rgba(232,119,34,.45);z-index:9999;transition:transform .3s,box-shadow .3s;border:none}
.cw-bubble:hover{transform:scale(1.1);box-shadow:0 8px 32px rgba(232,119,34,.6)}
.cw-bubble .cw-badge{position:absolute;top:-2px;right:-2px;width:18px;height:18px;background:#e53e3e;border-radius:50%;border:2px solid #fff;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700}
.cw-bubble.open .cw-badge{display:none}

/* Window */
.cw-window{position:fixed;bottom:100px;right:24px;width:380px;height:calc(100vh - 130px);max-height:700px;background:#fff;border-radius:20px;box-shadow:0 12px 48px rgba(0,0,0,.18);z-index:9998;display:flex;flex-direction:column;overflow:hidden;opacity:0;transform:translateY(20px) scale(.95);pointer-events:none;transition:opacity .3s,transform .3s}
.cw-window.visible{opacity:1;transform:translateY(0) scale(1);pointer-events:auto}

/* Header */
.cw-header{background:linear-gradient(135deg,#1a2b5f,#2c3e8b);color:#fff;padding:16px 18px 12px;display:flex;align-items:center;gap:12px;position:relative}
.cw-header-avatar{width:40px;height:40px;border-radius:50%;background:linear-gradient(135deg,#e87722,#f5a623);display:flex;align-items:center;justify-content:center;font-size:20px;flex-shrink:0}
.cw-header-info{flex:1}
.cw-header-title{font-weight:800;font-size:.95rem}
.cw-header-sub{font-size:.72rem;opacity:.75;margin-top:2px}
.cw-close{background:none;border:none;color:#fff;font-size:22px;cursor:pointer;opacity:.7;transition:opacity .2s;padding:4px}
.cw-close:hover{opacity:1}

/* Progress */
.cw-progress{height:4px;background:#e2e8f0;position:relative}
.cw-progress-bar{height:100%;background:linear-gradient(90deg,#e87722,#f5a623);transition:width .4s ease;border-radius:0 2px 2px 0}

/* Messages */
.cw-messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:10px;scroll-behavior:smooth}
.cw-msg{max-width:85%;padding:10px 14px;border-radius:16px;font-size:.88rem;line-height:1.5;animation:cwFadeIn .3s ease}
.cw-msg.bot{background:#f1f5f9;color:#1a2b5f;border-bottom-left-radius:4px;align-self:flex-start}
.cw-msg.user{background:linear-gradient(135deg,#e87722,#f5a623);color:#fff;border-bottom-right-radius:4px;align-self:flex-end}
@keyframes cwFadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}

/* Typing indicator */
.cw-typing{display:flex;gap:4px;padding:10px 14px;align-self:flex-start}
.cw-typing span{width:8px;height:8px;background:#94a3b8;border-radius:50%;animation:cwBounce 1.4s infinite}
.cw-typing span:nth-child(2){animation-delay:.2s}
.cw-typing span:nth-child(3){animation-delay:.4s}
@keyframes cwBounce{0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-8px)}}

/* Input area */
.cw-input-area{padding:12px 16px;border-top:1px solid #e2e8f0;display:flex;gap:8px;align-items:center}
.cw-input{flex:1;border:1.5px solid #e2e8f0;border-radius:24px;padding:10px 16px;font-size:.88rem;outline:none;transition:border-color .2s;font-family:inherit}
.cw-input:focus{border-color:#e87722}
.cw-send{width:38px;height:38px;border-radius:50%;background:linear-gradient(135deg,#e87722,#f5a623);color:#fff;border:none;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:16px;transition:transform .2s}
.cw-send:hover{transform:scale(1.08)}
.cw-input-area.hidden{display:none}

/* Chips */
.cw-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px}
.cw-chip{padding:8px 16px;border-radius:20px;font-size:.82rem;font-weight:600;cursor:pointer;border:2px solid transparent;transition:all .2s;text-align:center}
.cw-chip:hover{transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,.12)}
.cw-chip.grade{background:#e6f7f2;color:#1d9e75;border-color:#1d9e75}
.cw-chip.grade:hover,.cw-chip.grade.selected{background:#1d9e75;color:#fff}
.cw-chip.nav{background:#e8eaf6;color:#1a2b5f;border-color:#1a2b5f}
.cw-chip.nav:hover,.cw-chip.nav.selected{background:#1a2b5f;color:#fff}
.cw-chip.interest{background:#fff3e6;color:#e87722;border-color:#e87722}
.cw-chip.interest:hover,.cw-chip.interest.selected{background:#e87722;color:#fff}
.cw-chip.hear{background:#f1f5f9;color:#475569;border-color:#94a3b8}
.cw-chip.hear:hover,.cw-chip.hear.selected{background:#475569;color:#fff}

/* Area grid */
.cw-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:6px}
.cw-grid-item{padding:10px 8px;border-radius:12px;background:#e8eaf6;color:#1a2b5f;border:2px solid #1a2b5f;font-size:.78rem;font-weight:600;cursor:pointer;text-align:center;transition:all .2s;line-height:1.3}
.cw-grid-item:hover,.cw-grid-item.selected{background:#1a2b5f;color:#fff}
.cw-grid-item .cw-dist{font-size:.68rem;font-weight:400;opacity:.75;display:block;margin-top:2px}

/* Slot grid */
.cw-slot-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin-top:6px}
.cw-slot{padding:8px 4px;border-radius:10px;font-size:.72rem;font-weight:600;text-align:center;cursor:pointer;border:2px solid #1d9e75;color:#1d9e75;background:#e6f7f2;transition:all .2s;line-height:1.3}
.cw-slot:hover,.cw-slot.selected{background:#1d9e75;color:#fff}
.cw-slot.full{background:#fee2e2;color:#dc2626;border-color:#dc2626;cursor:not-allowed;opacity:.6}
.cw-slot .cw-day{display:block;font-weight:800;font-size:.74rem}

/* Star rating */
.cw-stars{display:flex;gap:6px;margin-top:6px}
.cw-star{font-size:32px;cursor:pointer;transition:transform .2s;color:#e2e8f0}
.cw-star:hover,.cw-star.active{color:#f5a623;transform:scale(1.2)}

/* Quiz / extras */
.cw-quiz-option{display:block;width:100%;padding:10px 14px;margin:4px 0;border-radius:12px;background:#f1f5f9;color:#1a2b5f;border:2px solid transparent;font-size:.84rem;font-weight:600;cursor:pointer;text-align:left;transition:all .2s}
.cw-quiz-option:hover{border-color:#1d9e75;background:#e6f7f2}
.cw-quiz-option.selected{border-color:#1d9e75;background:#1d9e75;color:#fff}

/* Skip button */
.cw-skip{display:block;margin:8px auto 0;background:none;border:none;color:#94a3b8;font-size:.78rem;cursor:pointer;text-decoration:underline;transition:color .2s}
.cw-skip:hover{color:#64748b}

/* Virtual tour room cards */
.cw-rooms{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:6px}
.cw-room{padding:12px 8px;border-radius:14px;background:linear-gradient(135deg,#f8fafc,#e8eaf6);border:2px solid #c7d2fe;text-align:center;cursor:pointer;transition:all .2s;font-size:.82rem;font-weight:700;color:#1a2b5f}
.cw-room:hover{border-color:#1a2b5f;transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,.1)}
.cw-room .cw-room-icon{font-size:24px;display:block;margin-bottom:4px}

/* Bar chart */
.cw-bar-chart{margin-top:8px}
.cw-bar-row{display:flex;align-items:center;gap:8px;margin:4px 0}
.cw-bar-label{font-size:.76rem;font-weight:600;color:#1a2b5f;width:80px;text-align:right}
.cw-bar-track{flex:1;height:18px;background:#e2e8f0;border-radius:9px;overflow:hidden}
.cw-bar-fill{height:100%;border-radius:9px;transition:width 1s ease}
.cw-bar-pct{font-size:.72rem;font-weight:700;color:#475569;width:36px}

/* Summary card */
.cw-summary{background:linear-gradient(135deg,#f8fafc,#eff6ff);border-radius:14px;padding:16px;margin-top:6px;border:1.5px solid #c7d2fe}
.cw-summary h4{margin:0 0 10px;color:#1a2b5f;font-size:.92rem}
.cw-summary-row{display:flex;justify-content:space-between;padding:4px 0;font-size:.82rem;border-bottom:1px solid #e2e8f0}
.cw-summary-row:last-child{border:none}
.cw-summary-label{color:#64748b;font-weight:600}
.cw-summary-value{color:#1a2b5f;font-weight:700;text-align:right}

/* Parent stories card */
.cw-story{background:#f8fafc;border-radius:12px;padding:14px;margin-top:6px;border-left:4px solid #e87722;font-size:.84rem;line-height:1.5;color:#334155;font-style:italic}
.cw-story .cw-story-parent{display:block;margin-top:6px;font-style:normal;font-weight:700;color:#1a2b5f;font-size:.78rem}

/* Readiness result */
.cw-readiness{text-align:center;margin-top:8px}
.cw-readiness-pct{font-size:2.2rem;font-weight:900;color:#1d9e75}
.cw-readiness-msg{font-size:.84rem;color:#475569;margin-top:4px}

/* Confirm button */
.cw-confirm-btn{display:block;width:100%;padding:12px;margin-top:10px;border:none;border-radius:14px;background:linear-gradient(135deg,#e87722,#f5a623);color:#fff;font-size:.92rem;font-weight:800;cursor:pointer;transition:transform .2s,box-shadow .2s}
.cw-confirm-btn:hover{transform:translateY(-2px);box-shadow:0 6px 20px rgba(232,119,34,.4)}

/* Floating messages */
.cw-float-container{position:fixed;bottom:24px;right:24px;width:64px;height:64px;z-index:9997;pointer-events:none}
.cw-float-msg{position:absolute;white-space:nowrap;background:#fff;color:#1a2b5f;font-size:11.5px;font-weight:700;padding:8px 14px;border-radius:12px;border:2px solid #e87722;box-shadow:0 4px 16px rgba(0,0,0,.12);pointer-events:auto;cursor:pointer;opacity:0;transform:scale(.6);transition:opacity .4s ease,transform .4s ease}
.cw-float-msg.cw-float-visible{opacity:1;transform:scale(1)}
.cw-float-msg.cw-float-out{opacity:0;transform:scale(.6);transition:opacity .35s ease,transform .35s ease}
.cw-float-msg:hover{background:#fff7ed;border-color:#f5a623;transform:scale(1.05)!important}

/* Arrow toward button */
.cw-float-msg::after{content:'';position:absolute;width:8px;height:8px;background:#fff;border-right:2px solid #e87722;border-bottom:2px solid #e87722;transform:rotate(45deg)}

/* Positions relative to bubble center (32px offset = half of 64px bubble) */
.cw-float-top-right{bottom:72px;right:0}
.cw-float-top-right::after{bottom:-6px;right:20px;transform:rotate(45deg)}

.cw-float-top-left{bottom:72px;right:40px}
.cw-float-top-left::after{bottom:-6px;right:20px;transform:rotate(45deg)}

.cw-float-top{bottom:78px;right:-10px}
.cw-float-top::after{bottom:-6px;left:50%;margin-left:-4px;transform:rotate(45deg)}

.cw-float-left{bottom:20px;right:76px}
.cw-float-left::after{right:-6px;top:50%;margin-top:-4px;transform:rotate(-45deg)}

.cw-float-right{bottom:20px;left:76px}
.cw-float-right::after{left:-6px;top:50%;margin-top:-4px;transform:rotate(135deg)}

/* Responsive */
@media(max-width:480px){
  .cw-window{right:0;left:0;bottom:0;width:100%;max-height:100vh;border-radius:20px 20px 0 0}
  .cw-bubble{bottom:16px;right:16px;width:56px;height:56px;font-size:24px}
  .cw-float-container{bottom:16px;right:16px;width:56px;height:56px}
  .cw-float-msg{font-size:10.5px;padding:6px 10px}
  .cw-float-left,.cw-float-right{right:64px;left:auto}
  .cw-slot-grid{grid-template-columns:repeat(3,1fr)}
}
