/* Woo Image Selector Addon - Frontend Styles */

/* Product Page Image Selector */
.wisa-product-image-selector {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.wisa-selector-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 16px;
}

.wisa-selector-instruction {
    display: block;
    margin-bottom: 15px;
    color: #666;
    font-size: 13px;
    line-height: 1.4;
}

.wisa-image-select {
    /* Hidden input - no styling needed */
    display: none;
}

.wisa-image-preview {
    text-align: center;
    min-height: 120px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.wisa-preview-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.wisa-preview-img {
    max-width: 100%;
    max-height: 100px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.wisa-preview-img:hover {
    transform: scale(1.05);
}

.wisa-preview-title-container {
    width: 100%;
    text-align: center;
}

.wisa-preview-title {
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    background: #f9f9f9;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid #e1e1e1;
    line-height: 1.3;
    word-wrap: break-word;
    max-width: 100%;
}

/* Cart and Checkout Display */
.wisa-image-display {
    margin: 10px 0;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.wisa-image-container {
    flex-shrink: 0;
}

.wisa-selected-image {
    border-radius: 4px;
    border: 1px solid #ddd;
    object-fit: cover;
}

.wisa-image-info {
    flex-grow: 1;
    min-width: 0;
}

.wisa-design-label {
    display: block;
    font-weight: 600;
    color: #333;
    font-size: 12px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wisa-design-title {
    display: block;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.wisa-image-info .wisa-font-label,
.wisa-image-info .wisa-font-title {
    display: block;
    font-size: 13px;
    color: #666;
}

.wisa-image-info .wisa-font-label {
    font-weight: 600;
    color: #333;
    font-size: 11px;
    margin-top: 8px;
    text-transform: uppercase;
}

/* Context-specific styling */
.wisa-cart {
    background: #f0f8ff;
    border-color: #b3d9ff;
}

.wisa-checkout {
    background: #f0fff0;
    border-color: #b3ffb3;
    padding: 8px;
}

.wisa-cart-meta {
    background: transparent;
    border: none;
    padding: 5px 0;
    margin: 5px 0;
}

.wisa-cart-meta .wisa-design-label {
    font-size: 11px;
    margin-bottom: 2px;
}

.wisa-cart-meta .wisa-design-title {
    font-size: 12px;
    font-weight: 500;
}

.wisa-order-review {
    background: #fff9e6;
    border-color: #ffcc99;
}

/* Fallback Display */
.wisa-fallback {
    background: #fff5f5;
    border-color: #ffcccc;
}

.wisa-missing-image {
    font-size: 24px;
    color: #999;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border: 1px dashed #ccc;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wisa-product-image-selector {
        margin: 15px 0;
        padding: 12px;
    }
    
    .wisa-image-preview {
        min-height: 100px;
    }
    
    .wisa-preview-img {
        max-height: 80px;
    }
    
    .wisa-preview-title {
        font-size: 12px;
        padding: 5px 10px;
    }
    
    .wisa-image-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        text-align: center;
    }
    
    .wisa-image-container {
        align-self: center;
    }
    
    .wisa-image-info {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .wisa-product-image-selector {
        margin: 10px 0;
        padding: 10px;
    }
    
    .wisa-selector-label {
        font-size: 15px;
    }
    
    .wisa-selector-instruction {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .wisa-preview-title {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .wisa-image-display {
        padding: 8px;
    }
    
    .wisa-design-label {
        font-size: 11px;
    }
    
    .wisa-design-title {
        font-size: 13px;
    }
}

/* Cart Table Integration */
.woocommerce-cart-form .wisa-image-display,
.woocommerce-checkout-review-order .wisa-image-display {
    margin: 5px 0;
    font-size: 12px;
}

.woocommerce-cart-form .wisa-selected-image,
.woocommerce-checkout-review-order .wisa-selected-image {
    width: 50px;
    height: 50px;
}

/* Mini Cart */
.widget_shopping_cart .wisa-image-display {
    margin: 5px 0;
    padding: 5px;
    font-size: 11px;
}

.widget_shopping_cart .wisa-selected-image {
    width: 30px;
    height: 30px;
}

.widget_shopping_cart .wisa-design-label {
    font-size: 10px;
}

.widget_shopping_cart .wisa-design-title {
    font-size: 11px;
}

/* Loading States */
.wisa-loading {
    position: relative;
    opacity: 0.6;
}

.wisa-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: wisa-spin 1s linear infinite;
}

@keyframes wisa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.wisa-error {
    background: #ffebee;
    border-color: #f44336;
    color: #c62828;
}

.wisa-error .wisa-design-title::after {
    content: ' (Error loading image)';
    font-size: 11px;
    color: #f44336;
}

/* Accessibility */
.wisa-image-display:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.wisa-selected-image[alt=""] {
    outline: 1px solid #ff9800;
}

/* Print Styles */
@media print {
    .wisa-image-display {
        background: white !important;
        border: 1px solid #000 !important;
        break-inside: avoid;
    }
    
    .wisa-selected-image {
        max-width: 2cm;
        max-height: 2cm;
    }
    
    .wisa-design-label,
    .wisa-design-title {
        color: #000 !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .wisa-image-display {
        border-width: 2px;
        border-color: #000;
    }
    
    .wisa-design-label,
    .wisa-design-title {
        color: #000;
    }
    
    .wisa-selected-image {
        border-width: 2px;
        border-color: #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .wisa-preview-img {
        transition: none;
    }
    
    .wisa-preview-img:hover {
        transform: none;
    }
    
    @keyframes wisa-spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(0deg); }
    }
}

/* ===== POPUP GALLERY STYLES ===== */

/* Selector Controls Container */
.wisa-selector-controls {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

/* Gallery Button - Now the primary interface */
.wisa-gallery-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: 200px;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

.wisa-primary-button {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.wisa-primary-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.wisa-primary-button:hover::before {
    left: 100%;
}

.wisa-gallery-button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.wisa-gallery-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.4);
}

.wisa-gallery-button:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 115, 170, 0.2);
}

.wisa-gallery-text {
    font-size: 15px;
    font-weight: 600;
}

/* Modal Overlay */
.wisa-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wisa-modal.wisa-modal-open {
    display: flex;
    opacity: 1;
}

.wisa-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

/* Modal Container */
.wisa-modal-container {
    position: relative;
    margin: auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.wisa-modal.wisa-modal-open .wisa-modal-container {
    transform: scale(1);
}

/* Modal Header */
.wisa-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e1e1e1;
    background: #f9f9f9;
    border-radius: 8px 8px 0 0;
}

.wisa-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.wisa-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.wisa-modal-close:hover {
    background: #e1e1e1;
    color: #333;
}

.wisa-modal-close:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

/* Modal Body */
.wisa-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    max-height: calc(90vh - 140px);
}

/* Gallery Grid */
.wisa-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 0;
}

/* Gallery Item */
.wisa-gallery-item {
    position: relative;
    background: white;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.wisa-gallery-item:hover {
    border-color: #0073aa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wisa-gallery-item:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.3);
}

.wisa-gallery-item.wisa-selected {
    border-color: #00a32a;
    background: #f0f8f0;
}

.wisa-gallery-item.wisa-selected .wisa-selection-indicator {
    opacity: 1;
    transform: scale(1);
}

/* Gallery Image Container */
.wisa-gallery-image-container {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f5f5f5;
}

.wisa-gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.wisa-gallery-item:hover .wisa-gallery-image {
    transform: scale(1.05);
}

/* Selection Indicator */
.wisa-selection-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: #00a32a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

.wisa-checkmark {
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Image Loading */
.wisa-image-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
}

.wisa-gallery-item.wisa-loading .wisa-image-loading {
    display: flex;
}

.wisa-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: wisa-spin 1s linear infinite;
}

/* Gallery Item Info */
.wisa-gallery-item-info {
    padding: 12px;
    background: white;
    border-top: 1px solid #e1e1e1;
}

.wisa-gallery-item-title {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    text-align: center;
    line-height: 1.3;
    word-wrap: break-word;
}

/* Modal Footer */
.wisa-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e1e1e1;
    background: #f9f9f9;
    border-radius: 0 0 8px 8px;
}

.wisa-gallery-instructions {
    margin: 0;
    font-size: 13px;
    color: #666;
    text-align: center;
}

/* Responsive Design for Gallery */
@media (max-width: 768px) {
    .wisa-selector-controls {
        margin-bottom: 12px;
    }
    
    .wisa-gallery-button {
        padding: 14px 20px;
        font-size: 14px;
        min-width: 180px;
    }
    
    .wisa-gallery-text {
        font-size: 14px;
    }
    
    .wisa-modal-container {
        width: 95vw;
        max-height: 95vh;
        margin: 2.5vh auto;
    }
    
    .wisa-modal-header {
        padding: 16px 20px;
    }
    
    .wisa-modal-title {
        font-size: 16px;
    }
    
    .wisa-modal-body {
        padding: 20px;
        max-height: calc(95vh - 120px);
    }
    
    .wisa-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .wisa-gallery-item-info {
        padding: 8px;
    }
    
    .wisa-gallery-item-title {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .wisa-selector-instruction {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .wisa-gallery-button {
        padding: 12px 16px;
        font-size: 13px;
        min-width: 160px;
    }
    
    .wisa-gallery-text {
        font-size: 13px;
    }
    
    .wisa-modal-container {
        width: 98vw;
        max-height: 98vh;
        margin: 1vh auto;
        border-radius: 4px;
    }
    
    .wisa-modal-header {
        padding: 12px 16px;
    }
    
    .wisa-modal-body {
        padding: 16px;
    }
    
    .wisa-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .wisa-selection-indicator {
        width: 20px;
        height: 20px;
        top: 6px;
        right: 6px;
    }
    
    .wisa-checkmark {
        font-size: 10px;
    }
}

/* High Contrast Mode for Gallery */
@media (prefers-contrast: high) {
    .wisa-gallery-item {
        border-width: 3px;
    }
    
    .wisa-gallery-item:hover,
    .wisa-gallery-item:focus {
        border-color: #000;
    }
    
    .wisa-gallery-item.wisa-selected {
        border-color: #000;
        background: #fff;
    }
    
    .wisa-modal-overlay {
        background: rgba(0, 0, 0, 0.9);
    }
}

/* Reduced Motion for Gallery */
@media (prefers-reduced-motion: reduce) {
    .wisa-gallery-item,
    .wisa-gallery-image,
    .wisa-selection-indicator,
    .wisa-modal,
    .wisa-modal-container {
        transition: none;
    }
    
    .wisa-gallery-item:hover {
        transform: none;
    }
    
    .wisa-gallery-item:hover .wisa-gallery-image {
        transform: none;
    }
    
    .wisa-modal.wisa-modal-open .wisa-modal-container {
        transform: scale(1);
    }
}

/* Print Styles for Gallery */
@media print {
    .wisa-modal {
        display: none !important;
    }
    
    .wisa-gallery-button {
        display: none !important;
    }
}

/* ===== CUSTOM UPLOAD STYLES ===== */

/* Custom Upload Button */
.wisa-custom-button {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    margin-left: 12px;
}

.wisa-custom-button:hover {
    background: linear-gradient(135deg, #1e7e34 0%, #155724 100%);
}

.wisa-custom-text {
    font-size: 15px;
    font-weight: 600;
}

/* Custom Upload Modal Container */
.wisa-custom-upload-container {
    max-width: 600px;
    width: 90vw;
}

/* Custom Upload Body */
.wisa-custom-upload-body {
    padding: 32px;
}

/* Upload Form */
.wisa-upload-form {
    width: 100%;
}

/* Upload Dropzone */
.wisa-upload-dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 24px;
    position: relative;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wisa-upload-dropzone:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.wisa-upload-dropzone.wisa-drag-over {
    border-color: #28a745;
    background: #f0fff0;
    transform: scale(1.02);
}

.wisa-dropzone-content {
    pointer-events: none;
}

.wisa-upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.wisa-dropzone-text {
    font-size: 16px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.4;
}

.wisa-browse-button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    pointer-events: all;
}

.wisa-browse-button:hover {
    background: #005a87;
}

/* Upload Progress */
.wisa-upload-progress {
    margin-bottom: 24px;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #e1e1e1;
}

.wisa-progress-bar {
    width: 100%;
    height: 8px;
    background: #e1e1e1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.wisa-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #28a745);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.wisa-progress-text {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-align: center;
    display: block;
}

/* Upload Preview */
.wisa-upload-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid #e1e1e1;
    margin-bottom: 24px;
}

.wisa-preview-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.wisa-preview-info {
    flex-grow: 1;
    min-width: 0;
}

.wisa-preview-filename {
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    word-wrap: break-word;
    font-size: 14px;
}

.wisa-preview-dimensions {
    color: #666;
    margin: 0;
    font-size: 12px;
}

/* Upload Requirements */
.wisa-upload-requirements {
    background: #fff9e6;
    border: 1px solid #ffcc99;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 24px;
}

.wisa-upload-requirements h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 14px;
    font-weight: 600;
}

.wisa-upload-requirements ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
}

.wisa-upload-requirements li {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.wisa-upload-requirements li:last-child {
    margin-bottom: 0;
}

/* Design Title Field */
.wisa-design-title-field {
    margin-bottom: 24px;
}

.wisa-design-title-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.wisa-title-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.wisa-title-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

/* Upload Actions */
.wisa-upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 16px;
}

.wisa-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 100px;
}

.wisa-primary-button {
    background: #0073aa;
    color: white;
}

.wisa-primary-button:hover:not(:disabled) {
    background: #005a87;
}

.wisa-secondary-button {
    background: #f1f1f1;
    color: #333;
    border: 1px solid #ddd;
}

.wisa-secondary-button:hover {
    background: #e1e1e1;
}

.wisa-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Upload Messages */
.wisa-upload-messages {
    margin-top: 16px;
}

.wisa-message {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.wisa-message.wisa-success {
    background: #f0fff0;
    border: 1px solid #28a745;
    color: #155724;
}

.wisa-message.wisa-error {
    background: #fff5f5;
    border: 1px solid #dc3545;
    color: #721c24;
}

/* Modal States */
.wisa-modal.wisa-uploading .wisa-upload-dropzone {
    pointer-events: none;
    opacity: 0.6;
}

.wisa-modal.wisa-upload-success .wisa-upload-dropzone {
    border-color: #28a745;
    background: #f0fff0;
}

.wisa-modal.wisa-upload-error .wisa-upload-dropzone {
    border-color: #dc3545;
    background: #fff5f5;
}

/* Responsive Design for Custom Upload */
@media (max-width: 768px) {
    .wisa-custom-button {
        margin-left: 8px;
        padding: 12px 16px;
        font-size: 13px;
        min-width: 140px;
    }
    
    .wisa-custom-upload-container {
        width: 95vw;
        max-height: 95vh;
    }
    
    .wisa-custom-upload-body {
        padding: 24px 20px;
    }
    
    .wisa-upload-dropzone {
        padding: 30px 15px;
        min-height: 160px;
    }
    
    .wisa-upload-icon {
        font-size: 36px;
        margin-bottom: 12px;
    }
    
    .wisa-dropzone-text {
        font-size: 14px;
    }
    
    .wisa-upload-preview {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .wisa-preview-image {
        width: 100px;
        height: 100px;
    }
    
    .wisa-upload-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .wisa-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .wisa-selector-controls {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .wisa-custom-button {
        margin-left: 0;
        margin-top: 8px;
    }
    
    .wisa-custom-upload-container {
        width: 98vw;
        max-height: 98vh;
        margin: 1vh auto;
    }
    
    .wisa-custom-upload-body {
        padding: 20px 16px;
    }
    
    .wisa-upload-dropzone {
        padding: 24px 12px;
        min-height: 140px;
    }
    
    .wisa-upload-icon {
        font-size: 32px;
        margin-bottom: 10px;
    }
    
    .wisa-dropzone-text {
        font-size: 13px;
        margin-bottom: 16px;
    }
    
    .wisa-browse-button {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* High Contrast Mode for Custom Upload */
@media (prefers-contrast: high) {
    .wisa-upload-dropzone {
        border-width: 3px;
        border-color: #000;
    }
    
    .wisa-upload-dropzone:hover,
    .wisa-upload-dropzone.wisa-drag-over {
        border-color: #000;
        background: #fff;
    }
    
    .wisa-browse-button {
        border: 2px solid #000;
    }
    
    .wisa-button {
        border: 2px solid #000;
    }
}

/* Reduced Motion for Custom Upload */
@media (prefers-reduced-motion: reduce) {
    .wisa-upload-dropzone,
    .wisa-progress-fill,
    .wisa-browse-button,
    .wisa-button {
        transition: none;
    }
    
    .wisa-upload-dropzone.wisa-drag-over {
        transform: none;
    }
}

/* Print Styles for Custom Upload */
@media print {
    .wisa-custom-upload-modal {
        display: none !important;
    }
    
    .wisa-custom-button {
        display: none !important;
    }
}

/* ===== ADD TO CART BUTTON FIX ===== */
/* Ensure the add-to-cart button is properly enabled when design is selected */
.single_add_to_cart_button.wisa-design-selected,
button.single_add_to_cart_button.wisa-design-selected,
input.single_add_to_cart_button.wisa-design-selected {
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    background-color: #0073aa !important;
    color: #fff !important;
    border-color: #0073aa !important;
}

/* Override WooCommerce disabled states when design is selected */
.single_add_to_cart_button.wisa-design-selected:disabled,
.single_add_to_cart_button.wisa-design-selected.disabled,
.single_add_to_cart_button.wisa-design-selected.wc-variation-is-unavailable {
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    background-color: #0073aa !important;
    color: #fff !important;
    border-color: #0073aa !important;
}

/* Visual feedback for enabled state */
.single_add_to_cart_button.wisa-design-selected::before {
    content: "✓ ";
    color: #4CAF50;
    font-weight: bold;
}

/* Ensure the button stays clickable regardless of other CSS */
.single_add_to_cart_button.wisa-design-selected[disabled],
.single_add_to_cart_button.wisa-design-selected[aria-disabled="true"] {
    pointer-events: auto !important;
    cursor: pointer !important;
    opacity: 1 !important;
}

/* Remove any theme-specific disabled styling */
.woocommerce .single_add_to_cart_button.wisa-design-selected:disabled,
.woocommerce .single_add_to_cart_button.wisa-design-selected.disabled,
.woocommerce .single_add_to_cart_button.wisa-design-selected.wc-variation-is-unavailable {
    background-color: #0073aa !important;
    color: #fff !important;
    opacity: 1 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* Force override any inline styles that might disable the button */
.single_add_to_cart_button.wisa-design-selected[style*="pointer-events"] {
    pointer-events: auto !important;
}

.single_add_to_cart_button.wisa-design-selected[style*="opacity"] {
    opacity: 1 !important;
}

.single_add_to_cart_button.wisa-design-selected[style*="cursor"] {
    cursor: pointer !important;
}
/*
 * WISA - Mobile Cart Display Fix
 *
 * Overrides default WooCommerce responsive styles that hide product
 * thumbnails and names on small screens (< 768px). This ensures
 * that both the product details and the selected WISA design are
 * always visible.
 */
@media (max-width: 768px) {

    /*
     * Use highly specific selectors to override woocommerce-smallscreen.css
     * and ensure vital product info is never hidden in the cart.
     */
    .woocommerce-cart-form table.cart .cart_item .product-thumbnail,
    .woocommerce-cart-form table.cart .cart_item .product-name {
        display: block !important; /* Force display against `display: none;` */
        width: 100% !important;   /* Take full width for a clean, stacked look */
    }

    /*
     * Reset table cell styles for a better block-level appearance on mobile.
     */
    .woocommerce-cart-form table.cart .cart_item td,
    .woocommerce-cart-form table.cart .cart_item th {
        border: none !important;         /* Remove borders for a cleaner look */
        padding: 15px 0 !important;     /* Adjust padding for vertical rhythm */
        text-align: center !important;  /* Center-align all content */
    }

    /*
     * Ensure the product link and WISA display are well-formatted.
     */
    .woocommerce-cart-form .cart_item .product-name a {
        font-size: 1.1em;
        font-weight: bold;
        display: block;
        margin-bottom: 15px; /* Add space between product name and WISA info */
    }

    /*
     * Style the WISA selected image block for mobile.
     */
    .woocommerce-cart-form .wisa-image-display {
        margin: 0 auto;           /* Center the block within its container */
        max-width: 300px;         /* Constrain width for very small screens */
        flex-direction: column;   /* Stack image and info vertically */
        align-items: center;      /* Center-align items */
    }
}

/* WTC - Text Customizer Cart Display Fix */
.woocommerce-cart-form dl.variation dt,
.woocommerce-cart-form dl.variation dd {
    display: inline;
    float: none;
    margin-bottom: 5px; /* Adds space between each line item */
}

.woocommerce-cart-form dl.variation dt {
    font-weight: bold;
    padding-right: 5px;
    clear: left;
}

/* Force each pair to a new line */
.woocommerce-cart-form dl.variation dd::after {
    content: "";
    display: block;
    clear: both;
}

.woocommerce-cart-form dl.variation dd p {
    display: inline;
    margin: 0;
}
/* Fix for variation text alignment in cart */
dl.variation dd p {
    display: inline;
    margin: 0;
    padding: 0;
}