/* AI Design : the button in the design studio's header , and the chat it opens ( .czai ). */

/* ----- the button : a moving purple-to-blue edge ----- */
@property --czai-turn { syntax: '<angle>'; initial-value: 0deg; inherits: false; }
.czp .czd-studio-bar .czai-open, .czp .czd-studio-bar .czai-open:hover, .czp .czd-studio-bar .czai-open:focus, .czp .czd-studio-bar .czai-open:active {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px;
  border: 2px solid transparent; border-radius: 100px;
  background: linear-gradient(#fff, #fff) padding-box, conic-gradient(from var(--czai-turn), #7c3aed, #2563eb, #06b6d4, #7c3aed) border-box;
  color: #312e81; font: inherit; font-size: 14px; font-weight: 800; line-height: 1; white-space: nowrap; cursor: pointer; box-shadow: none; text-transform: none; letter-spacing: 0;
  transition: box-shadow .25s ease, transform .15s ease;
}
.czp .czd-studio-bar .czai-open .czai-spark { color: #7c3aed; transition: transform .4s ease; }
.czp .czd-studio-bar .czai-open:hover, .czp .czd-studio-bar .czai-open:focus-visible { animation: czai-turn 2.2s linear infinite; box-shadow: 0 4px 18px -4px rgba(124, 58, 237, .55); }
.czp .czd-studio-bar .czai-open:hover .czai-spark { transform: rotate(18deg) scale(1.15); }
.czp .czd-studio-bar .czai-open:active { transform: scale(.97); }
.czp .czd-studio-bar .czai-open:focus-visible { outline: 2px solid #312e81; outline-offset: 2px; }
@keyframes czai-turn { to { --czai-turn: 360deg; } }

/* ----- the pop-up ----- */
html.czai-locked { overflow: hidden; }
.czai { position: fixed; inset: 0; z-index: 100002; display: flex; align-items: center; justify-content: center; font-family: inherit; }
.czai[hidden] { display: none; }
.czai *, .czai *::before, .czai *::after { box-sizing: border-box; }
.czai .czai-shade { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); opacity: 0; transition: opacity .25s ease; }
.czai .czai-box { position: relative; display: flex; flex-direction: column; width: min(780px, calc(100vw - 48px)); height: min(760px, calc(100dvh - 64px)); border-radius: 20px; background: #fff; color: #141921; box-shadow: 0 30px 80px -20px rgba(15, 23, 42, .5); overflow: hidden; opacity: 0; transform: translateY(14px) scale(.985); transition: opacity .25s ease, transform .25s cubic-bezier(.3, .9, .3, 1); outline: 0; }
.czai.is-open .czai-shade { opacity: 1; }
.czai.is-open .czai-box { opacity: 1; transform: none; }

.czai .czai-head { flex: none; position: relative; display: flex; align-items: center; justify-content: center; min-height: 60px; padding: 10px 60px; border-bottom: 1px solid #e8eaee; }
.czai .czai-title { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; font-size: 19px; font-weight: 800; line-height: 1.2; color: #141921; }
.czai .czai-title .czai-spark { width: 22px; height: 22px; color: #7c3aed; }
.czai .czai-close, .czai .czai-close:hover, .czai .czai-close:focus { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: #f1f2f4; color: #141921; cursor: pointer; box-shadow: none; }
.czai .czai-close:hover { background: #e4e6ea; }
.czai .czai-new, .czai .czai-new:hover, .czai .czai-new:focus { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: #4b5563; font: inherit; font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; box-shadow: none; text-transform: none; }
.czai .czai-new:hover { color: #141921; }
.czai .czai-new[hidden] { display: none; }

.czai .czai-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 26px; }
.czai .czai-welcome { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100%; text-align: center; }
.czai .czai-welcome[hidden] { display: none; }
.czai .czai-art svg { display: block; width: 170px; height: auto; }
.czai .czai-intro { margin: 10px 0 18px; max-width: 46ch; color: #4b5563; font-size: 15.5px; line-height: 1.5; }
.czai .czai-examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 620px; }
.czai .czai-example, .czai .czai-example:focus { padding: 9px 14px; border: 1px solid #d9dce2; border-radius: 100px; background: #fff; color: #141921; font: inherit; font-size: 13.5px; font-weight: 600; line-height: 1.3; text-align: left; cursor: pointer; box-shadow: none; text-transform: none; letter-spacing: 0; white-space: normal; transition: border-color .15s ease, background-color .15s ease; }
.czai .czai-example:hover { border-color: #7c3aed; background: #f5f3ff; color: #141921; }

.czai .czai-turn { margin-bottom: 22px; }
.czai .czai-ask { width: fit-content; max-width: 82%; margin: 0 0 12px auto; padding: 10px 15px; border-radius: 18px 18px 4px 18px; background: #eef0ff; color: #1e1b4b; font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.czai .czai-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; max-width: 640px; }
.czai .czai-tile, .czai .czai-tile:focus { position: relative; display: block; aspect-ratio: 1; padding: 0; border: 1px solid #e3e5ea; border-radius: 14px; overflow: hidden; cursor: pointer; box-shadow: none;
  background-color: #fff; background-image: linear-gradient(45deg, #eef0f3 25%, transparent 25%, transparent 75%, #eef0f3 75%), linear-gradient(45deg, #eef0f3 25%, transparent 25%, transparent 75%, #eef0f3 75%); background-size: 18px 18px; background-position: 0 0, 9px 9px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.czai .czai-tile img { display: block; width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.czai .czai-tile-add { position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 8px 10px; border-radius: 100px; background: #141921; color: #fff; font-size: 13px; font-weight: 700; line-height: 1.2; text-align: center; opacity: 0; transform: translateY(6px); transition: opacity .15s ease, transform .15s ease; }
.czai button.czai-tile:hover, .czai button.czai-tile:focus-visible { border-color: #7c3aed; box-shadow: 0 8px 22px -10px rgba(124, 58, 237, .6); transform: translateY(-2px); }
.czai button.czai-tile:hover .czai-tile-add, .czai button.czai-tile:focus-visible .czai-tile-add { opacity: 1; transform: none; }
.czai .czai-tile.is-busy { pointer-events: none; opacity: .6; }
.czai .czai-tile.is-busy .czai-tile-add { opacity: 1; transform: none; }
.czai .czai-tile-wait { cursor: default; background-image: linear-gradient(100deg, #f1f2f6 30%, #e6e3fb 50%, #f1f2f6 70%); background-size: 300% 100%; animation: czai-wait 1.4s linear infinite; }
@keyframes czai-wait { from { background-position: 100% 0; } to { background-position: -50% 0; } }
.czai .czai-working { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; color: #4b5563; font-size: 14px; font-weight: 600; }
.czai .czai-dots { display: inline-flex; gap: 4px; }
.czai .czai-dots i { width: 7px; height: 7px; border-radius: 50%; background: #7c3aed; animation: czai-dot 1s ease-in-out infinite; }
.czai .czai-dots i:nth-child(2) { animation-delay: .15s; background: #4f46e5; }
.czai .czai-dots i:nth-child(3) { animation-delay: .3s; background: #2563eb; }
@keyframes czai-dot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
.czai .czai-error { width: fit-content; max-width: 82%; margin: 0; padding: 10px 15px; border-radius: 4px 18px 18px 18px; background: #fdecea; color: #7a1c14; font-size: 14px; line-height: 1.45; }

.czai .czai-form { flex: none; display: flex; align-items: flex-end; gap: 10px; margin: 0; padding: 14px 18px 8px; border-top: 1px solid #e8eaee; background: #fff; }
.czai .czai-input, .czai .czai-input:focus { flex: 1; min-height: 46px; max-height: 140px; margin: 0; padding: 12px 16px; border: 1px solid #cfd3da; border-radius: 23px; background: #fff; color: #141921; font: inherit; font-size: 16px; line-height: 1.35; resize: none; box-shadow: none; outline: 0; }
.czai .czai-input:focus { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, .18); }
.czai .czai-send, .czai .czai-send:hover, .czai .czai-send:focus { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 46px; padding: 0 20px; border: 0; border-radius: 100px; background: linear-gradient(120deg, #7c3aed, #2563eb); color: #fff; font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; box-shadow: none; text-transform: none; letter-spacing: 0; transition: filter .15s ease, transform .15s ease; }
.czai .czai-send:hover { filter: brightness(1.1); }
.czai .czai-send:active { transform: scale(.97); }
.czai .czai-send:focus-visible { outline: 2px solid #141921; outline-offset: 2px; }
.czai .czai-send[disabled] { opacity: .55; cursor: default; }
.czai .czai-foot { flex: none; margin: 0; padding: 0 20px 12px; color: #6b7280; font-size: 11.5px; line-height: 1.4; text-align: center; }
.czai .screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ----- the note after a design was added ----- */
.czai-toast { position: fixed; left: 50%; bottom: 28px; z-index: 100003; max-width: min(520px, calc(100vw - 28px)); padding: 13px 18px; border-radius: 14px; background: #141921; color: #fff; font-size: 14.5px; font-weight: 600; line-height: 1.4; box-shadow: 0 16px 40px -12px rgba(15, 23, 42, .6); opacity: 0; transform: translate(-50%, 16px); transition: opacity .3s ease, transform .3s cubic-bezier(.3, .9, .3, 1); }
.czai-toast.is-in { opacity: 1; transform: translate(-50%, 0); }
.czai-toast.is-good { background: #14532d; }

@media (prefers-reduced-motion: reduce) {
  .czp .czd-studio-bar .czai-open:hover, .czai .czai-tile-wait, .czai .czai-dots i { animation: none; }
  .czai .czai-box, .czai .czai-shade, .czai-toast { transition: none; }
}

/* the button waits until the designer can take a picture ; the note is for an admin whose store has the older script */
.czp .czd-studio-bar .czai-open[hidden] { display: none; }
.czai .czai-setup { flex: none; margin: 0 18px 8px; padding: 10px 14px; border-radius: 12px; background: #fff4d6; color: #5c3a00; font-size: 13px; line-height: 1.45; }
.czai .czai-setup[hidden] { display: none; }
.czai .czai-setup a { color: inherit; font-weight: 700; text-decoration: underline; }

/* the art style : a row of choices over the box */
.czai .czai-styles { flex: none; display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 18px 0; border-top: 1px solid #e8eaee; background: #fff; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.czai .czai-styles::-webkit-scrollbar { display: none; }
.czai .czai-styles[hidden] { display: none; }
.czai .czai-styles + .czai-form { border-top: 0; padding-top: 10px; }
.czai .czai-styles-label { flex: none; color: #6b7280; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.czai .czai-style, .czai .czai-style:focus { flex: none; margin: 0; padding: 7px 13px; border: 1px solid #d9dce2; border-radius: 100px; background: #fff; color: #141921; font: inherit; font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; cursor: pointer; box-shadow: none; }
.czai .czai-style:hover { border-color: #7c3aed; background: #f5f3ff; color: #141921; }
.czai .czai-style.is-on, .czai .czai-style.is-on:hover { border-color: transparent; background: linear-gradient(135deg, #7c3aed, #2563eb); color: #fff; }
.czai .czai-style:focus-visible { outline: 2px solid #7c3aed; outline-offset: 2px; }
.czai .czai-ask-style { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 100px; background: rgba(124, 58, 237, .12); color: #5b21b6; font-size: 11.5px; font-weight: 700; vertical-align: middle; }
