/**
 * Frontend Styles - High-Tech Blue/Purple Theme
 */

/* CSS Variables for easy theming */
:root {
    --dlsp-primary: #6366f1;
    --dlsp-primary-dark: #4f46e5;
    --dlsp-secondary: #8b5cf6;
    --dlsp-accent: #06b6d4;
    --dlsp-success: #10b981;
    --dlsp-warning: #f59e0b;
    --dlsp-error: #ef4444;
    --dlsp-dark: #1e1b4b;
    --dlsp-light: #f8fafc;
    --dlsp-border: rgba(99, 102, 241, 0.2);
    --dlsp-glow: rgba(99, 102, 241, 0.4);
    --dlsp-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
    --dlsp-gradient-dark: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0891b2 100%);
}

/* Main Container */
.dlsp-subject-processor {
    margin: 30px 0;
    padding: 30px;
    background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
    border: 1px solid var(--dlsp-border);
    border-radius: 16px;
    width: 100%;
    clear: both;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.08);
}

/* Ensure the add to cart button appears below the subject processor, not inside */
.dlsp-subject-processor .single_add_to_cart_button,
.dlsp-subject-processor .woocommerce-variation-add-to-cart {
    display: none !important;
}

/* Hide Buy Now button on products with subject processor */
.dlsp-subject-processor ~ .nasa-buy-now,
.nasa-buy-now {
    display: none !important;
}

/* Hide Customize Online button by default - JS will show it */
.single_add_to_cart_button.dlsp-hidden {
    display: none !important;
}

/* Make Customize Online button centered and styled when shown */
.single_add_to_cart_button.dlsp-show {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 350px !important;
    margin: 10px auto 0 auto !important;
    text-align: center !important;
    /* Purple gradient styling */
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 50%, #6d28d9 100%) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 14px !important;
    padding: 16px 48px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    min-height: auto !important;
    height: auto !important;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
}

.single_add_to_cart_button.dlsp-show:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(139, 92, 246, 0.5);
    background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #7c3aed 100%) !important;
}

/* Subtle pulse animation for the customize button */
.single_add_to_cart_button.dlsp-show {
    animation: dlsp-purple-pulse 2s ease-in-out infinite;
}

@keyframes dlsp-purple-pulse {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
    }
    50% {
        box-shadow: 0 6px 28px rgba(139, 92, 246, 0.6);
    }
}

/* Next Step label (inserted before the customize button) */
.dlsp-next-step-label {
    display: block;
    width: 100%;
    max-width: 350px;
    margin: 30px auto 8px auto;
    padding-top: 20px;
    border-top: 1px solid var(--dlsp-border);
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Make the add to cart container full width block */
.woocommerce-variation-add-to-cart.woocommerce-variation-add-to-cart-enabled {
    display: block !important;
    width: 100% !important;
}

/* Hide the quantity selector if not needed */
.woocommerce-variation-add-to-cart .quantity {
    display: none !important;
}

/* Hide "Choose an option" placeholder in Select2 dropdowns */
.select2-results__option[aria-disabled="true"],
.select2-results__option:first-child:empty,
.select2-results__option.select2-results__message {
    display: none !important;
}

/* Hide subject processor until variation is selected */
.variations_form .dlsp-subject-processor {
    display: none;
}

.variations_form.variation-selected .dlsp-subject-processor {
    display: block;
}

.dlsp-section {
    margin-bottom: 25px;
}

.dlsp-section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--dlsp-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dlsp-section-title::before {
    content: '';
    width: 4px;
    height: 28px;
    background: var(--dlsp-gradient);
    border-radius: 2px;
}

/* Style Selector */
.dlsp-style-selector {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--dlsp-border);
}

.dlsp-style-label {
    display: block;
    margin-bottom: 15px;
    font-weight: 600;
    font-size: 16px;
    color: var(--dlsp-dark);
}

.dlsp-style-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.dlsp-style-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 12px;
    border: 2px solid var(--dlsp-border);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.dlsp-style-option:hover {
    border-color: var(--dlsp-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.dlsp-style-option.selected {
    border-color: var(--dlsp-primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    box-shadow: 0 0 0 4px var(--dlsp-glow);
}

.dlsp-style-option img {
    width: 93px;
    height: 119px;
    object-fit: cover;
    margin-bottom: 8px;
    border-radius: 6px;
}

.dlsp-style-placeholder {
    width: 93px;
    height: 119px;
    background: var(--dlsp-border);
    border-radius: 6px;
    margin-bottom: 8px;
}

.dlsp-style-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--dlsp-dark);
    text-align: center;
}

.dlsp-style-option.selected .dlsp-style-name {
    color: var(--dlsp-primary);
}

/* Subject Selector */
.dlsp-subject-selector {
    margin-bottom: 25px;
}

.dlsp-subject-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dlsp-dark);
    font-size: 14px;
}

.dlsp-num-subjects {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    border: 2px solid var(--dlsp-border);
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
    transition: all 0.3s ease;
}

.dlsp-num-subjects:focus {
    border-color: var(--dlsp-primary);
    box-shadow: 0 0 0 4px var(--dlsp-glow);
    outline: none;
}

/* Select2 styling for num-subjects dropdown */
.dlsp-subject-selector .select2-container {
    width: 100% !important;
    max-width: 300px;
}

.dlsp-subject-selector .select2-container--default .select2-selection--single {
    height: auto;
    min-height: 50px;
    border: 2px solid var(--dlsp-border);
    border-radius: 12px;
    background: #fff;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.dlsp-subject-selector .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--dlsp-primary);
    box-shadow: 0 0 0 4px var(--dlsp-glow);
}

.dlsp-subject-selector .select2-container .select2-selection--single .select2-selection__rendered {
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 500;
    color: var(--dlsp-dark);
    line-height: 1.4;
}

.dlsp-subject-selector .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    top: 0;
    right: 10px;
    display: flex;
    align-items: center;
}

.dlsp-subject-selector .select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #999;
}

/* Compact dropdown options for num-subjects (no icons) */
.dlsp-compact-dropdown .select2-results__option {
    padding: 10px 14px !important;
    font-size: 15px;
    min-height: auto;
}

.dlsp-compact-dropdown .select2-results__option--highlighted {
    background-color: var(--dlsp-primary) !important;
    color: #fff;
}

/* Fixed subjects notice */
.dlsp-fixed-subjects-notice {
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid var(--dlsp-border);
    border-radius: 10px;
    color: var(--dlsp-primary-dark);
    font-weight: 500;
}

/* Subjects Container */
.dlsp-subjects-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-top: 24px;
}

/* Subject Item Card */
.dlsp-subject-item {
    background: #ffffff;
    border: 2px solid var(--dlsp-border);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.dlsp-subject-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--dlsp-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dlsp-subject-item:hover {
    border-color: var(--dlsp-primary);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.dlsp-subject-item:hover::before {
    opacity: 1;
}

.dlsp-subject-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--dlsp-border);
}

.dlsp-subject-number {
    font-weight: 700;
    font-size: 18px;
    color: var(--dlsp-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Magic wand icon styling */
.dlsp-subject-icon {
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
}

.dlsp-subject-icon path {
    stroke: url(#dlsp-icon-gradient);
}

.dlsp-subject-item:hover .dlsp-subject-icon {
    transform: rotate(-15deg) scale(1.1);
    filter: drop-shadow(0 2px 4px rgba(99, 102, 241, 0.4));
}

/* Status Badges */
.dlsp-subject-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dlsp-subject-status[data-status="pending"] {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    color: #64748b;
}

.dlsp-subject-status[data-status="ready"] {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    color: var(--dlsp-primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.dlsp-subject-status[data-status="cropping"] {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(251, 191, 36, 0.1) 100%);
    color: var(--dlsp-warning);
}

.dlsp-subject-status[data-status="processing"] {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    color: var(--dlsp-accent);
    animation: dlsp-pulse-status 2s ease-in-out infinite;
}

.dlsp-subject-status[data-status="completed"] {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(52, 211, 153, 0.1) 100%);
    color: var(--dlsp-success);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.dlsp-subject-status[data-status="failed"] {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(248, 113, 113, 0.1) 100%);
    color: var(--dlsp-error);
}

@keyframes dlsp-pulse-status {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.dlsp-subject-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Individual subject process button */
.dlsp-subject-actions {
    margin-top: 20px;
    text-align: center;
}

.dlsp-btn-process-subject {
    width: 100%;
    padding: 14px 24px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 12px !important;
    background: var(--dlsp-gradient) !important;
    border: none !important;
    color: #fff !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.dlsp-btn-process-subject:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.dlsp-btn-process-subject:disabled {
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%) !important;
    cursor: not-allowed;
    box-shadow: none;
}

/* Subject Type Selector */
.dlsp-subject-type-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--dlsp-dark);
}

.dlsp-subject-type {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--dlsp-border);
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    transition: all 0.3s ease;
}

.dlsp-subject-type:focus {
    border-color: var(--dlsp-primary);
    box-shadow: 0 0 0 4px var(--dlsp-glow);
    outline: none;
}

/* Asset Selectors */
.dlsp-subject-assets {
    margin-top: 12px;
}

.dlsp-asset-selector {
    margin-bottom: 12px;
}

/* Text Block Inputs */
.dlsp-subject-text-blocks {
    margin-top: 12px;
}

.dlsp-text-block-input {
    margin-bottom: 12px;
}

.dlsp-text-block-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--dlsp-dark);
}

.dlsp-text-block-field {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid var(--dlsp-border);
    border-radius: 12px;
    background: #fff;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.dlsp-text-block-field:focus {
    outline: none;
    border-color: var(--dlsp-primary);
    box-shadow: 0 0 0 4px var(--dlsp-glow);
}

.dlsp-text-block-field::placeholder {
    color: #9ca3af;
}

.dlsp-asset-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--dlsp-dark);
}

.dlsp-asset-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--dlsp-border);
    border-radius: 10px;
    font-size: 14px;
    background-color: #fff;
    transition: all 0.3s ease;
}

.dlsp-asset-select:focus {
    border-color: var(--dlsp-primary);
    outline: none;
    box-shadow: 0 0 0 4px var(--dlsp-glow);
}

/* Select2 with Icons for Subject Type and Assets */
.dlsp-select2-option {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    flex-wrap: nowrap;
}

.dlsp-select2-icon {
    width: 120px !important;
    height: 120px !important;
    max-width: 120px !important;
    max-height: 120px !important;
    object-fit: contain;
    border-radius: 8px;
    flex-shrink: 0;
}

.dlsp-select2-icon-small {
    width: 60px !important;
    height: 60px !important;
    max-width: 60px !important;
    max-height: 60px !important;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
}

.dlsp-select2-text {
    flex: 1;
    font-weight: 500;
}

/* Hide placeholder option */
.dlsp-select2-placeholder-option {
    display: none !important;
}

/* Select2 container styling */
.dlsp-subject-type-selector .select2-container,
.dlsp-asset-selector .select2-container {
    width: 100% !important;
}

.dlsp-subject-type-selector .select2-container--default .select2-selection--single,
.dlsp-asset-selector .select2-container--default .select2-selection--single {
    height: auto;
    min-height: 110px;
    border: 2px solid var(--dlsp-border);
    border-radius: 12px;
    background: #fff;
    transition: all 0.3s ease;
}

.dlsp-subject-type-selector .select2-container--default.select2-container--open .select2-selection--single,
.dlsp-asset-selector .select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--dlsp-primary);
    box-shadow: 0 0 0 4px var(--dlsp-glow);
}

.dlsp-subject-type-selector .select2-container .select2-selection--single .select2-selection__rendered,
.dlsp-asset-selector .select2-container .select2-selection--single .select2-selection__rendered {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    line-height: normal;
}

.dlsp-subject-type-selector .select2-container .select2-selection--single .select2-selection__rendered .dlsp-select2-option,
.dlsp-asset-selector .select2-container .select2-selection--single .select2-selection__rendered .dlsp-select2-option {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.dlsp-subject-type-selector .select2-container--default .select2-selection--single .select2-selection__arrow,
.dlsp-asset-selector .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 100%;
    top: 0;
}

/* Dropdown options */
.select2-results__option .dlsp-select2-option {
    padding: 10px 0;
    overflow: hidden;
    flex-wrap: nowrap;
}

.select2-results__option .dlsp-select2-option img {
    width: 120px !important;
    height: 120px !important;
    max-width: 120px !important;
    max-height: 120px !important;
    object-fit: contain;
    flex-shrink: 0;
}

/* Ensure Select2 dropdown is properly contained */
.select2-container--open .select2-dropdown {
    overflow: hidden;
}

.select2-results__options {
    overflow-y: auto;
    overflow-x: hidden;
}

/* ==================== UPLOAD AREA - HIGH TECH DESIGN ==================== */
.dlsp-upload-area {
    position: relative;
    min-height: 240px;
    border-radius: 16px;
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Animated border using pseudo-element */
.dlsp-upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    padding: 2px;
    background: linear-gradient(135deg, var(--dlsp-primary), var(--dlsp-secondary), var(--dlsp-accent), var(--dlsp-primary));
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: dlsp-border-animation 4s ease infinite;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.dlsp-upload-area:hover::before {
    opacity: 1;
}

@keyframes dlsp-border-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Corner accents */
.dlsp-upload-area::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    border: 1px dashed var(--dlsp-border);
    border-radius: 12px;
    pointer-events: none;
    transition: all 0.3s ease;
}

.dlsp-upload-area:hover::after {
    border-color: var(--dlsp-primary);
}

.dlsp-upload-area.dlsp-drag-over {
    transform: scale(1.02);
}

.dlsp-upload-area.dlsp-drag-over::before {
    opacity: 1;
    animation-duration: 1s;
}

.dlsp-upload-area.dlsp-drag-over::after {
    border-color: var(--dlsp-primary);
    border-style: solid;
}

/* Upload Prompt */
.dlsp-upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.dlsp-upload-prompt:hover {
    background: rgba(99, 102, 241, 0.03);
}

/* Upload Icon - Creative Camera SVG */
.dlsp-upload-icon {
    width: 72px;
    height: 72px;
    margin-bottom: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
}

.dlsp-upload-prompt:hover .dlsp-upload-icon {
    transform: translateY(-6px) scale(1.1);
    filter: drop-shadow(0 8px 24px rgba(99, 102, 241, 0.5));
}

/* Subtle pulse animation on the camera */
@keyframes dlsp-camera-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.dlsp-upload-icon circle:nth-of-type(3) {
    animation: dlsp-camera-pulse 2s ease-in-out infinite;
}

.dlsp-upload-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--dlsp-dark);
    text-align: center;
    margin-bottom: 8px;
}

.dlsp-upload-hint {
    font-size: 13px;
    color: #64748b;
    text-align: center;
}

/* Image Preview */
.dlsp-image-preview {
    position: relative;
    padding: 16px;
    z-index: 1;
}

.dlsp-image-preview img {
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.dlsp-btn-remove {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    border: none;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    border-radius: 10px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.dlsp-btn-remove:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

/* Crop Container */
.dlsp-crop-container {
    padding: 24px;
    position: relative;
    z-index: 1;
}

.dlsp-crop-tip {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--dlsp-dark);
    margin: 0 0 20px 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(251, 191, 36, 0.1) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 10px;
}

.dlsp-crop-viewport {
    margin-bottom: 20px;
}

.dlsp-crop-viewport .dlsp-zoom-label {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin: 12px 0 4px 0;
}

.dlsp-crop-viewport .cr-slider-wrap {
    margin-top: 0;
}

.dlsp-crop-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Processed Preview */
.dlsp-processed-preview {
    padding: 16px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.dlsp-processed-preview img {
    width: 100%;
    height: auto;
    max-height: 320px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Progress Bar */
.dlsp-upload-progress {
    padding: 20px;
    position: relative;
    z-index: 1;
}

.dlsp-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
}

.dlsp-progress-fill {
    height: 100%;
    background: var(--dlsp-gradient);
    border-radius: 10px;
    transition: width 0.3s ease;
    position: relative;
}

.dlsp-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: dlsp-progress-shine 1.5s ease-in-out infinite;
}

@keyframes dlsp-progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.dlsp-progress-text {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    text-align: center;
}

/* ==================== BUTTONS ==================== */
.dlsp-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 30px;
    padding-top: 24px;
    border-top: 2px solid var(--dlsp-border);
}

.dlsp-actions .button {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dlsp-btn-primary {
    background: var(--dlsp-gradient) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.dlsp-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.dlsp-btn-primary:disabled {
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%) !important;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.dlsp-btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.dlsp-btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4);
}

.dlsp-btn-replace {
    width: 100%;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.dlsp-btn-replace:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* Crop action buttons */
.dlsp-btn-crop-save {
    background: var(--dlsp-gradient) !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 24px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease !important;
}

.dlsp-btn-crop-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.dlsp-btn-crop-cancel {
    background: #f1f5f9 !important;
    color: #64748b !important;
    border: 2px solid #e2e8f0 !important;
    padding: 10px 24px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.dlsp-btn-crop-cancel:hover {
    background: #e2e8f0 !important;
    border-color: #cbd5e1 !important;
}

/* Select2 Customization for Variations */
.select2-container--default .dlsp-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    flex-wrap: nowrap;
}

.dlsp-select-thumbnail {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.dlsp-select-thumbnail-small {
    width: 50px !important;
    height: 50px !important;
    max-width: 50px !important;
    max-height: 50px !important;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.dlsp-select-text {
    flex: 1;
}

.select2-container .select2-selection--single .select2-selection__rendered .dlsp-select-option {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    flex-wrap: nowrap;
}

.select2-container .select2-selection--single .select2-selection__rendered {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    overflow: hidden;
}

/* Ensure all images in Select2 are contained */
.select2-container img,
.select2-results img,
.select2-selection img {
    max-width: 100%;
    height: auto;
}

/* Fix for variation Select2 dropdowns */
.select2-results__option .dlsp-select-option img {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    object-fit: cover;
    flex-shrink: 0;
}

/* Cart Display */
.dlsp-cart-subjects {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.dlsp-cart-subjects img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--dlsp-border);
}

/* ==================== PROCESSING OVERLAY ==================== */
.dlsp-processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 16px;
}

.dlsp-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top-color: var(--dlsp-primary);
    border-right-color: var(--dlsp-secondary);
    border-radius: 50%;
    animation: dlsp-spin 1s linear infinite;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

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

.dlsp-processing-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--dlsp-dark);
    text-align: center;
    max-width: 240px;
}

.dlsp-processing-subtext {
    font-size: 13px;
    color: #64748b;
    margin-top: 8px;
}

/* ==================== FACE SELECTION MODAL ==================== */
.dlsp-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dlsp-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 27, 75, 0.8);
    backdrop-filter: blur(4px);
}

.dlsp-modal-content {
    position: relative;
    background: #fff;
    border-radius: 20px;
    max-width: 640px;
    width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(99, 102, 241, 0.3);
    border: 1px solid var(--dlsp-border);
}

.dlsp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--dlsp-border);
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
}

.dlsp-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--dlsp-dark);
}

.dlsp-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.2s;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.dlsp-modal-close:hover {
    color: var(--dlsp-error);
    background: rgba(239, 68, 68, 0.1);
}

.dlsp-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.dlsp-modal-instruction {
    margin: 0 0 24px 0;
    color: #64748b;
    font-size: 15px;
    text-align: center;
}

.dlsp-faces-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 16px;
    justify-items: center;
}

.dlsp-face-option {
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8fafc;
}

.dlsp-face-option:hover {
    border-color: var(--dlsp-primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.25);
}

.dlsp-face-option img {
    display: block;
    width: 130px;
    height: 130px;
    object-fit: cover;
}

.dlsp-face-label {
    text-align: center;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--dlsp-dark);
    background: #f8fafc;
}

.dlsp-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--dlsp-border);
    text-align: center;
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
}

.dlsp-btn-use-full-image {
    background: #64748b !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.dlsp-btn-use-full-image:hover {
    background: #475569 !important;
    transform: translateY(-1px);
}

/* Face detection loading state */
.dlsp-detecting-faces {
    text-align: center;
    padding: 48px 24px;
}

.dlsp-detecting-faces .dlsp-spinner {
    margin: 0 auto 20px auto;
}

.dlsp-no-faces-message {
    text-align: center;
    padding: 24px;
    color: #64748b;
}

/* ==================== CHECKBOX LIST ASSETS ==================== */
.dlsp-asset-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.dlsp-checkbox-item {
    display: flex;
    align-items: center;
    position: relative;
}

.dlsp-checkbox-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.dlsp-checkbox-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid var(--dlsp-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 14px;
    color: var(--dlsp-dark);
    min-width: 120px;
    justify-content: center;
}

.dlsp-checkbox-item label:hover {
    border-color: var(--dlsp-primary);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.dlsp-checkbox-item input[type="checkbox"]:checked + label {
    background: var(--dlsp-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.dlsp-checkbox-item input[type="checkbox"]:checked + label:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.4);
}

.dlsp-checkbox-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    padding: 2px;
}

/* Checkmark indicator */
.dlsp-checkbox-item label::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid var(--dlsp-border);
    border-radius: 6px;
    background: #fff;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.dlsp-checkbox-item input[type="checkbox"]:checked + label::before {
    background: #fff;
    border-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='%236366f1' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 14px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .dlsp-subject-processor {
        padding: 20px;
        border-radius: 12px;
    }

    .dlsp-subjects-container {
        gap: 16px;
    }

    .dlsp-subject-item {
        padding: 16px;
        border-radius: 12px;
    }

    .dlsp-upload-area {
        min-height: 200px;
    }

    .dlsp-upload-prompt {
        min-height: 200px;
        padding: 20px;
    }

    .dlsp-upload-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }

    .dlsp-actions {
        flex-direction: column;
    }

    .dlsp-actions .button {
        width: 100%;
    }

    .dlsp-faces-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .dlsp-face-option img {
        width: 100px;
        height: 100px;
    }

    /* Fix Select2 dropdowns running off the right side on mobile */
    .select2-container--open .select2-dropdown {
        max-width: calc(100vw - 40px) !important;
        left: 0 !important;
        right: auto !important;
    }

    .select2-container {
        max-width: 100% !important;
    }

    .select2-results__options {
        max-width: 100%;
    }

    .select2-results__option .dlsp-select2-option,
    .select2-results__option .dlsp-select-option {
        max-width: 100%;
        flex-wrap: nowrap;
    }

    .select2-results__option .dlsp-select2-option img,
    .select2-results__option .dlsp-select-option img {
        width: 80px !important;
        height: 80px !important;
        max-width: 80px !important;
        max-height: 80px !important;
    }

    .dlsp-select2-text,
    .dlsp-select-text {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Smaller thumbnails in selection box on mobile to save space */
    .dlsp-select2-icon-small,
    .dlsp-select-thumbnail-small {
        width: 40px !important;
        height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
}

/* ==================== PROCESS ALL BUTTON ==================== */
.dlsp-process-all-container {
    margin-top: 30px;
    padding: 24px;
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px solid var(--dlsp-border);
    border-radius: 16px;
    text-align: center;
}

.dlsp-btn-process-all {
    padding: 16px 48px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    border-radius: 14px !important;
    min-width: 250px;
}

.dlsp-process-all-hint {
    margin-top: 12px;
    margin-bottom: 0;
    font-size: 14px;
    color: #64748b;
}

.dlsp-btn-process-all:not(:disabled) {
    animation: dlsp-pulse-glow 2s ease-in-out infinite;
}

@keyframes dlsp-pulse-glow {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
    }
    50% {
        box-shadow: 0 6px 28px rgba(99, 102, 241, 0.5);
    }
}

/* Processing state for the button */
.dlsp-btn-process-all.dlsp-processing,
.dlsp-btn-process-all.dlsp-processing:hover,
.dlsp-btn-process-all.dlsp-processing:focus,
.dlsp-btn-process-all.dlsp-processing:active,
button.dlsp-btn-process-all.dlsp-processing {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #000 !important;
    -webkit-text-fill-color: #000 !important;
    cursor: wait !important;
    animation: none !important;
    pointer-events: none;
    opacity: 1 !important;
}

.dlsp-btn-process-all.dlsp-processing::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid rgba(0,0,0,0.3);
    border-top-color: #000;
    border-radius: 50%;
    animation: dlsp-spin 0.8s linear infinite;
    vertical-align: middle;
}

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

/* Additional Options Section - styled like subject boxes */
.dlsp-additional-options-container {
    background: #ffffff;
    border: 2px solid var(--dlsp-border);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    margin-top: 20px;
}

.dlsp-additional-options-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--dlsp-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dlsp-additional-options-container:hover {
    border-color: var(--dlsp-primary);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.dlsp-additional-options-container:hover::before {
    opacity: 1;
}

.dlsp-additional-options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--dlsp-border);
}

.dlsp-additional-options-title {
    font-weight: 700;
    font-size: 18px;
    color: var(--dlsp-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dlsp-additional-options-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dlsp-additional-option-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dlsp-additional-option-input label {
    font-weight: 600;
    font-size: 14px;
    color: var(--dlsp-dark);
}

.dlsp-additional-option-field {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--dlsp-border);
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #fafafa;
}

.dlsp-additional-option-field:hover {
    border-color: var(--dlsp-primary-light);
    background: #ffffff;
}

.dlsp-additional-option-field:focus {
    outline: none;
    border-color: var(--dlsp-primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}
