/* ============================================
   AR Page Styles — Love Generation Design
   ============================================ */

#ar-root {
    --pink: #F9A4CB;
    --pink-dark: #F48DB8;
    --yellow: #FFDD9A;
    --yellow-warm: #FADF85;
    --orange: #F9AB66;
    --purple: #CB8BEB;
    --purple-card: #A3A3FB;
    --blue-gray: #C8DDE6;
    --white: #FFFFFF;

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Commissioner', sans-serif;

    --radius-card: 24px;
    --radius-card-lg: 32px;
    --radius-btn: 100px;

    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --transition: 0.3s ease;

    position: fixed;
    inset: 0;
    background: #000;
    overflow: hidden;
    font-family: var(--font-body);
    color: var(--text-primary);
}

#ar-container {
    position: absolute;
    inset: 0;
    z-index: 1;
}

#ar-container video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#ar-container canvas {
    position: absolute;
    inset: 0;
    z-index: 2;
}

.hidden { display: none !important; }

/* ============ Buttons (matching landing) ============ */

.btn {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    gap: 10px;
    border: none;
    border-radius: var(--radius-btn);
    font-family: var(--font-heading);
    font-style: italic;
    font-weight: 800;
    font-size: 14px;
    line-height: 17px;
    text-align: center;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn--purple {
    background: var(--purple);
    color: var(--white);
    box-shadow: 0 0 12px var(--purple);
}

.btn--white {
    background: var(--white);
    color: var(--purple);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

.btn--outline {
    background: transparent;
    color: var(--white);
    border: 1.5px solid rgba(255, 255, 255, 0.5);
}

.btn--outline:active {
    background: rgba(255, 255, 255, 0.1);
}

.btn--full { width: 100%; }

/* ============ Scan overlay ============ */

.scan-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scan-frame {
    position: relative;
    width: 78px;
    height: 355px;
    transition: box-shadow 0.4s, border-color 0.4s;
}

.scan-frame::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 10px;
    box-shadow: 0 0 0 200vmax rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: -1;
}

.scan-corner {
    position: absolute;
    width: 36px;
    height: 36px;
    border-color: var(--pink);
    border-style: solid;
}

.scan-corner.tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 8px 0 0 0; }
.scan-corner.tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 8px 0 0; }
.scan-corner.bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 8px; }
.scan-corner.br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 8px 0; }

.product-mask-img {
    position: absolute;
    inset: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    object-fit: contain;
    opacity: 0.30;
    mix-blend-mode: screen;
    pointer-events: none;
    filter: brightness(1.2);
    transition: opacity 0.35s, filter 0.35s;
    animation: maskPulse 3s ease-in-out infinite;
}

@keyframes maskPulse {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 0.38; }
}

.scan-seam {
    position: absolute;
    left: 8px;
    right: 8px;
    top: 34%;
    height: 1px;
    background: var(--pink);
    opacity: 0.35;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(249, 164, 203, 0.3);
    transition: opacity 0.35s;
}

.scan-frame.aligned .product-mask-img {
    opacity: 0.55;
    filter: brightness(1.6) drop-shadow(0 0 14px rgba(249, 164, 203, 0.5));
    animation: none;
}

.scan-frame.aligned .scan-seam {
    background: var(--yellow);
    opacity: 0.55;
    box-shadow: 0 0 8px rgba(255, 221, 154, 0.4);
}

.scan-frame.aligned .scan-corner {
    border-color: var(--yellow);
    filter: drop-shadow(0 0 6px rgba(255, 221, 154, 0.4));
    transition: border-color 0.3s, filter 0.3s;
}

.scan-hint {
    margin-top: 32px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    text-transform: uppercase;
    animation: pulse 2s ease-in-out infinite;
    transition: color 0.3s, text-shadow 0.3s;
    min-height: 1.4em;
}

.scan-hint.hint-warn {
    color: var(--yellow);
    text-shadow: 0 0 10px rgba(255, 221, 154, 0.3), 0 1px 4px rgba(0, 0, 0, 0.6);
    animation: hintPulseWarn 1.5s ease-in-out infinite;
}

.scan-hint.hint-ok {
    color: var(--pink);
    text-shadow: 0 0 12px rgba(249, 164, 203, 0.35), 0 1px 4px rgba(0, 0, 0, 0.6);
    animation: none;
}

@keyframes hintPulseWarn {
    0%, 100% { opacity: 0.75; }
    50% { opacity: 1; }
}

.scan-sub-hint {
    margin-top: 8px;
    font-family: var(--font-body);
    font-size: 0.72rem;
    color: var(--text-secondary);
    text-align: center;
    text-transform: uppercase;
    opacity: 0.55;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* ============ Status bar ============ */

.status-bar {
    position: absolute;
    top: env(safe-area-inset-top, 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-btn);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    text-transform: uppercase;
    max-width: 92vw;
    margin-top: 12px;
    transition: all 0.4s ease;
    text-align: center;
    background: rgba(249, 164, 203, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(249, 164, 203, 0.3);
}

.status-bar.found {
    background: rgba(255, 221, 154, 0.2);
    border-color: rgba(255, 221, 154, 0.4);
}

/* ============ Prediction card ============ */

.prediction-card {
    position: absolute;
    bottom: 20px;
    left: 16px;
    right: 16px;
    z-index: 20;
    padding: 20px;
    text-align: center;
    border-radius: var(--radius-card-lg);
    transform: translateY(calc(100% + 140px));
    opacity: 0;
    transition:
        transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.4s ease;
    background: var(--white);
    box-shadow: 0 0 24px rgba(249, 164, 203, 0.3);
}

.prediction-card.visible {
    transform: translateY(0);
    opacity: 1;
}

.prediction-card__icon {
    display: none;
}

.prediction-text {
    display: none;
}

.prediction-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.prediction-card .btn--outline {
    color: var(--purple);
    border-color: var(--purple);
}

.prediction-card .btn--outline:active {
    background: rgba(203, 139, 235, 0.1);
}

/* ============ Loading ============ */

.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse 65.93% 76.96% at 68.67% 50%, #FFDD9A 39%, #F9A4CB 77%),
        radial-gradient(ellipse 158.36% 155.15% at 73.93% 61.19%, #FFDD9A 14%, #42ACF0 28%, #DC89E3 53%),
        radial-gradient(ellipse 100% 160.38% at 50% 0%, #FFDD9A 17%, #A7C9F7 38%, #A7C9F7 59%, #F9A4CB 85%);
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: min(280px, 80vw);
}

.loading-logo {
    height: 180px;
    width: auto;
    object-fit: contain;
    margin-bottom: 10px;
}

.loading-icon {
    position: relative;
    width: 76px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: octoBob 2s ease-in-out infinite;
}

@keyframes octoBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.octopus-loader {
    width: 76px;
    height: 68px;
}

.loading-stage {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--white);
    text-align: center;
    min-height: 1.3em;
    transition: opacity 0.25s;
}

.loading-bar-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--white);
    border-radius: 100px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.loading-percent {
    font-family: var(--font-heading);
    font-style: italic;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.03em;
    text-transform: uppercase;
    color: var(--white);
    opacity: 0.8;
}

/* ============ Error overlay ============ */

.error-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(ellipse 65.93% 76.96% at 68.67% 50%, #FFDD9A 39%, #F9A4CB 77%),
        radial-gradient(ellipse 158.36% 155.15% at 73.93% 61.19%, #FFDD9A 14%, #42ACF0 28%, #DC89E3 53%),
        radial-gradient(ellipse 100% 160.38% at 50% 0%, #FFDD9A 17%, #A7C9F7 38%, #A7C9F7 59%, #F9A4CB 85%);
}

.error-card {
    background: var(--white);
    border-radius: var(--radius-card-lg);
    box-shadow: 0 0 12px var(--white);
    padding: 40px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 340px;
    width: 100%;
}

.error-card h3 {
    font-family: var(--font-heading);
    font-style: italic;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.03em;
    color: var(--pink);
}

.error-card p {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--pink);
    line-height: 18.2px;
    text-transform: uppercase;
}

/* ============ Tap instruction ============ */

.tap-hint {
    position: absolute;
    bottom: 180px;
    left: 0;
    right: 0;
    z-index: 15;
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    pointer-events: none;
    animation: pulse 2s ease-in-out infinite;
}

/* ============ Tap ripple ============ */

.tap-ripple {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid var(--pink);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 15;
    animation: rippleOut 0.7s ease-out forwards;
}

@keyframes rippleOut {
    0% { width: 10px; height: 10px; opacity: 1; }
    100% { width: 100px; height: 100px; opacity: 0; }
}
