/* ============================================
   PWA CAMERA BOOTH - Frontend Styles
   ============================================ */

* {
    box-sizing: border-box;
}

.pwa-camera-booth-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* Camera Container */
.camera-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 9/16;
    max-height: 100vh;
}

/* Video Element */
#camera-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror cho selfie camera */
}

/* Khung overlay */
.frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.frame-overlay img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* Camera Controls */
.camera-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Frame Selector */
.frame-selector {
    width: 100%;
}

.frame-selector label {
    display: block;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.frame-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 8px 0;
    scroll-behavior: smooth;
}

.frame-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.frame-thumbnails::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.frame-thumbnails::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.5);
    border-radius: 2px;
}

.frame-thumb-btn {
    flex: 0 0 auto;
    width: 70px;
    height: 100px;
    border: 2px solid transparent;
    background: #333;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.frame-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.frame-thumb-btn:hover {
    border-color: #fff;
    transform: scale(1.05);
}

.frame-thumb-btn.active {
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.frame-loading {
    color: #fff;
    font-size: 13px;
    text-align: center;
    padding: 20px;
    opacity: 0.7;
}

.frame-error {
    color: #ff6b6b;
    font-size: 13px;
    padding: 15px;
    background: rgba(255,0,0,0.1);
    border-radius: 6px;
}

/* Camera Toggle */
.camera-toggle {
    text-align: right;
}

#toggle-camera-btn {
    padding: 8px 12px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    border-radius: 6px;
    font-size: 12px;
    transition: all 0.3s ease;
}

#toggle-camera-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

/* Capture Button Container */
.capture-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.btn-capture {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    padding: 0;
    min-width: 80px;
    flex-direction: column;
    font-size: 12px;
}

.btn-capture .capture-icon {
    font-size: 28px;
}

.btn-capture .capture-text {
    font-size: 10px;
    text-transform: none;
    letter-spacing: 0;
}

.btn-capture:hover:not(:disabled) {
    width: 88px;
    height: 88px;
}

/* Status Message */
.status-message {
    color: #fff;
    font-size: 13px;
    text-align: center;
    min-height: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.status-message.show {
    opacity: 1;
}

.status-message.success {
    color: #4CAF50;
}

.status-message.error {
    color: #ff6b6b;
}

.status-message.loading {
    color: #FFB81C;
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 768px) {
    .camera-controls {
        padding: 15px;
        gap: 12px;
    }

    .frame-thumbnails {
        gap: 8px;
    }

    .frame-thumb-btn {
        width: 60px;
        height: 85px;
    }

    .btn-capture {
        width: 70px;
        height: 70px;
    }

    .btn-capture .capture-icon {
        font-size: 24px;
    }

    .btn-capture:hover:not(:disabled) {
        width: 76px;
        height: 76px;
    }
}

@media (max-width: 480px) {
    .frame-selector label {
        font-size: 12px;
    }

    .btn-capture {
        width: 65px;
        height: 65px;
    }

    .btn-capture .capture-icon {
        font-size: 22px;
    }

    .btn-capture .capture-text {
        font-size: 9px;
    }
}

/* Camera Switching Animation */
#camera-video.switching {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

#camera-video.switching.active {
    opacity: 1;
}
