/* Camera Capture Styles */
:root {
    --primary-color: #007cba;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --error-color: #721c24;
    --border-radius: 8px;
    --transition-speed: 0.3s;
    --box-shadow-light: 0 2px 8px rgba(0, 124, 186, 0.2);
    --box-shadow-hover: 0 4px 12px rgba(0, 124, 186, 0.3);
}

#web-review-form {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    box-sizing: border-box;

    /* === BUTTON COMPONENTS === */
    .camera-capture-btn {
        color: white;
        border: none;
        padding: 14px 24px;
        border-radius: var(--border-radius);
        cursor: pointer;
        font-size: 16px;
        font-weight: 600;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        transition: all var(--transition-speed) ease;
        box-shadow: var(--box-shadow-light);
        text-decoration: none;
        position: relative;
        overflow: hidden;
    }

    .camera-capture-btn:hover {
        background: #005a8b;
        transform: translateY(-2px);
        box-shadow: var(--box-shadow-hover);
    }

    .camera-capture-btn:active {
        transform: translateY(0);
        box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    }

    .camera-capture-btn:focus {
        outline: none;
        box-shadow: var(--box-shadow-light), 0 0 0 3px rgba(0, 124, 186, 0.2);
    }

    /* === MODAL COMPONENTS === */
    .camera-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8);
        z-index: 10000;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        box-sizing: border-box;
    }

    .camera-modal-content {
        background: white;
        border-radius: var(--border-radius);
        padding: 20px;
        max-width: 600px;
        width: 100%;
        max-height: 90vh;
        overflow-y: auto;
        position: relative;
    }

    .camera-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        border-bottom: 1px solid #ddd;
        padding-bottom: 10px;
    }

    .camera-modal-header h3 {
        margin: 0;
        color: #333;
    }

    .camera-close {
        background: none;
        border: none;
        font-size: 24px;
        cursor: pointer;
        color: #666;
        padding: 0;
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: background-color var(--transition-speed) ease;
    }

    .camera-close:hover {
        background: #f0f0f0;
        color: #333;
    }

    /* === CAMERA COMPONENTS === */
    .camera-container {
        text-align: center;
        margin-bottom: 20px;
        background: #000;
        border-radius: var(--border-radius);
        overflow: hidden;
        position: relative;
        min-height: 200px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .camera-container video {
        width: 100%;
        height: auto;
        max-height: 400px;
        object-fit: cover;
    }

    .camera-container canvas {
        display: none;
    }

    .camera-controls {
        display: flex;
        justify-content: center;
        gap: 15px;
        flex-wrap: wrap;
        margin-bottom: 20px;
        align-items: center;
    }

    .camera-selector-container {
        display: flex;
        align-items: center;
        gap: 8px;
        background: #f8f9fa;
        padding: 8px 12px;
        border-radius: calc(var(--border-radius) - 3px);
        border: 1px solid #ddd;
    }

    .camera-selector-container label {
        font-weight: bold;
        color: #333;
        margin: 0;
        font-size: 14px;
    }

    .camera-selector {
        background: white;
        border: 1px solid #ccc;
        border-radius: calc(var(--border-radius) - 4px);
        padding: 6px 10px;
        font-size: 14px;
        color: #333;
        min-width: 180px;
        cursor: pointer;
        transition: border-color var(--transition-speed) ease;
    }

    .camera-selector:focus {
        outline: none;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
    }

    .camera-selector:hover {
        border-color: #999;
    }

    .camera-controls button:not(.camera-close) {
        background: #2563eb;
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: calc(var(--border-radius) - 3px);
        cursor: pointer;
        font-size: 14px;
        font-weight: bold;
        transition: all var(--transition-speed) ease;
        min-width: 120px;
    }

    .camera-controls button:not(.camera-close):hover {
        background: #1d4ed8;
        transform: translateY(-1px);
    }

    .camera-controls button:active {
        transform: translateY(0);
    }

    .camera-capture-photo {
        background: #2563eb !important;
        font-size: 16px;
        padding: 12px 20px;
    }

    .camera-capture-photo:hover {
        background: #1d4ed8 !important;
    }

    .camera-retake {
        background: #6b7280 !important;
        color: white !important;
    }

    .camera-retake:hover {
        background: #4b5563 !important;
    }

    .camera-use-photo {
        background: #2563eb !important;
    }

    .camera-use-photo:hover {
        background: #1d4ed8 !important;
    }

    .camera-preview {
        text-align: center;
        margin-bottom: 20px;
        background: #000;
        border-radius: var(--border-radius);
        overflow: hidden;
        position: relative;
        min-height: 200px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .camera-preview img {
        width: 100%;
        height: auto;
        max-height: 400px;
        object-fit: contain;
        border-radius: var(--border-radius);
    }

    /* === MESSAGE COMPONENTS === */
    .camera-error,
    .camera-success {
        margin: 10px 0;
        padding: 10px;
        border-radius: 4px;
        font-weight: bold;
    }

    .camera-error {
        color: var(--error-color);
        background: #f8d7da;
        border: 1px solid #f5c6cb;
    }

    .camera-success {
        color: #155724;
        background: #d4edda;
        border: 1px solid #c3e6cb;
    }

    /* === LOADING COMPONENTS === */
    .camera-loading {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 200px;
        color: white;
    }

    .camera-loading::after {
        content: '';
        width: 40px;
        height: 40px;
        border: 4px solid #f3f3f3;
        border-top: 4px solid var(--primary-color);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-top: 10px;
    }

    @keyframes spin {
        0% {
            transform: rotate(0deg);
        }

        100% {
            transform: rotate(360deg);
        }
    }

    /* === RESPONSIVE DESIGN === */
    @media (max-width: 768px) {
        .camera-modal {
            padding: 10px;
        }

        .camera-modal-content {
            padding: 15px;
            max-height: 95vh;
        }

        .camera-controls {
            flex-direction: column;
            align-items: center;
            gap: 10px;
        }

        .camera-selector-container {
            order: -1;
            width: 100%;
            max-width: 280px;
            justify-content: center;
        }

        .camera-selector {
            min-width: 160px;
            flex: 1;
        }

        .camera-controls button {
            width: 100%;
            max-width: 200px;
        }

        .camera-container {
            min-height: 250px;
        }

        .camera-modal-header h3 {
            font-size: 18px;
        }
    }

    @media (max-width: 480px) {
        .camera-modal-content {
            padding: 10px;
        }

        .camera-container {
            min-height: 200px;
        }

        .camera-modal-header,
        .camera-controls {
            margin-bottom: 15px;
        }

        .camera-selector-container {
            flex-direction: column;
            text-align: center;
            gap: 5px;
        }

        .camera-selector {
            width: 100%;
            min-width: auto;
        }
    }


    /* === GRAVITY FORMS INTEGRATION === */
    .gfield .camera-capture-container {
        margin: 10px 0;
        border-top: 1px solid #ddd;
        padding-top: 10px;
    }

    .gfield.camera-enabled input[type="file"],
    .gfield.camera-enabled .gfield_fileupload_rules {}

    .gfield.camera-enabled .ginput_container_fileupload {
        position: relative;
    }

    .camera-modal[style*="display: none"] {
        display: none !important;
    }

    /* === COMPRESSION PROGRESS COMPONENTS === */
    .compression-progress {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.85);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        z-index: 100;
        border-radius: var(--border-radius);
        padding: 20px;
    }

    .compression-spinner {
        width: 50px;
        height: 50px;
        border: 4px solid rgba(255, 255, 255, 0.3);
        border-top-color: var(--primary-color);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-bottom: 15px;
    }

    .compression-text {
        color: white;
        font-size: 16px;
        font-weight: 500;
        margin-bottom: 15px;
        text-align: center;
    }

    .compression-bar-container {
        width: 100%;
        max-width: 250px;
        height: 8px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        overflow: hidden;
        margin-bottom: 10px;
    }

    .compression-bar {
        height: 100%;
        background: linear-gradient(90deg, var(--primary-color), var(--success-color));
        border-radius: 4px;
        transition: width 0.2s ease;
    }

    .compression-percent {
        color: white;
        font-size: 14px;
        font-weight: bold;
    }

    /* Compression result display */
    .compression-result {
        margin-top: 10px;
        padding: 8px 12px;
        background: rgba(40, 167, 69, 0.2);
        border: 1px solid var(--success-color);
        border-radius: var(--border-radius);
        color: var(--success-color);
        font-size: 13px;
        text-align: center;
    }

    .compression-result.warning {
        background: rgba(255, 193, 7, 0.2);
        border-color: var(--warning-color);
        color: #856404;
    }

    /* File upload compression indicator */
    .compression-indicator {
        margin-top: 10px;
        padding: 10px 15px;
        border-radius: var(--border-radius);
        font-size: 14px;
        display: flex;
        align-items: center;
    }

    .compression-indicator-spinner {
        display: inline-block;
        width: 16px;
        height: 16px;
        border: 2px solid var(--warning-color);
        border-top-color: transparent;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-right: 10px;
        flex-shrink: 0;
    }

    .compression-indicator-text {
        flex: 1;
    }

    /* Disabled button state during compression */
    .camera-use-photo:disabled,
    .camera-controls button:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none !important;
    }
}