/**
 * Artmatter AR Room Viewer & Desktop QR Code Experience
 */

/* ==========================================================================
   Desktop QR Modal Styles (Light Luxury Theme)
   ========================================================================== */
.premium-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 999999;
    padding: 20px;
    box-sizing: border-box;
}

.premium-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.premium-modal-content {
    background: #111114;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    width: 90%;
    max-width: 400px;
    padding: 36px 32px;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9);
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    font-family: "Neue Haas Display", "Neue Haas Grotesk Text Pro", inherit, sans-serif;
    color: #ffffff;
    box-sizing: border-box;
}

.premium-modal-overlay.open .premium-modal-content {
    transform: translateY(0) scale(1);
}

.premium-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #a1a1aa;
    transition: background 0.2s, transform 0.2s, color 0.2s;
}

.premium-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: scale(1.05);
}

.premium-qr-header {
    text-align: center;
    margin-bottom: 24px;
}

.premium-qr-badge {
    display: none;
}

.premium-qr-header h3 {
    margin: 0 0 8px;
    font-size: 22px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.premium-qr-header p {
    margin: 0;
    font-size: 13px;
    color: #a1a1aa;
    line-height: 1.5;
}

.premium-qr-wrapper {
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 28px;
    min-height: 220px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.premium-qr-wrapper canvas,
.premium-qr-wrapper img {
    border-radius: 8px;
    max-width: 100%;
}

.premium-qr-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.premium-qr-footer .step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    font-size: 12px;
    color: #d4d4d8;
    font-weight: 500;
    flex: 1;
}

.premium-qr-footer .step-num {
    width: 26px;
    height: 26px;
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    box-shadow: none;
}

/* ==========================================================================
   Mobile AR Camera Overlay & Stage
   ========================================================================== */
.ar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999999;
    background: #000000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.ar-overlay.active {
    visibility: visible;
    opacity: 1;
}

.camera-feed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.ar-stage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    overflow: hidden;
    touch-action: none;
    perspective: 1200px;
}

.poster-ar-element {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    max-width: 340px;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    transform-style: preserve-3d;
    will-change: transform;
}

.poster-ar-element img {
    width: 100%;
    height: auto;
    display: block;
    border: none !important;
    outline: none !important;
    border-radius: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), 0 1.5px 3px rgba(0, 0, 0, 0.35);
}

/* Top UI Bar */
.ar-ui-top {
    position: absolute;
    top: max(20px, env(safe-area-inset-top));
    left: 20px;
    right: 20px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ar-top-left-group,
.ar-top-right-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ar-format-pill {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #a9ff5d;
    background: rgba(12, 12, 16, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(169, 255, 93, 0.35);
    padding: 5px 10px;
    border-radius: 9999px;
    font-family: -apple-system, sans-serif;
    white-space: nowrap;
}

.ar-btn-native-launch {
    display: none; /* Displayed only on iOS devices via client-side check */
    align-items: center;
    gap: 5px;
    background: #a9ff5d;
    color: #08090b !important;
    font-weight: 800;
    font-size: 11px;
    border: none;
    border-radius: 9999px;
    padding: 5px 12px;
    cursor: pointer;
    box-shadow: 0 0 14px rgba(169, 255, 93, 0.45);
    transition: transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.ar-btn-native-launch:active {
    transform: scale(0.95);
}

/* Poster Element - Pure Frameless Archival Metal Poster (32x45cm) */
.poster-ar-element {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60%;
    max-width: 320px;
    aspect-ratio: 32 / 45;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    transform-style: preserve-3d;
    will-change: transform;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 2px 6px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}
.poster-ar-element.is-landscape {
    aspect-ratio: 45 / 32 !important;
}

.ar-btn-glass {
    background: rgba(14, 14, 18, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    -webkit-tap-highlight-color: transparent;
}

.ar-btn-glass:active {
    transform: scale(0.94);
    background: rgba(24, 24, 30, 0.9);
}

/* Instructions */
.ar-instructions {
    position: absolute;
    bottom: calc(140px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.ar-instructions-box {
    background: rgba(18, 18, 24, 0.6);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.38);
    padding: 8px 18px;
    border-radius: 50px;
    font-family: "Neue Haas Display", "Neue Haas Grotesk Text Pro", inherit, sans-serif;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 1px 1px rgba(255, 255, 255, 0.25);
}

/* Bottom Control Dock - Liquid Glassmorphism */
.ar-ui-bottom {
    position: absolute;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
    width: 92%;
    max-width: 380px;
}

.ar-bottom-dock {
    background: rgba(20, 20, 28, 0.52);
    backdrop-filter: blur(32px) saturate(200%);
    -webkit-backdrop-filter: blur(32px) saturate(200%);
    padding: 14px 18px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.6), inset 0 1px 2px rgba(255, 255, 255, 0.3), inset 0 -1px 2px rgba(0, 0, 0, 0.25);
}

.ar-sliders {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ar-slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ar-slider-label {
    color: rgba(255, 255, 255, 0.92);
    font-family: "Neue Haas Display", "Neue Haas Grotesk Text Pro", inherit, sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    width: 44px;
    text-align: left;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
}

.ar-sliders input[type=range] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.16);
    height: 5px;
    border-radius: 9999px;
    outline: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.ar-sliders input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #e2e8f0 65%, #cbd5e1 100%);
    cursor: pointer;
    border: 1.5px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 1px 1px #ffffff, 0 0 10px rgba(169, 255, 93, 0.4);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.ar-sliders input[type=range]::-webkit-slider-thumb:active {
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.7), 0 0 14px rgba(169, 255, 93, 0.7);
}

.ar-sliders input[type=range]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #e2e8f0 65%, #cbd5e1 100%);
    cursor: pointer;
    border: 1.5px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 1px 1px #ffffff, 0 0 10px rgba(169, 255, 93, 0.4);
}

.ar-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.ar-btn-capture {
    background: rgba(255, 255, 255, 0.92);
    color: #111111;
    border: 3px solid rgba(255, 255, 255, 0.35);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 2px #ffffff;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ar-btn-capture:active {
    transform: scale(0.92);
    background: #a9ff5d;
    border-color: rgba(169, 255, 93, 0.6);
}

/* Trigger Button Component */
.artmatter-ar-btn,
.view-in-your-room-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(18, 18, 22, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9999px;
    padding: 8px 16px;
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.artmatter-ar-btn:hover,
.view-in-your-room-btn:hover {
    background: rgba(28, 28, 34, 0.95);
    border-color: #a9ff5d;
    color: #a9ff5d;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), 0 0 16px rgba(169, 255, 93, 0.15);
}

.artmatter-ar-btn svg,
.view-in-your-room-btn svg {
    color: #a9ff5d;
    flex-shrink: 0;
}
