/* Modal Styles */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    margin: 0;
    padding: 24px 24px 16px;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #eee;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 28px;
    font-weight: 300;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    color: #333;
    background: #f5f5f5;
}

.modal-body {
    padding: 24px;
}

.modal-body > p {
    margin: 0 0 20px;
    color: #666;
    font-size: 14px;
}

/* Image Upload Area */
.image-upload-area {
    margin-bottom: 24px;
}

.upload-box {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #fafafa;
}

.upload-box:hover {
    border-color: #007cba;
    background: #f0f9ff;
}

.upload-box.dragover {
    border-color: #007cba;
    background: #e6f4ff;
    transform: scale(1.02);
}

.upload-box svg {
    color: #007cba;
    margin-bottom: 12px;
}

.upload-box p {
    margin: 0 0 8px;
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.upload-box .file-info {
    font-size: 13px;
    color: #999;
}

/* Image Preview */
#image-preview {
    text-align: center;
    padding: 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
}

#image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.remove-image {
    background: #dc3232;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.remove-image:hover {
    background: #c22222;
}

/* Loading Spinner */
.modal-loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal-loading p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Modal Buttons */
.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.modal-buttons .button {
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.modal-buttons .cancel-btn {
    background: #f5f5f5;
    color: #333;
}

.modal-buttons .cancel-btn:hover {
    background: #e0e0e0;
}

.modal-buttons .button-primary {
    background: #007cba;
    color: #fff;
}

.modal-buttons .button-primary:hover {
    background: #005a87;
}

.modal-buttons .button-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Cart Image Display */
.woocommerce-cart-form__cart-item .custom-image-display img,
.woocommerce table.shop_table .custom-image-display img {
    max-width: 100px;
    height: auto;
    margin-top: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    background: #fff;
}

/* Order Details Image Display */
.order-details .custom-image-display img {
    max-width: 150px;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
    background: #fff;
    margin-top: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95%;
        margin: 20px;
    }
    
    .modal-content h2 {
        font-size: 20px;
        padding: 20px 20px 12px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-buttons .button {
        width: 100%;
    }
}
