/**
 * Product Visualization - Camera Styles
 * Camera view, door guide overlay, controls
 */

/* ===== Camera Container ===== */
.pv-camera-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: #000;
    border-radius: var(--pv-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 380px;
}

.pv-camera-video-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 320px;
    overflow: hidden;
}

.pv-camera-video {
    width: 100%;
    height: 100%;
    min-height: 320px;
    object-fit: contain;
    display: block;
    background: #000;
}

/* ===== Camera Overlay ===== */
.pv-camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

/* ===== Door Guide ===== */
.pv-door-guide {
    position: relative;
    z-index: 1;
    --guide-height: 176px;
    --guide-width: 80px;
    width: var(--guide-width);
    height: var(--guide-height);
    border: 3px solid rgba(255, 255, 255, 0.95);
    border-radius: var(--pv-radius-sm);
    background: transparent;
    box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.5);
    transition: width 0.2s ease, height 0.2s ease;
}

/* ===== Corner Markers ===== */
.pv-door-guide-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--pv-primary);
    border-style: solid;
    border-width: 0;
}

.pv-door-guide-corner.tl {
    top: -3px;
    left: -3px;
    border-top-width: 4px;
    border-left-width: 4px;
    border-top-left-radius: 4px;
}

.pv-door-guide-corner.tr {
    top: -3px;
    right: -3px;
    border-top-width: 4px;
    border-right-width: 4px;
    border-top-right-radius: 4px;
}

.pv-door-guide-corner.bl {
    bottom: -3px;
    left: -3px;
    border-bottom-width: 4px;
    border-left-width: 4px;
    border-bottom-left-radius: 4px;
}

.pv-door-guide-corner.br {
    bottom: -3px;
    right: -3px;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-bottom-right-radius: 4px;
}

/* ===== Guide Label ===== */
.pv-door-guide-label {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(202, 0, 15, 0.9);
    color: var(--pv-white);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: var(--pv-radius-sm);
    white-space: nowrap;
}

/* ===== Camera Hint ===== */
.pv-camera-hint {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: var(--pv-white);
    padding: 10px 16px;
    border-radius: var(--pv-radius);
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--pv-shadow-sm);
    z-index: 15;
}

.pv-camera-hint i {
    color: var(--pv-primary);
}

/* ===== Rotate Hint (Mobile) ===== */
.pv-camera-rotate-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: rgba(255, 255, 255, 0.9);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.65rem;
    display: none;
    align-items: center;
    gap: 6px;
    z-index: 15;
}

.pv-camera-rotate-hint i {
    font-size: 0.9rem;
    animation: pvRotateHintPulse 2s ease-in-out infinite;
}

@keyframes pvRotateHintPulse {
    0%, 100% { transform: rotate(0deg); opacity: 1; }
    50% { transform: rotate(15deg); opacity: 0.7; }
}

/* ===== Camera Controls ===== */
.pv-camera-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    padding: 20px;
    background: #1a1a1a;
    border-top: 1px solid #333;
    flex-shrink: 0;
    position: relative;
    z-index: 20;
}

/* ===== Capture Button ===== */
.pv-capture-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--pv-white);
    border: 4px solid var(--pv-primary);
    cursor: pointer;
    transition: all var(--pv-transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px var(--pv-primary-shadow);
}

.pv-capture-btn:hover {
    transform: scale(1.08);
    background: var(--pv-white);
    box-shadow: 0 6px 20px rgba(202, 0, 15, 0.5);
}

.pv-capture-btn:active {
    transform: scale(0.95);
}

.pv-capture-btn i {
    font-size: 1.8rem;
    color: var(--pv-primary);
}

/* ===== Cancel Button ===== */
.pv-camera-cancel-btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    border-radius: var(--pv-radius);
    cursor: pointer;
    transition: all var(--pv-transition-fast);
    font-weight: 500;
}

.pv-camera-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    color: var(--pv-white);
}

/* ===== Camera Error ===== */
.pv-camera-error {
    padding: 40px;
    text-align: center;
    color: var(--pv-gray-600);
    background: var(--pv-gray-50);
    border-radius: var(--pv-radius);
}

.pv-camera-error i {
    font-size: 3rem;
    color: var(--pv-primary);
    opacity: 0.5;
    margin-bottom: 15px;
    display: block;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    /* Fullscreen camera mode */
    #pv-visualization-drawer.camera-active .drawer-container {
        margin: 0;
        max-width: 100%;
        width: 100%;
        height: 100vh;
        height: 100dvh;
    }

    #pv-visualization-drawer.camera-active .drawer-container {
        height: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }

    #pv-visualization-drawer.camera-active .drawer-header {
        display: none;
    }

    #pv-visualization-drawer.camera-active .drawer-footer {
        display: none;
    }

    #pv-visualization-drawer.camera-active .drawer-content {
        padding: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #pv-visualization-drawer.camera-active #pvCameraSection {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
    }

    #pv-visualization-drawer.camera-active .pv-camera-container {
        flex: 1;
        display: flex;
        flex-direction: column;
        border-radius: 0;
        background: #000;
        min-height: 0;
    }

    #pv-visualization-drawer.camera-active .pv-camera-video-wrapper {
        flex: 1;
        min-height: 0;
    }

    #pv-visualization-drawer.camera-active .pv-camera-video {
        width: 100%;
        height: 100%;
        object-fit: contain;
        background: #000;
    }

    /* Show rotate hint on mobile */
    .pv-camera-rotate-hint {
        display: flex;
        bottom: 140px;
    }

    /* Center door guide above drawer */
    #pv-visualization-drawer.camera-active .pv-camera-overlay {
        padding-bottom: 130px;
    }

    /* Bottom drawer panel */
    #pv-visualization-drawer.camera-active .pv-camera-controls {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1050;
        background: var(--pv-white);
        border-top: none;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
        padding: 20px 24px;
        padding-bottom: max(24px, calc(20px + env(safe-area-inset-bottom, 0px)));
        gap: 24px;
    }

    .pv-capture-btn {
        width: 72px;
        height: 72px;
        border-width: 5px;
        background: var(--pv-white);
        border-color: var(--pv-primary);
        box-shadow: 0 4px 20px rgba(202, 0, 15, 0.35);
    }

    .pv-capture-btn i {
        font-size: 1.8rem;
        color: var(--pv-primary);
    }

    .pv-camera-cancel-btn {
        padding: 14px 28px;
        font-size: 0.95rem;
        background: #f5f5f5;
        border: 1px solid #ddd;
        color: #333;
        border-radius: 10px;
        font-weight: 500;
    }

    .pv-camera-cancel-btn:hover {
        background: #eee;
    }

    .pv-camera-hint {
        top: max(12px, env(safe-area-inset-top));
        font-size: 0.75rem;
        padding: 8px 14px;
    }

    .pv-camera-error {
        margin: 20px;
        padding: 30px 20px;
    }

    .pv-camera-error i {
        font-size: 2.5rem;
    }
}

/* ===== Landscape Mode ===== */
@media (max-width: 768px) and (orientation: landscape) {
    #pv-visualization-drawer.camera-active .pv-camera-container {
        flex-direction: row;
    }

    #pv-visualization-drawer.camera-active .pv-camera-video-wrapper {
        flex: 1;
        height: 100%;
    }

    #pv-visualization-drawer.camera-active .pv-camera-overlay {
        padding-bottom: 0;
        padding-right: 120px;
    }

    /* Right side drawer */
    #pv-visualization-drawer.camera-active .pv-camera-controls {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: auto;
        min-width: 110px;
        height: 100%;
        flex-direction: column;
        z-index: 1050;
        background: var(--pv-white);
        border-radius: 20px 0 0 20px;
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.25);
        padding: 24px 20px;
        padding-right: max(20px, calc(20px + env(safe-area-inset-right, 0px)));
        gap: 20px;
    }

    .pv-capture-btn {
        width: 68px;
        height: 68px;
        background: var(--pv-white);
        border-color: var(--pv-primary);
        box-shadow: 0 4px 20px rgba(202, 0, 15, 0.35);
    }

    .pv-capture-btn i {
        font-size: 1.6rem;
        color: var(--pv-primary);
    }

    .pv-camera-cancel-btn {
        padding: 12px 20px;
        font-size: 0.85rem;
        background: #f5f5f5;
        border: 1px solid #ddd;
        color: #333;
        border-radius: 10px;
    }

    /* Hide rotate hint in landscape */
    .pv-camera-rotate-hint {
        display: none;
    }

    .pv-camera-hint {
        top: 8px;
        left: 8px;
        transform: none;
        font-size: 0.7rem;
        padding: 6px 10px;
    }
}
