/**
 * CAMERA INTERFACE STYLES
 * ----------------------
 * Styles specific to the camera/upload functionality
 */

/* Base container for the upload interface */
.upload-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Camera container */
#camera-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: #000;
    z-index: 1;
    display: none;
}

#camera-container.active {
    display: block;
}

#camera-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-preview-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.camera-preview-container video {
    position: absolute;
    top: 0;
    left: 0;
}

.freeze-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
}

/* Upload container */
#upload-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#upload-container.active {
    display: flex;
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ccc;
    border-radius: 8px;
    height: 200px;
    width: 100%;
    max-width: 400px;
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
}

.upload-label span {
    color: #333;
    margin-bottom: 8px;
}

#photo-upload {
    display: none;
}

/* Camera/Upload toggle */
.camera-upload-toggle {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    border-radius: 24px;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.camera-upload-toggle button {
    padding: 8px 16px;
    border: none;
    background: none;
    color: #fff;
    cursor: pointer;
}

.camera-upload-toggle button.active {
    background-color: #0066cc;
}

/* Camera Capture Button */
.capture-btn {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    border: 3px solid white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.capture-btn::before {
    content: '';
    display: block;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background-color: white;
    transition: all 0.3s ease;
}

/* Recording state */
.capture-btn.recording {
    border-color: #FF3B30;
}

.capture-btn.recording::before {
    width: 52px;
    height: 52px;
    background-color: #FF3B30;
}

.capture-btn.pressing {
    transform: translateX(-50%) scale(0.95);
}

/* Camera switch button */
.camera-switch-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    border: 2px solid white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    padding: 0;
    touch-action: manipulation;
}

/* Error message */
.error-message {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    background-color: rgba(255, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    max-width: 80%;
    text-align: center;
}

/* Video recording styles */
.video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.recording-time {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: white;
    margin-left: 8px;
}

@keyframes blink {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.recording-dot {
    width: 12px;
    height: 12px;
    background-color: #ff3b30;
    border-radius: 50%;
    margin-right: 8px;
    animation: blink 1s infinite;
}

.recording-indicators {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
}

.recording-status {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 4px;
}

.recording-progress-ring {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    border-radius: 50%;
    z-index: 9;
}

.recording-progress-ring::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background: conic-gradient(var(--progress-color) var(--progress-percent), transparent 0);
    transform: rotate(-90deg);
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000; /* Above all editor UI (2010) and modals (2000-2003) */
}

.spinner-circle {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .camera-upload-toggle {
        top: 10px;
    }

    .capture-btn {
        bottom: 90px;
    }

    .camera-switch-btn {
        top: 10px;
        right: 10px;
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
}