/*  Luxury Handbags AI Stylist — widget styles (loaded inside the shadow root). */

:host { all: initial; }

.cais, .cais * { box-sizing: border-box; }
.cais {
	--accent: var(--cais-accent, #111);
	--bg: #ffffff;
	--ink: #1a1a1a;
	--muted: #767676;
	--line: #ececec;
	--radius: 16px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--ink);
	font-size: 15px;
	line-height: 1.45;
}

/* ---------- launcher ---------- */
.cais.mode-floating { position: fixed; bottom: 22px; z-index: 2147483000; }
.cais.pos-right { right: 22px; }
.cais.pos-left  { left: 22px; }

.cais-launcher {
	display: inline-flex; align-items: center; gap: 8px;
	background: var(--accent); color: #fff; border: 0;
	padding: 12px 18px; border-radius: 999px; cursor: pointer;
	font-size: 14px; font-weight: 600; letter-spacing: .2px;
	box-shadow: 0 8px 30px rgba(0,0,0,.18); transition: transform .15s ease, box-shadow .15s ease;
}
.cais-launcher:hover { transform: translateY(-2px); box-shadow: 0 12px 38px rgba(0,0,0,.24); }
.cais-spark { font-size: 15px; }
.cais.is-open .cais-launcher { transform: scale(.9); opacity: 0; pointer-events: none; }

/* ---------- panel ---------- */
.cais-panel {
	display: none; flex-direction: column; background: var(--bg);
	width: 400px; max-width: calc(100vw - 32px);
	height: 640px; max-height: calc(100vh - 110px);
	border-radius: var(--radius); overflow: hidden;
	box-shadow: 0 24px 70px rgba(0,0,0,.22); border: 1px solid var(--line);
}
.cais.mode-floating .cais-panel { position: fixed; bottom: 22px; }
.cais.mode-floating.pos-right .cais-panel { right: 22px; }
.cais.mode-floating.pos-left  .cais-panel { left: 22px; }
.cais.is-open .cais-panel { display: flex; animation: cais-in .22s ease; }
.cais.mode-inline .cais-panel { display: flex; position: relative; width: 100%; height: 600px; }
.cais.intent-cart .cais-panel { height: auto; max-height: 560px; }

/* ---------- slide-in cart drawer ---------- */
.cais.mode-drawer { position: fixed; top: 0; bottom: 0; z-index: 2147483000; pointer-events: none; }
.cais.mode-drawer.pos-right { right: 0; }
.cais.mode-drawer.pos-left { left: 0; }
.cais.mode-drawer .cais-panel {
	display: flex; position: fixed; top: 0; bottom: 0; height: 100vh; max-height: 100vh;
	width: 420px; max-width: 92vw; border-radius: 0; pointer-events: auto;
	box-shadow: -18px 0 60px rgba(0,0,0,.22);
	transition: transform .32s cubic-bezier(.22,.61,.36,1);
}
.cais.mode-drawer.pos-right .cais-panel { right: 0; transform: translateX(112%); }
.cais.mode-drawer.pos-left .cais-panel { left: 0; box-shadow: 18px 0 60px rgba(0,0,0,.22); transform: translateX(-112%); }
.cais.mode-drawer.is-open .cais-panel { transform: translateX(0); animation: none; }
.cais.mode-drawer .cais-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.42); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.cais.mode-drawer.is-open .cais-backdrop { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .cais.mode-drawer .cais-panel, .cais.mode-drawer .cais-backdrop { transition: none; } }

/* draggable collection chips (touch + mouse) */
.cais-coll-chip { cursor: grab; touch-action: none; display: inline-flex; align-items: center; gap: 6px; padding-left: 6px; }
.cais-coll-chip:active { cursor: grabbing; }
.cais-coll-chip.dragging { opacity: .45; }
.cais-coll-cover { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; display: block; flex: 0 0 auto; }
.cais-coll-name { line-height: 1; }

/* RTL languages */
.cais[dir="rtl"] .cais-input { text-align: right; }
.cais[dir="rtl"] .cais-msg.user { justify-content: flex-start; }
.cais[dir="rtl"] .cais-msg.assistant { justify-content: flex-end; }
@keyframes cais-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.cais-head {
	display: flex; align-items: center; justify-content: space-between;
	padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff;
}
.cais-title { font-weight: 700; letter-spacing: .2px; display: flex; align-items: center; gap: 7px; }
.cais-head-actions { display: flex; gap: 4px; }
.cais-icon {
	border: 0; background: transparent; cursor: pointer; font-size: 17px;
	width: 34px; height: 34px; border-radius: 9px; color: var(--ink);
}
.cais-icon:hover { background: #f4f4f4; }

/* ---------- log / messages ---------- */
.cais-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #fafafa; }
.cais-msg { display: flex; }
.cais-msg.user { justify-content: flex-end; }
.cais-bubble {
	max-width: 84%; padding: 10px 14px; border-radius: 14px;
	background: #fff; border: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word;
}
.cais-msg.user .cais-bubble { background: var(--accent); color: #fff; border-color: var(--accent); }
.cais-cards-msg { display: block; }

.cais-typing { display: inline-flex; gap: 4px; align-items: center; }
.cais-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: cais-blink 1.2s infinite both; }
.cais-dot:nth-child(2) { animation-delay: .2s; }
.cais-dot:nth-child(3) { animation-delay: .4s; }
@keyframes cais-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* ---------- product grid ---------- */
.cais-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 2px; }
.cais-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.cais-card-img { display: block; position: relative; aspect-ratio: 3/4; overflow: hidden; background: #f2f2f2; }
.cais-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.cais-card:hover .cais-card-img img { transform: scale(1.04); }
.cais-badge { position: absolute; top: 8px; left: 8px; background: #b00020; color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 999px; letter-spacing: .5px; text-transform: uppercase; }
.cais-card-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px; }
.cais-brand { font-size: 10px; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.cais-card-title { font-size: 13px; color: var(--ink); text-decoration: none; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cais-card-title:hover { text-decoration: underline; }
.cais-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.cais-price { font-weight: 700; font-size: 13px; }
.cais-save { border: 0; background: transparent; cursor: pointer; font-size: 17px; color: var(--accent); line-height: 1; }
.cais-save.is-saved { color: #b00020; }

.cais-badge.oos { background: #444; left: auto; right: 8px; }

/* ---------- card actions: add to cart + complete the look ---------- */
.cais-card-actions { display: flex; gap: 6px; margin-top: 8px; }
.cais-add {
	flex: 1; border: 1px solid var(--accent); background: var(--accent); color: #fff;
	border-radius: 9px; padding: 7px 8px; font-size: 12px; font-weight: 600; cursor: pointer;
	text-align: center; text-decoration: none; line-height: 1.3; transition: opacity .12s ease;
}
.cais-add:hover { opacity: .9; }
.cais-add:disabled { opacity: .6; cursor: default; }
.cais-add.done { background: #137333; border-color: #137333; }
.cais-look {
	flex: 0 0 auto; width: 34px; border: 1px solid var(--line); background: #fff; color: var(--accent);
	border-radius: 9px; cursor: pointer; font-size: 14px; line-height: 1;
}
.cais-look:hover { background: #f4f4f4; }
.cais-look.busy { opacity: .5; pointer-events: none; }
.cais-tryon { flex: 0 0 auto; width: 34px; border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; font-size: 14px; line-height: 1; }
.cais-tryon:hover { background: #f4f4f4; }

/* virtual try-on */
.cais-tryon-loading { position: relative; }
.cais-tryon-loading::after { content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 8px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: cais-spin .8s linear infinite; vertical-align: middle; }
@keyframes cais-spin { to { transform: rotate(360deg); } }
.cais-tryon-result img { width: 100%; max-height: 460px; object-fit: contain; border-radius: 12px; background: #f6f6f6; display: block; }
.cais-tryon-acts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.cais-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cais-gallery-thumb { padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: #f2f2f2; aspect-ratio: 3/4; }
.cais-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cais-gallery-thumb:hover { border-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .cais-tryon-loading::after { animation: none; } }

.cais-sizes { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.cais-sizes-load { font-size: 11.5px; color: var(--muted); }
.cais-size {
	border: 1px solid var(--line); background: #fff; color: var(--ink);
	border-radius: 7px; padding: 5px 9px; font-size: 11.5px; cursor: pointer;
}
.cais-size:hover { border-color: var(--accent); }
.cais-size-link { text-decoration: none; }
.cais-size.rec { border-color: var(--accent); font-weight: 700; }
.cais-size.oos { color: var(--muted); text-decoration: line-through; border-style: dashed; }

/* returns & exchanges */
.cais-return-order { width: 100%; max-width: 100%; }
.cais-return-head { font-weight: 700; font-size: 12px; margin-bottom: 4px; }
.cais-return-item { display: flex; align-items: center; gap: 6px; padding: 6px 0; border-top: 1px solid var(--line); }
.cais-return-name { flex: 1; font-size: 12.5px; line-height: 1.3; }
.cais-return-act { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 7px; padding: 4px 9px; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.cais-return-act:hover { border-color: var(--accent); }
.cais-size.oos:hover { color: var(--accent); border-color: var(--accent); }
.cais-add.notify { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.cais-add.notify:hover { background: #f4f4f4; opacity: 1; }

/* ---------- restock notify form ---------- */
.cais-notify { margin-top: 7px; }
.cais-notify-form { display: flex; gap: 5px; }
.cais-notify-input {
	flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 8px;
	padding: 7px 10px; font-size: 12px; outline: none;
}
.cais-notify-input:focus { border-color: var(--accent); }
.cais-notify-send {
	border: 0; background: var(--accent); color: #fff; border-radius: 8px;
	padding: 7px 11px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.cais-notify-done { font-size: 12px; color: #137333; font-weight: 600; }

/* ---------- outfit ---------- */
.cais-outfit-label {
	font-size: 11px; letter-spacing: .8px; text-transform: uppercase; color: var(--muted);
	margin: 12px 0 6px; font-weight: 700;
}
.cais-outfit-label:first-child { margin-top: 2px; }
.cais-lookbook-copy { font-size: 12.5px; color: var(--muted); font-style: italic; margin: 0 0 8px; line-height: 1.4; }

/* ---------- toast ---------- */
.cais-toast {
	position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(12px);
	background: #1a1a1a; color: #fff; padding: 11px 16px; border-radius: 999px;
	font-size: 13px; display: flex; align-items: center; gap: 12px; z-index: 2147483600;
	box-shadow: 0 10px 34px rgba(0,0,0,.3); opacity: 0; transition: opacity .25s ease, transform .25s ease;
	max-width: calc(100vw - 32px);
}
.cais-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.cais-toast-link { color: #fff; text-decoration: underline; font-weight: 600; white-space: nowrap; }

/* ---------- chips ---------- */
.cais-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 14px 8px; }
.cais-chip {
	border: 1px solid var(--line); background: #fff; color: var(--ink);
	padding: 7px 12px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
	transition: background .12s ease, border-color .12s ease;
}
.cais-chip:hover { background: #f4f4f4; }
.cais-chip.sel { border-color: var(--accent); background: var(--accent); color: #fff; }
.cais-chip.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- compose ---------- */
.cais-compose { border-top: 1px solid var(--line); background: #fff; padding-top: 8px; }
.cais-form { display: flex; align-items: center; gap: 6px; padding: 8px 12px 12px; }
.cais-input {
	flex: 1; border: 1px solid var(--line); border-radius: 999px;
	padding: 11px 16px; font-size: 14px; outline: none; color: var(--ink); background: #fff;
}
.cais-input:focus { border-color: var(--accent); }
.cais-mic-btn.listening { color: #c5221f; animation: cais-pulse 1.1s ease-in-out infinite; }
@keyframes cais-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .cais-mic-btn.listening { animation: none; } }

.cais-send {
	border: 0; background: var(--accent); color: #fff; width: 40px; height: 40px;
	border-radius: 50%; cursor: pointer; font-size: 18px; flex: 0 0 auto;
}
.cais-send:hover { opacity: .9; }

@media (max-width: 480px) {
	.cais.mode-floating .cais-panel { width: 100vw; height: 100vh; max-height: 100vh; bottom: 0; right: 0; left: 0; border-radius: 0; }
	.cais.mode-floating { bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
	.cais-launcher, .cais-card-img img, .cais.is-open .cais-panel { transition: none; animation: none; }
}
