/* === WC AR Preview — Styles === */

/* Launch button */
.wcar-launch-wrap {
    margin: 16px 0 8px;
}

.wcar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 13px 22px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    width: 100%;
    justify-content: center;
}

.wcar-btn:hover {
    background: #16213e;
    transform: translateY(-1px);
}

.wcar-hint {
    font-size: 12px;
    color: #888;
    margin: 6px 0 0;
    text-align: center;
}

/* === Full-screen AR Overlay === */
.wcar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #000;
    flex-direction: column;
    overflow: hidden;
}

.wcar-overlay.wcar-active {
    display: flex;
}

/* Video fills screen */
#wcar-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#wcar-canvas {
    display: none; /* used for snapshot only */
}

/* Top bar */
.wcar-topbar {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    background: linear-gradient(to bottom, rgba(0,0,0,.7), transparent);
}

.wcar-topbar-title {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .5px;
}

.wcar-close-btn {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}

.wcar-close-btn:hover {
    background: rgba(255,255,255,.3);
}

/* === Reticle (crosshair / viewfinder bracket) === */
.wcar-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    pointer-events: none;
    z-index: 5;
}

/* Corner brackets drawn with box-shadow trick */
.wcar-reticle::before,
.wcar-reticle::after,
.wcar-reticle-inner::before,
.wcar-reticle-inner::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: rgba(255,255,255,.85);
    border-style: solid;
}

/* Top-left */
.wcar-reticle::before {
    top: 0; left: 0;
    border-width: 3px 0 0 3px;
    border-radius: 3px 0 0 0;
}

/* Top-right */
.wcar-reticle::after {
    top: 0; right: 0;
    border-width: 3px 3px 0 0;
    border-radius: 0 3px 0 0;
}

/* Bottom-left */
.wcar-reticle-inner::before {
    bottom: 0; left: 0;
    border-width: 0 0 3px 3px;
    border-radius: 0 0 0 3px;
}

/* Bottom-right */
.wcar-reticle-inner::after {
    bottom: 0; right: 0;
    border-width: 0 3px 3px 0;
    border-radius: 0 0 3px 0;
}

/* === Floating product ghost === */
.wcar-product-ghost {
    position: absolute;
    z-index: 8;
    touch-action: none;
    user-select: none;
    pointer-events: auto;
    /* starts centred, JS will reposition on drag */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none; /* shown after camera starts */
    filter: drop-shadow(0 8px 24px rgba(0,0,0,.55));
}

.wcar-product-ghost img {
    display: block;
    width: 180px;
    height: auto;
    max-height: 280px;
    object-fit: contain;
    /* subtle perspective shadow overlay */
    filter: drop-shadow(0 16px 12px rgba(0,0,0,.4));
}

.wcar-ghost-label {
    text-align: center;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0,0,0,.5);
    border-radius: 4px;
    padding: 2px 8px;
    margin-top: 4px;
    letter-spacing: .3px;
}

/* === Floor shadow under ghost === */
.wcar-product-ghost::after {
    content: '';
    display: block;
    width: 80%;
    height: 18px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,.45) 0%, transparent 70%);
    margin: -8px auto 0;
    border-radius: 50%;
}

/* === Controls (bottom bar) === */
.wcar-controls {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 14px;
    z-index: 10;
}

.wcar-ctrl-btn {
    background: rgba(255,255,255,.18);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.25);
    color: #fff;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: background .2s, transform .15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wcar-ctrl-btn:hover {
    background: rgba(255,255,255,.32);
    transform: scale(1.08);
}

/* === Instructions chip === */
.wcar-instructions {
    position: absolute;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 13px;
    padding: 7px 16px;
    border-radius: 20px;
    white-space: nowrap;
    z-index: 10;
    transition: opacity .5s;
}

.wcar-instructions.wcar-fade {
    opacity: 0;
    pointer-events: none;
}

/* === Snapshot flash === */
@keyframes wcar-flash {
    0%   { opacity: 0; }
    20%  { opacity: 1; }
    100% { opacity: 0; }
}

.wcar-flash {
    position: absolute;
    inset: 0;
    background: #fff;
    z-index: 20;
    animation: wcar-flash .4s ease forwards;
    pointer-events: none;
}

/* === Toast notification === */
.wcar-toast {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30,200,100,.9);
    color: #fff;
    padding: 9px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    z-index: 20;
    animation: wcar-flash .3s ease, wcar-fadeout 2.5s 0.3s forwards;
    white-space: nowrap;
}

@keyframes wcar-fadeout {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

/* === WoodMart theme compatibility === */
.wdm-add-to-cart + .wcar-launch-wrap,
form.cart + .wcar-launch-wrap,
.cart-button-wrap + .wcar-launch-wrap {
    margin-top: 12px;
}

/* force visibility even if theme hides unknown elements */
#wcar-footer-inject .wcar-launch-wrap,
.wcar-launch-wrap {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* === Mobile tweaks === */
@media (max-width: 600px) {
    .wcar-reticle { width: 160px; height: 160px; }
    .wcar-product-ghost img { width: 140px; }
    .wcar-ctrl-btn { width: 46px; height: 46px; font-size: 18px; }
}

/* === Loading overlay === */
.wcar-loading {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 30;
    color: #fff;
    gap: 18px;
}

.wcar-spinner {
    width: 52px;
    height: 52px;
    border: 4px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wcar-spin 0.9s linear infinite;
}

@keyframes wcar-spin {
    to { transform: rotate(360deg); }
}

.wcar-loading p {
    font-size: 15px;
    font-weight: 500;
    margin: 0;
    opacity: .85;
}

/* === Ghost shadow === */
.wcar-ghost-shadow {
    width: 70%;
    height: 16px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,.4) 0%, transparent 70%);
    margin: -6px auto 0;
    border-radius: 50%;
}
