/**
 * WooCommerce Product Image Upload - Frontend Styles
 */

.wcpiu-upload-wrapper {
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    /* border: 1px solid #e0e0e0; */
    border-radius: 8px;
}

.wcpiu-upload-form {
    max-width: 600px;
}

.wcpiu-label {
    display: block;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 10px;
    color: var(--wp--preset--color--basecolor);
}

.wcpiu-label .required {
    color: #e74c3c;
    margin-left: 3px;
}

/* Upload Area */
.wcpiu-upload-area {
    position: relative;
    margin-bottom: 15px;
}

.wcpiu-file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.wcpiu-file-label {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wcpiu-button {
    display: inline-block;
    padding: 12px 24px;
    background: #0073aa;
    color: #fff;
    border-radius: 4px;
    font-weight: 600;
    transition: background 0.3s ease;
    white-space: nowrap;
}

.wcpiu-button:hover {
    background: #005a87;
}

.wcpiu-filename {
    flex: 1;
    color: #666;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wcpiu-filename.has-file {
    color: #333;
    font-weight: 500;
}

/* Preview Area */
.wcpiu-preview-area {
    position: relative;
    margin: 15px 0;
    padding: 15px;
    background: #fff;
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    text-align: center;
}

.wcpiu-preview-image {
    max-width: 100%;
    max-height: 300px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.wcpiu-remove-image {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 16px;
    background: #e74c3c;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.wcpiu-remove-image:hover {
    background: #c0392b;
}

/* Messages */
.wcpiu-message {
    padding: 12px;
    margin: 10px 0;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.wcpiu-message.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.wcpiu-message.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.wcpiu-message.info {
    display: block;
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Loading/Uploading State */
.wcpiu-upload-wrapper.uploading .wcpiu-button,
.wcpiu-upload-wrapper.loading .wcpiu-button {
    background: #999;
    cursor: not-allowed;
    position: relative;
    padding-right: 35px;
}

.wcpiu-upload-wrapper.uploading .wcpiu-button::after,
.wcpiu-upload-wrapper.loading .wcpiu-button::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 10px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: wcpiu-spin 0.6s linear infinite;
}

/* Disable file input while uploading */
.wcpiu-upload-wrapper.uploading .wcpiu-file-input {
    pointer-events: none;
    opacity: 0.6;
}

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

/* Responsive */
@media (max-width: 600px) {
    .wcpiu-upload-wrapper {
        padding: 15px;
    }

    .wcpiu-label {
        margin-bottom: 5px;
    }

    .wcpiu-upload-area {
        margin-bottom: 10px;
    }

    .wcpiu-file-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .wcpiu-button {
        width: 100%;
        text-align: center;
    }

    .wcpiu-filename {
        width: 100%;
    }
}

/* Cart Display */
.woocommerce-cart-form .wcpiu-cart-image,
.woocommerce-checkout .wcpiu-cart-image {
    max-width: 100px;
    height: auto;
    display: block;
    margin-top: 5px;
    border-radius: 4px;
}

/* Order Display */
.wcpiu-customer-order-image {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.wcpiu-customer-order-image img {
    max-width: 200px;
    height: auto;
    margin-top: 5px;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

/* Admin Order View */
.wcpiu-uploaded-image img {
    max-width: 50px;
    height: auto;
    border-radius: 3px;
    transition: transform 0.2s ease;
}

.wcpiu-uploaded-image img:hover {
    transform: scale(1.1);
}
