.wc-upload-field {
    margin: 1em 0;
}

.wc-upload-field .wc-upload-input {
    display: none;
}

.wc-upload-field .wc-upload-label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.wc-upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 2em 1.5em;
    border: 2px dashed #ccc;
    border-radius: var(--wcu-btn-radius, 8px);
    cursor: pointer;
    transition: all 0.25s ease;
    background: #fff;
    text-align: center;
    margin-bottom: 0.75em;
}

.wc-upload-dropzone:hover,
.wc-upload-dropzone.wc-upload-dragover {
    border-style: solid;
    background: var(--wcu-btn-bg, #7f54b3);
    border-color: var(--wcu-btn-bg, #7f54b3);
}

.wc-upload-dropzone:hover .wc-upload-icon,
.wc-upload-dropzone.wc-upload-dragover .wc-upload-icon {
    color: var(--wcu-btn-color, #fff);
}

.wc-upload-dropzone:hover .wc-upload-dropzone-text,
.wc-upload-dropzone.wc-upload-dragover .wc-upload-dropzone-text {
    color: var(--wcu-btn-color, #fff);
}

.wc-upload-icon {
    width: 40px;
    height: 40px;
    color: #999;
    transition: color 0.25s ease;
}

.wc-upload-dropzone-text {
    font-size: 0.9em;
    color: #666;
    transition: color 0.25s ease;
}

.wc-upload-field .wc-upload-info {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 0.75em;
}

.wc-upload-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    margin-bottom: 1em;
    max-height: 264px !important;
    overflow-y: auto !important;
    padding: 4px 0;
}

.wc-upload-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border: 1px solid var(--wcu-preview-border, #ddd);
    border-radius: var(--wcu-btn-radius, 4px);
    overflow: hidden;
}

.wc-upload-preview-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: var(--wcu-btn-radius, 4px);
    display: block;
}

.wc-upload-preview-item .wc-upload-delete {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--wcu-delete-bg, rgba(0, 0, 0, 0.6));
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 13px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    padding: 0;
    z-index: 1;
}

.wc-upload-error {
    color: #e00;
    font-size: 0.9em;
    margin-top: 0.5em;
}

.wc-upload-order-files {
    margin: 8px 0;
}

.wc-upload-order-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.wc-upload-order-thumb {
    width: 60px;
    text-align: center;
    line-height: 1;
}

.wc-upload-order-thumb a {
    display: block;
    width: 60px;
    height: 60px;
    overflow: hidden;
}

.wc-upload-order-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border: 1px solid #ddd;
    border-radius: 4px;
    display: block;
}

.wc-upload-order-thumb-name {
    display: block;
    font-size: 0.8em;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
}

.wc-upload-order-unavailable {
    display: flex;
    width: 60px;
    height: 60px;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 9px;
    color: #999;
    padding: 4px;
    box-sizing: border-box;
}

.wc-upload-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-top-color: #333;
    border-radius: 50%;
    animation: wc-upload-spin 0.6s linear infinite;
}

.wc-upload-progress-container {
    margin: 1em 0;
    padding: 12px 16px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.wc-upload-progress-text {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 8px;
    font-weight: 500;
}

.wc-upload-progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.wc-upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--wcu-btn-bg, #7f54b3), var(--wcu-btn-bg, #9b6eb8));
    border-radius: 4px;
    transition: width 0.3s ease;
}

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

.wc-upload-order-files .wc-upload-view-all {
    text-decoration: underline;
}

/* Cart & Checkout Inline Gallery Styles */
.wc-upload-cart-gallery {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 4px 0 !important;
    flex-wrap: nowrap !important;
}

.wc-upload-cart-thumb,
.wc-upload-cart-view-all {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    flex-shrink: 0 !important;
    text-decoration: none !important;
    overflow: hidden !important;
    border-radius: 4px !important;
}

.wc-upload-cart-thumb img,
.wc-upload-cart-view-all img {
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    object-fit: cover !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    display: block !important;
    box-sizing: border-box !important;
}

.wc-upload-cart-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.65) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: bold !important;
    z-index: 10 !important;
    border-radius: 4px !important;
    pointer-events: none !important;
}

/* Order/Thank-you page: overlay on 3rd thumbnail */
.wc-upload-order-thumb-more {
    position: relative;
    cursor: pointer;
}

.wc-upload-order-thumb-more a {
    position: relative;
    display: block;
    width: 60px;
    height: 60px;
    overflow: hidden;
}

.wc-upload-order-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    border-radius: 4px;
    pointer-events: none;
}

/* Mobile */
@media (max-width: 480px) {

    .wc-upload-dropzone {
        padding: 1.25em 1em;
    }

    .wc-upload-icon {
        width: 32px;
        height: 32px;
    }

    .wc-upload-preview-item {
        width: 56px;
        height: 56px;
    }

    .wc-upload-preview-item .wc-upload-delete {
        width: 18px;
        height: 18px;
        font-size: 11px;
        line-height: 14px;
        border-width: 1.5px;
    }

    .wc-upload-order-thumb {
        width: 44px;
    }

    .wc-upload-order-thumb a {
        width: 44px;
        height: 44px;
    }

    .wc-upload-order-unavailable {
        width: 44px;
        height: 44px;
        font-size: 8px;
    }

    .wc-upload-order-thumb-name {
        max-width: 44px;
        font-size: 0.7em;
    }

    .wc-upload-order-thumb-more a {
        width: 44px;
        height: 44px;
    }

    .wc-upload-order-overlay {
        font-size: 13px;
    }

    .wc-upload-order-thumbnails {
        gap: 6px;
    }

    .wc-upload-previews {
        max-height: 152px;
    }
}
