/**
 * Frontend styles for Woo Image Upload
 */

/* Upload Section */
.woo-image-upload-section {
    margin: 20px 0;
    padding: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.woo-image-upload-section:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.woo-image-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.2);
}

.woo-image-upload-btn:hover {
    background: linear-gradient(135deg, #005a87 0%, #004466 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.woo-image-upload-btn .dashicons {
    font-size: 16px;
}

.woo-uploaded-images-preview {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.woo-image-preview img {
    border-radius: 4px;
    border: 2px solid #ddd;
}

/* Modal Styles */
.woo-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.woo-modal-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.woo-selection-modal-content {
    max-width: 600px;
    width: 90%;
}

.woo-crop-modal-content {
    max-width: 800px;
    width: 90%;
}

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

.woo-modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.woo-modal-close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.woo-modal-close:hover {
    color: #333;
}

.woo-modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.woo-modal-footer {
    padding: 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8f9fa;
}

/* Image Selection Options */
.woo-image-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.woo-option-card {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.woo-option-card:hover {
    border-color: #0073aa;
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.15);
}

.woo-option-card.selected {
    border-color: #0073aa;
    background: #e7f3ff;
}

.woo-option-icon {
    font-size: 48px;
    color: #0073aa;
    margin-bottom: 15px;
}

.woo-option-card h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
}

.woo-option-card p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

/* Upload Progress */
.woo-upload-progress {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.woo-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 500;
    color: #333;
}

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

.woo-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #005a87);
    width: 0%;
    transition: width 0.3s ease;
}

/* Upload Area */
.woo-upload-area {
    margin-bottom: 30px;
}

.woo-upload-dropzone {
    border: 2px dashed #d0d0d0;
    border-radius: 12px;
    padding: 50px 20px;
    text-align: center;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.woo-upload-dropzone::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 115, 170, 0.1), transparent);
    transition: left 0.5s ease;
}

.woo-upload-dropzone:hover::before {
    left: 100%;
}

.woo-upload-dropzone:hover,
.woo-upload-dropzone.dragover {
    border-color: #0073aa;
    background: linear-gradient(135deg, #e7f3ff 0%, #f0f8ff 100%);
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 115, 170, 0.15);
}

.woo-upload-icon {
    font-size: 48px;
    color: #0073aa;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.woo-upload-dropzone:hover .woo-upload-icon {
    transform: scale(1.1);
    color: #005a87;
}

.woo-upload-dropzone p {
    margin: 0 0 15px 0;
    color: #666;
    font-size: 16px;
}

.woo-select-images-btn {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.2);
}

.woo-select-images-btn:hover {
    background: linear-gradient(135deg, #005a87 0%, #004466 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

/* Uploaded Images */
.woo-uploaded-images-container h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.woo-uploaded-images-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.woo-uploaded-image-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    background: #fff;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.woo-uploaded-image-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.woo-uploaded-image-item.confirmed {
    border-color: #00a32a;
    background: linear-gradient(135deg, #f0fff4 0%, #ffffff 100%);
}

.woo-image-preview {
    position: relative;
    margin-bottom: 10px;
}

.woo-confirmed-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #00a32a;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
}

.woo-uploaded-image-item img {
    max-width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.woo-image-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.woo-image-actions .button {
    padding: 6px 12px;
    font-size: 11px;
    min-height: auto;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.woo-image-actions .woo-confirm-image {
    background: linear-gradient(135deg, #00a32a 0%, #007cba 100%);
    border-color: #00a32a;
}

.woo-image-actions .woo-confirm-image:hover {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    transform: translateY(-1px);
}

.woo-image-info p {
    margin: 2px 0;
    font-size: 12px;
    color: #666;
}

.woo-image-info p:first-child {
    font-weight: bold;
    color: #333;
}

.woo-image-status {
    font-weight: 500 !important;
    font-size: 11px !important;
}

.woo-uploaded-image-item.confirmed .woo-image-status {
    color: #00a32a !important;
}

.woo-uploaded-image-item:not(.confirmed) .woo-image-status {
    color: #d63638 !important;
}

/* Crop Modal */
.woo-crop-container {
    margin-bottom: 20px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

.woo-crop-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 4px;
}

.woo-crop-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 15px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.woo-crop-info {
    flex: 1;
    min-width: 200px;
}

.woo-crop-info p {
    margin: 5px 0;
    color: #333;
    font-size: 14px;
}

.woo-crop-info p:first-child {
    font-weight: bold;
    font-size: 16px;
}

.woo-crop-instructions {
    color: #666 !important;
    font-style: italic;
}

.woo-crop-note {
    color: #0073aa !important;
    font-size: 12px !important;
    font-weight: 500;
    margin-top: 5px;
}

.woo-crop-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.woo-crop-actions .button {
    padding: 8px 16px;
    font-size: 12px;
    min-height: auto;
}

/* Disabled Button State */
.woo-confirm-upload.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #ccc !important;
    border-color: #ccc !important;
}

/* Add to Cart Button States */
.single_add_to_cart_button.disabled,
.add_to_cart_button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #ccc !important;
    border-color: #ccc !important;
    color: #666 !important;
}

.single_add_to_cart_button.disabled:hover,
.add_to_cart_button.disabled:hover {
    background: #ccc !important;
    border-color: #ccc !important;
    transform: none !important;
}

/* Cart Item Images */
.woo-cart-item-images {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.woo-cart-item-image {
    border-radius: 4px;
    border: 1px solid #ddd;
}

/* Cart Item Edit Button */
.woo-edit-cart-images {
    background: #0073aa;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    margin-top: 5px;
}

.woo-edit-cart-images:hover {
    background: #005a87;
}

/* Checkout Edit Section */
.woo-checkout-edit-section {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.woo-checkout-edit-section h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
}

.woo-checkout-edit-section p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

.woo-checkout-item-images {
    margin-bottom: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.woo-checkout-item-images h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

.woo-edit-checkout-images {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 10px;
}

.woo-edit-checkout-images:hover {
    background: #005a87;
}

.woo-checkout-images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.woo-checkout-images-preview img {
    border-radius: 4px;
    border: 1px solid #ddd;
    transition: transform 0.2s ease;
}

.woo-checkout-images-preview img:hover {
    transform: scale(1.05);
}

/* Order Item Images */
.woo-order-item-images {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 4px;
}

.woo-order-item-images h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 14px;
}

.woo-order-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.woo-order-image-item {
    text-align: center;
}

.woo-order-image-item img {
    border-radius: 4px;
    border: 1px solid #ddd;
}

.woo-order-image-item p {
    margin: 5px 0 0 0;
    font-size: 11px;
    color: #666;
    word-break: break-all;
}

/* Responsive Design */
@media (max-width: 768px) {
    .woo-modal-content {
        max-width: 95%;
        margin: 20px;
    }
    
    .woo-image-options {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .woo-option-card {
        padding: 15px;
    }
    
    .woo-option-icon {
        font-size: 36px;
    }
    
    .woo-uploaded-images-list {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .woo-crop-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .woo-crop-actions {
        width: 100%;
        justify-content: center;
    }
    
    .woo-modal-footer {
        flex-direction: column;
    }
    
    .woo-modal-footer .button {
        width: 100%;
        margin: 5px 0;
    }
    
    .woo-progress-info {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
}

/* Loading States */
.woo-loading {
    opacity: 0.6;
    pointer-events: none;
}

.woo-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: woo-spin 1s linear infinite;
}

@keyframes woo-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.woo-error {
    color: #d63638;
    font-size: 12px;
    margin-top: 5px;
}

.woo-error-border {
    border-color: #d63638 !important;
}

/* Success States */
.woo-success {
    color: #00a32a;
    font-size: 12px;
    margin-top: 5px;
}

.woo-success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #00a32a;
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    font-weight: 500;
    animation: wooSlideIn 0.3s ease-out;
}

@keyframes wooSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Accessibility */
.woo-modal:focus {
    outline: none;
}

.woo-modal-content:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .woo-upload-dropzone {
        border-color: #000;
    }
    
    .woo-upload-dropzone:hover,
    .woo-upload-dropzone.dragover {
        border-color: #000;
        background: #fff;
    }
}
