/* ============================================================
   AI Try-On / Virtual Styling
   ai-tryon.css — scoped under .ai-page
   Layout modelled on the reference: image + thumbnails on the
   left, clean option blocks below, 3-col product grid on right.
============================================================ */

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
    --ai-page-bg:    #f4f4f5;
    --ai-card:       #ffffff;
    --ai-ink:        #1a1a1a;
    --ai-ink-mid:    #6b6b6b;
    --ai-ink-light:  #9a9a9a;
    --ai-accent:     #111111;
    --ai-gold:       #c28a55;
    --ai-border:     rgba(0,0,0,.10);
    --ai-border-mid: rgba(0,0,0,.16);
    --ai-radius:     14px;
    --ai-sans:       'Jost', 'Inter', Arial, sans-serif;
    --ai-header-h:   72px;
}

/* ── PAGE ────────────────────────────────────────────────── */
.ai-page {
    max-width: 1640px;
    margin: 0 auto;
    padding: 22px;
    min-height: calc(100dvh - var(--ai-header-h));
    background: var(--ai-page-bg);
    font-family: var(--ai-sans);
    color: var(--ai-ink);
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

.ai-page .ai-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

/* ── LEFT PANEL ──────────────────────────────────────────── */
.ai-page .ai-left-panel {
    position: sticky;
    top: 22px;
    align-self: start;
    background: var(--ai-card);
    border: 1px solid var(--ai-border);
    border-radius: var(--ai-radius);
    padding: 20px;
    box-sizing: border-box;
}

/* image (media) on the left, details on the right */
.ai-page .detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.ai-page .detail-media {
    position: sticky;
    top: 20px;
}

.ai-page .detail-info { min-width: 0; }

/* ── GALLERY (main image + arrows) ───────────────────────── */
.ai-page .gallery {
    position: relative;
    display: flex;
    align-items: center;
}

.ai-page .preview-stage {
    position: relative;
    flex: 1;
    aspect-ratio: 3 / 4;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-page .preview-stage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: opacity .28s ease;
    display: block;
}

.ai-page .preview-stage img.fading { opacity: 0; }

.ai-page .gal-nav {
    position: absolute;
    z-index: 4;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--ai-border);
    background: #fff;
    color: var(--ai-ink);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.10);
    transition: background .2s, transform .2s;
}
.ai-page .gal-nav:hover { background: #f3f3f3; }
.ai-page .gal-nav.prev { left: -6px; }
.ai-page .gal-nav.next { right: -6px; }

.ai-page .preview-stage .wish-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--ai-border);
    font-size: 17px;
    color: var(--ai-ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
    transition: background .2s, color .2s;
}
.ai-page .preview-stage .wish-btn:hover { color: #e0556f; }

/* ── THUMBNAIL STRIP ─────────────────────────────────────── */
.ai-page .thumb-strip {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}
.ai-page .thumb-strip::-webkit-scrollbar { display: none; }
.ai-page .thumb-strip:empty { display: none; }

.ai-page .thumb {
    flex-shrink: 0;
    width: 64px;
    height: 80px;
    padding: 0;
    border: 1px solid var(--ai-border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background: #fff;
    transition: border-color .2s;
}
.ai-page .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.ai-page .thumb:hover  { border-color: var(--ai-border-mid); }
.ai-page .thumb.active { border-color: var(--ai-ink); border-width: 2px; }

/* ── INFO PANEL ──────────────────────────────────────────── */
/* ── INFO / DETAIL TEXT ──────────────────────────────────── */
.ai-page .product-name {
    font-size: 22px;
    line-height: 1.25;
    font-weight: 700;
    margin: 0 0 6px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.ai-page .product-price {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.ai-page .product-desc {
    font-size: 13px;
    line-height: 1.6;
    color: var(--ai-ink-mid);
    margin: 0 0 18px;
}

/* ── OPTION BLOCKS (colour / size / qty) ─────────────────── */
.ai-page .opt-block {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--ai-border);
}
.ai-page .opt-block:last-of-type { border-bottom: 0; }

.ai-page .opt-label {
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--ai-ink);
}
.ai-page .opt-label span { color: var(--ai-gold); font-weight: 700; }

.ai-page .opt-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.ai-page .size-guide {
    font-size: 11px;
    color: var(--ai-ink-mid);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.ai-page .size-guide:hover { color: var(--ai-ink); text-decoration: underline; }

/* COLOUR SWATCHES */
.ai-page .swatches {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.ai-page .swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 0 0 1px var(--ai-border-mid);
    transition: transform .18s, box-shadow .18s;
}
.ai-page .swatch:hover  { transform: scale(1.08); }
.ai-page .swatch.active {
    transform: scale(1.04);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ai-ink);
}

.ai-page .swatch-more {
    height: 28px;
    min-width: 28px;
    padding: 0 8px;
    border-radius: 999px;
    border: 1px solid var(--ai-border-mid);
    background: #fff;
    color: var(--ai-ink-mid);
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

/* SIZE PILLS */
.ai-page .size-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-page .size-buttons .size-btn {
    font-family: var(--ai-sans);
    min-width: 48px;
    height: 42px;
    padding: 0 16px;
    border: 1px solid var(--ai-border-mid);
    background: #fff;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ai-ink);
    cursor: pointer;
    transition: border-color .18s, background .18s, color .18s, box-shadow .18s;
}
.ai-page .size-buttons .size-btn:hover {
    border-color: var(--ai-ink);
}
.ai-page .size-buttons .size-btn.active {
    background: var(--ai-accent);
    color: #fff;
    border-color: var(--ai-accent);
    box-shadow: 0 4px 12px rgba(0,0,0,.16);
}

.ai-page .no-attr { font-size: 12px; color: var(--ai-ink-light); }

/* QUANTITY */
.ai-page .qty-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ai-page .qty-stepper {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--ai-border-mid);
    border-radius: 8px;
    overflow: hidden;
}

.ai-page .qty-btn {
    width: 38px;
    height: 40px;
    border: 0;
    background: #fff;
    font-size: 18px;
    color: var(--ai-ink);
    cursor: pointer;
    transition: background .2s;
}
.ai-page .qty-btn:hover { background: #f3f3f3; }

.ai-page .qty {
    width: 46px;
    height: 40px;
    border: 0;
    border-left: 1px solid var(--ai-border);
    border-right: 1px solid var(--ai-border);
    text-align: center;
    font-size: 14px;
    font-family: var(--ai-sans);
    color: var(--ai-ink);
    -moz-appearance: textfield;
}
.ai-page .qty::-webkit-outer-spin-button,
.ai-page .qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── ADD / TRY ON BUTTON ─────────────────────────────────── */
.ai-page .add-btn {
    width: 100%;
    height: 54px;
    margin-top: 4px;
    border-radius: 10px;
    background: var(--ai-accent);
    color: #fff;
    font-family: var(--ai-sans);
    font-size: 13px;
    letter-spacing: .14em;
    text-transform: uppercase;
    font-weight: 700;
    border: 0;
    cursor: pointer;
    transition: background .2s, transform .2s, box-shadow .2s;
}
.ai-page .add-btn:hover {
    background: #2c2c2c;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(0,0,0,.18);
}

/* ── AI STYLIST NOTE ─────────────────────────────────────── */
.ai-page .stylist-note {
    margin-top: 20px;
    background: linear-gradient(135deg, #faf7f3 0%, #f5f1ea 100%);
    border: 1px solid rgba(194,138,85,.25);
    border-radius: 14px;
    padding: 16px 18px;
}
.ai-page .stylist-note-head {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--ai-gold);
    margin-bottom: 8px;
}
.ai-page .stylist-note-body {
    font-size: 13px;
    line-height: 1.6;
    color: var(--ai-ink-mid);
}

/* ── RIGHT PANEL ─────────────────────────────────────────── */
.ai-page .ai-right-panel {
    background: transparent;
}

.ai-page .right-head {
    margin-bottom: 18px;
}

.ai-page .right-head-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.ai-page .breadcrumb {
    font-size: 12px;
    color: var(--ai-ink-mid);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ai-page .breadcrumb a { color: var(--ai-ink-mid); text-decoration: none; }
.ai-page .breadcrumb a:hover { color: var(--ai-ink); }
.ai-page .breadcrumb span { color: var(--ai-ink-light); }

.ai-page .shop-link {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ai-ink-mid);
    border-bottom: 1px solid var(--ai-border-mid);
    padding-bottom: 2px;
    text-decoration: none;
    white-space: nowrap;
    transition: color .2s;
}
.ai-page .shop-link:hover { color: var(--ai-ink); }

.ai-page .grid-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
}
.ai-page .grid-count {
    font-size: 14px;
    font-weight: 500;
    color: var(--ai-ink-light);
    margin-left: 4px;
}

/* ── PRODUCT GRID ────────────────────────────────────────── */
.ai-page .product-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.ai-page .product-card {
    position: relative;
    background: var(--ai-card);
    border: 1px solid var(--ai-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform .25s ease, box-shadow .25s ease, border-color .2s ease;
}
.ai-page .product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(0,0,0,.08);
}
.ai-page .product-card.active {
    border-color: var(--ai-ink);
    box-shadow: 0 0 0 2px rgba(0,0,0,.06), 0 14px 34px rgba(0,0,0,.07);
}

.ai-page .product-card .wish-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--ai-border);
    font-size: 15px;
    color: var(--ai-ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .2s;
}
.ai-page .product-card .wish-btn:hover { color: #e0556f; }

.ai-page .card-img {
    aspect-ratio: 3 / 4;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.ai-page .card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    transition: transform .4s cubic-bezier(.22,1,.36,1);
    display: block;
}
.ai-page .product-card:hover .card-img img { transform: scale(1.04); }

.ai-page .card-body { padding: 14px; }

.ai-page .card-body h3 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 6px;
    min-height: 20px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.ai-page .card-price {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--ai-ink);
}

.ai-page .try-btn {
    font-family: var(--ai-sans);
    height: 38px;
    padding: 0 22px;
    border-radius: 8px;
    background: var(--ai-accent);
    color: #fff;
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    font-weight: 700;
    border: 0;
    cursor: pointer;
    transition: background .2s;
}



.ai-page .try-btn:hover { background: #2c2c2c; }



/* ============================================================
   APPEND THIS TO THE END OF ai-tryon.css
   AI-chat typewriter caret for the product description + stylist note.
   (Bump the stylesheet version in product.php to ?v=9 — already done.)
============================================================ */

/* Blinking caret while text types out — uses the gold accent token. */
.ai-page .product-desc.typing::after,
.ai-page .stylist-note-body.typing::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 2px;
    vertical-align: -2px;
    background: var(--ai-gold);
    animation: aiCaretBlink .7s steps(1) infinite;
}
@keyframes aiCaretBlink { 50% { opacity: 0; } }

/* Stop the note box collapsing before text arrives, so the panel
   doesn't jump as the note types in. */
.ai-page .stylist-note-body { min-height: 1.6em; }

/* Accessibility: users who prefer reduced motion get instant text,
   no blinking caret (the JS also shows text instantly for them). */
@media (prefers-reduced-motion: reduce) {
    .ai-page .product-desc.typing::after,
    .ai-page .stylist-note-body.typing::after { display: none; animation: none; }
}

/* ── TOAST ───────────────────────────────────────────────── */
.ai-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    background: #111;
    color: #fff;
    padding: 13px 20px;
    border-radius: 999px;
    font-size: 13px;
    font-family: var(--ai-sans);
    box-shadow: 0 18px 45px rgba(0,0,0,.18);
    opacity: 0;
    transform: translateY(18px);
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease;
}
.ai-toast.show { opacity: 1; transform: translateY(0); }

/* ── RESPONSIVE ──────────────────────────────────────────── */

/* Laptop */
@media (max-width: 1280px) {
    .ai-page .ai-layout { grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); gap: 18px; }
    .ai-page .detail-grid { grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 18px; }
    .ai-page .product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* Stack the two main columns (detail | grid) */
@media (max-width: 1024px) {
    .ai-page .ai-layout { grid-template-columns: 1fr; }
    .ai-page .ai-left-panel { position: static; margin-bottom: 18px; }
    .ai-page .product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* Stack the detail-grid itself (image over details) on smaller widths */
@media (max-width: 760px) {
    .ai-page .detail-grid { grid-template-columns: 1fr; }
    .ai-page .detail-media { position: static; max-width: 420px; margin: 0 auto; width: 100%; }
}

/* Phone */
@media (max-width: 600px) {
    .ai-page { padding: 12px; }
    .ai-page .ai-left-panel { padding: 14px; }
    .ai-page .gallery { max-width: 100%; }
    .ai-page .product-name { font-size: 19px; }
    .ai-page .grid-title { font-size: 21px; }
    .ai-page .right-head-top { flex-direction: column; align-items: flex-start; gap: 8px; }
    .ai-page .product-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
    .ai-page .card-body { padding: 10px; }
    .ai-page .card-body h3 { font-size: 13px; }
    .ai-page .try-btn { width: 100%; padding: 0; }
}

/* Tiny phones */
@media (max-width: 380px) {
    .ai-page .product-grid { grid-template-columns: 1fr; }
}