﻿/* ============================================================
   CAMERA CARD — Draggable camera preview (compact)
   File: camera-card.css
   ============================================================ */

#cameraCard {
    position: absolute;
    top: 80px;
    right: 20px;
    /* Compact: 140px - 200px */
    width: clamp(140px, 15vw, 200px);
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 99999;
    user-select: none;
    overflow: hidden;
    backdrop-filter: blur(6px);
    transition: box-shadow 0.2s ease;
}

    #cameraCard.dragging {
        box-shadow: 0 12px 48px rgba(0, 255, 255, 0.4);
        cursor: grabbing;
    }

#cameraCardHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    background: linear-gradient(90deg, #1e3c72, #2a5298);
    cursor: grab;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    touch-action: none;
}

    #cameraCardHeader:active {
        cursor: grabbing;
    }

.camera-title {
    display: flex;
    align-items: center;
    gap: 4px;
}

.camera-controls {
    display: flex;
    gap: 3px;
}

.cam-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s;
    padding: 0;
}

    .cam-btn:hover {
        background: rgba(255, 255, 255, 0.35);
    }

    .cam-btn.active {
        background: #28a745;
    }

#cameraCardBody {
    position: relative;
    width: 100%;
    height: 100%;
    aspect-ratio: 4 / 3;
    background: #000;
}

#cameraPreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(1);
    transition: transform 0.2s ease;
}

    #cameraPreview.mirrored {
        transform: scaleX(-1);
    }

.camera-error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ff6b6b;
    font-size: 10px;
    text-align: center;
    padding: 8px;
    gap: 4px;
}

    .camera-error i {
        font-size: 18px;
    }

/* ============================================================
   RESPONSIVE — Mobile (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    #cameraCard {
        width: clamp(120px, 38vw, 180px);
        top: 60px;
        right: 10px;
        border-radius: 10px;
        height: 180px;
    }

    #cameraCardHeader {
        padding: 4px 7px;
        font-size: 10px;
    }

    .cam-btn {
        width: 18px;
        height: 18px;
        font-size: 9px;
    }

    .camera-error i {
        font-size: 16px;
    }

    .camera-error {
        font-size: 9px;
    }
}

/* ============================================================
   RESPONSIVE — Small Mobile (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
    #cameraCard {
        width: clamp(110px, 42vw, 160px);
        top: 50px;
        right: 8px;
        height: 160px;
    }
}

/* ============================================================
   RESPONSIVE — Landscape mobile (tinggi ≤ 500px)
   ============================================================ */
@media (max-height: 500px) {
    #cameraCard {
        width: clamp(110px, 14vw, 160px);
        top: 40px;
        right: 8px;
        height: 160px;
    }
}
