/* ==========================================
   Gangika Furniture - "View in My Room" (AR & Camera Room Placement)
   ========================================== */

/* Fullscreen Modal Backdrop */
.ar-room-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    background: rgba(10, 15, 25, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: none;
    flex-direction: column;
    overflow: hidden;
    color: #ffffff;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ar-room-modal.active {
    display: flex;
    animation: arModalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes arModalFadeIn {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

/* Modal Header Bar */
.ar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
}

.ar-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ar-title-badge {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ar-product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: #f8fafc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.ar-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ar-btn-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #cbd5e1;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.ar-btn-close:hover {
    background: rgba(239, 68, 68, 0.8);
    color: #ffffff;
    transform: rotate(90deg);
}

/* Tab Selector (Camera vs 3D) */
.ar-mode-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.4);
    padding: 3px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ar-tab-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
}

.ar-tab-btn.active {
    background: #d97706;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

/* AR Viewport Container */
.ar-viewport {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #020617;
}

/* Video & Canvas Elements */
#arCameraVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#arRoomCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    z-index: 5;
}

/* Model Viewer for 3D GLB/USDZ */
model-viewer.ar-3d-viewer {
    width: 100%;
    height: 100%;
    background-color: #0b1329;
    --poster-color: transparent;
}

/* Dimension Badge Overlay on Canvas */
.ar-dimension-badge {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(217, 119, 6, 0.4);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fbbf24;
    z-index: 8;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Floating Controls Footer Bar */
.ar-controls-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 640px;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 14px 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.ar-sliders-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ar-control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ar-control-label {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.ar-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #334155;
    outline: none;
}

.ar-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #f59e0b;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    transition: transform 0.1s ease;
}

.ar-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.ar-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.ar-btn-icon {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ar-btn-icon:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

.ar-btn-icon.active {
    background: rgba(217, 119, 6, 0.3);
    border-color: #d97706;
    color: #fbbf24;
}

.ar-btn-primary {
    background: linear-gradient(135deg, #d97706, #b45309);
    border: none;
    color: #ffffff;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
    transition: all 0.2s ease;
}

.ar-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(217, 119, 6, 0.6);
}

/* Camera Permission Prompt Overlay */
.ar-permission-prompt {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    background: rgba(15, 23, 42, 0.95);
    padding: 30px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    max-width: 400px;
    width: 90%;
    z-index: 15;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.ar-permission-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    color: #f59e0b;
}

.ar-permission-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.ar-permission-desc {
    font-size: 0.88rem;
    color: #94a3b8;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Snapshot Result Modal */
.ar-snapshot-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ar-snapshot-modal.active {
    display: flex;
}

.ar-snapshot-card {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    max-width: 520px;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.7);
}

.ar-snapshot-img-container {
    width: 100%;
    max-height: 360px;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ar-snapshot-img-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ar-snapshot-body {
    padding: 20px;
    text-align: center;
}

.ar-snapshot-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 6px;
}

.ar-snapshot-desc {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 18px;
}

.ar-snapshot-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Responsive Touch Adjustments */
@media (max-width: 640px) {
    .ar-controls-bar {
        bottom: 12px;
        padding: 12px 14px;
        gap: 10px;
    }
    
    .ar-sliders-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .ar-product-title {
        max-width: 160px;
        font-size: 0.95rem;
    }

    .ar-btn-icon {
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    .ar-btn-primary {
        padding: 8px 14px;
        font-size: 0.82rem;
    }
}
