/* WooCommerce Cross-Sells Frontend Styles */

.wc-cross-sells-container {
    margin: 20px 0;
    padding: 20px 0;
    border-top: 1px solid #e1e1e1;
}

.wc-cross-sells-title {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    text-align: left;
}

.wc-cross-sells-grid {
    display: grid;
    gap: 0px;
}

/* Horizontal layout (default) - products side by side */
.wc-cross-sells-horizontal {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Apply max height to horizontal layout product cards */
.wc-cross-sells-horizontal .wc-cross-sells-product-card {
    max-height: var(--wc-cross-sells-max-height, 400px);
    overflow: hidden;
}

/* Vertical layout - one product per row */
.wc-cross-sells-vertical {
    grid-template-columns: 1fr;
    max-width: var(--wc-cross-sells-max-width, 600px);
    margin: 0 auto;
}

.wc-cross-sells-item {
    position: relative;
}

.wc-cross-sells-product-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.wc-cross-sells-product-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.wc-cross-sells-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1;
}

.wc-cross-sells-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.wc-cross-sells-product-card:hover .wc-cross-sells-image img {
    transform: scale(1.05);
}

.wc-cross-sells-quick-view {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wc-cross-sells-image:hover .wc-cross-sells-quick-view {
    opacity: 1;
}

.wc-cross-sells-quick-view:hover {
    background: rgba(0,0,0,0.9);
}

.wc-cross-sells-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Vertical layout specific styling - New compact design */
.wc-cross-sells-vertical-card {
    flex-direction: row;
    height: auto;
    min-height: 80px;
    align-items: stretch;
    border: 1px solid #e0e0e0;
    background: #fafafa;
    margin-bottom: 5px;
    padding: 12px;
}

.wc-cross-sells-vertical-card .wc-cross-sells-image {
    flex: 0 0 60px;
    aspect-ratio: 1;
    margin-right: 12px;
}

.wc-cross-sells-vertical-card .wc-cross-sells-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.wc-cross-sells-vertical-card .wc-cross-sells-info {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Header section with title and price */
.wc-cross-sells-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.wc-cross-sells-vertical-card .wc-cross-sells-product-title {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    flex: 1;
    margin-right: 10px;
}

.wc-cross-sells-vertical-card .wc-cross-sells-product-title a {
    color: #333;
    text-decoration: none;
}

.wc-cross-sells-vertical-card .wc-cross-sells-product-title a:hover {
    color: #007cba;
}

.wc-cross-sells-vertical-card .wc-cross-sells-price {
    margin: 0;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    flex-shrink: 0;
}

/* Controls row styling */
.wc-cross-sells-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Quantity controls */
.wc-cross-sells-quantity {
    display: flex;
    align-items: stretch;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    height: 40px;
    margin: 0;
    padding: 0;
    gap: 0;
    box-sizing: border-box;
    max-width: 18%;
}

.wc-cross-sells-qty-btn {
    background: #f8f9fa;
    border: none;
    width: 32px;
    height: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    color: #495057;
    transition: all 0.15s ease;
    position: relative;
    border-right: 1px solid #e9ecef;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    line-height: 1;
    vertical-align: top;
}

.wc-cross-sells-qty-minus {
    border-radius: 0 !important;
}

.wc-cross-sells-qty-btn:last-child {
    border-right: none;
    border-left: 1px solid #e9ecef;
    border-radius: 0 !important;
}

.wc-cross-sells-qty-btn:hover {
    background: #007cba;
    color: #fff;
    transform: scale(1.05);
}

.wc-cross-sells-qty-btn:active {
    transform: scale(0.95);
    transition: all 0.1s ease;
}

.wc-cross-sells-qty-btn:disabled {
    background: #f8f9fa;
    color: #adb5bd;
    cursor: not-allowed;
    transform: none;
}

.wc-cross-sells-qty-btn:disabled:hover {
    background: #f8f9fa;
    color: #adb5bd;
    transform: none;
}

.wc-cross-sells-qty-input {
    border: none;
    width: 45px;
    height: 100%;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    background: #fff;
    outline: none;
    color: #495057;
    -moz-appearance: textfield;
    border-left: none;
    border-right: none;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    line-height: 1;
    vertical-align: top;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-cross-sells-qty-input:focus {
    background: #f8f9fa;
    color: #212529;
}

.wc-cross-sells-qty-input::-webkit-outer-spin-button,
.wc-cross-sells-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
    display: none;
}

/* Firefox spinner removal */
.wc-cross-sells-qty-input[type=number] {
    -moz-appearance: textfield;
    max-height: 100%;
}

/* More info button */
.wc-cross-sells-more-info {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    color: #495057;
    text-decoration: none;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    height: 32px;
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.wc-cross-sells-more-info:hover {
    background: #007cba;
    border-color: #007cba;
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 124, 186, 0.3);
}

/* Stock status badges */
.wc-cross-sells-stock-status {
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    height: fit-content;
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wc-cross-sells-stock-status.in-stock {
    background: #28a745;
    color: #fff;
}

.wc-cross-sells-stock-status.out-of-stock {
    background: #dc3545;
    color: #fff;
}

/* Restrictions text */
.wc-cross-sells-restrictions {
    margin-top: 4px;
    font-size: 11px;
    color: #666;
    font-style: italic;
}

/* Validation message area */
.wc-cross-sells-validation-message {
    padding: 6px 10px;
    margin: 6px 0;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.wc-cross-sells-validation-message.error {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #dc3545;
}

.wc-cross-sells-validation-message.success {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: #28a745;
}

/* Visual feedback for added items */
.wc-cross-sells-item-added {
    background: rgba(40, 167, 69, 0.1);
    border-color: #28a745 !important;
    transition: all 0.3s ease;
}

.wc-cross-sells-item-added .wc-cross-sells-vertical-card {
    background: rgba(40, 167, 69, 0.05);
    border-color: #28a745;
}

.wc-cross-sells-product-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.3;
}

.wc-cross-sells-product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.wc-cross-sells-product-title a:hover {
    color: #007cba;
}

.wc-cross-sells-price {
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.wc-cross-sells-price .amount {
    color: #007cba;
}

.wc-cross-sells-price del {
    color: #999;
    font-weight: normal;
}

.wc-cross-sells-cart {
    margin-top: auto;
}

.wc-cross-sells-add-to-cart,
.wc-cross-sells-select-options {
    width: 100%;
    padding: 12px 15px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    box-sizing: border-box;
}

.wc-cross-sells-add-to-cart:hover,
.wc-cross-sells-select-options:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

.wc-cross-sells-add-to-cart:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Quick View Modal */
.wc-cross-sells-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.wc-cross-sells-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    cursor: pointer;
}

.wc-cross-sells-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 90%;
    overflow: auto;
}

.wc-cross-sells-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    z-index: 10;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-cross-sells-modal-close:hover {
    color: #333;
}

.wc-cross-sells-modal-body {
    padding: 20px;
}

.wc-cross-sells-loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #666;
}

.wc-cross-sells-quick-view-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.wc-cross-sells-quick-view-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

.wc-cross-sells-quick-view-details h2 {
    margin: 0 0 15px 0;
    font-size: 24px;
    color: #333;
}

.wc-cross-sells-quick-view-price {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #007cba;
}

.wc-cross-sells-quick-view-description {
    margin: 0 0 25px 0;
    line-height: 1.6;
    color: #666;
}

.wc-cross-sells-quick-view-cart {
    margin: 0 0 20px 0;
}

.wc-cross-sells-quick-view-cart .cart {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.wc-cross-sells-quick-view-cart .quantity input {
    width: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.wc-cross-sells-quick-view-cart button,
.wc-cross-sells-quick-view-cart .button {
    padding: 12px 20px;
    background: #007cba;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
}

.wc-cross-sells-quick-view-cart button:hover,
.wc-cross-sells-quick-view-cart .button:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

.wc-cross-sells-quick-view-link {
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.wc-cross-sells-quick-view-link a {
    color: #007cba;
    text-decoration: none;
    font-size: 14px;
}

.wc-cross-sells-quick-view-link a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    .wc-cross-sells-horizontal {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    /* Reduce max height on tablets for horizontal layout */
    .wc-cross-sells-horizontal .wc-cross-sells-product-card {
        max-height: calc(var(--wc-cross-sells-max-height, 400px) * 0.8);
    }
    
    /* Reduce max width on tablets for vertical layout */
    .wc-cross-sells-vertical {
        max-width: calc(var(--wc-cross-sells-max-width, 600px) * 0.9);
    }
    
    .wc-cross-sells-vertical-card {
        min-height: 70px;
        padding: 10px;
    }
    
    .wc-cross-sells-vertical-card .wc-cross-sells-image {
        flex: 0 0 50px;
        margin-right: 10px;
    }
    
    .wc-cross-sells-vertical-card .wc-cross-sells-product-title {
        font-size: 13px;
    }
    
    .wc-cross-sells-vertical-card .wc-cross-sells-price {
        font-size: 13px;
    }
    
    .wc-cross-sells-controls {
        gap: 8px;
    }
    
    .wc-cross-sells-quantity {
        height: 28px;
    }
    
    .wc-cross-sells-qty-btn {
        width: 28px;
        height: 100%;
        font-size: 14px;
    }
    
    .wc-cross-sells-qty-input {
        width: 38px;
        height: 100%;
        font-size: 13px;
    }
    
    .wc-cross-sells-more-info {
        height: 28px;
        padding: 5px 10px;
        font-size: 11px;
    }
    
    .wc-cross-sells-quick-view-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .wc-cross-sells-modal-content {
        width: 95%;
        margin: 20px;
    }
}

@media (max-width: 480px) {
    .wc-cross-sells-horizontal {
        grid-template-columns: 1fr;
    }
    
    /* Further reduce max height on mobile for horizontal layout */
    .wc-cross-sells-horizontal .wc-cross-sells-product-card {
        max-height: calc(var(--wc-cross-sells-max-height, 400px) * 0.6);
    }
    
    .wc-cross-sells-grid {
        gap: 0px;
    }
    
    .wc-cross-sells-container {
        margin: 20px 0;
        padding: 15px 0;
    }
    
    .wc-cross-sells-title {
        font-size: 20px;
        margin-bottom: 15px;
    }
    
    /* Use full width on mobile for vertical layout */
    .wc-cross-sells-vertical {
        max-width: 100%;
    }
    
    .wc-cross-sells-vertical-card {
        min-height: 60px;
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .wc-cross-sells-vertical-card .wc-cross-sells-image {
        flex: 0 0 45px;
        margin-right: 8px;
    }
    
    .wc-cross-sells-vertical-card .wc-cross-sells-product-title {
        font-size: 12px;
        margin-right: 8px;
    }
    
    .wc-cross-sells-vertical-card .wc-cross-sells-price {
        font-size: 12px;
    }
    
    .wc-cross-sells-controls {
        gap: 6px;
        flex-wrap: wrap;
    }
    
    /* Compact variations on mobile */
    .wc-cross-sells-variations {
        gap: 6px;
    }
    
    .wc-cross-sells-variation-group {
        gap: 3px;
    }
    
    .wc-cross-sells-variation-label {
        font-size: 9px;
    }
    
    .wc-cross-sells-variation-option.color-swatch {
        width: 18px;
        height: 18px;
    }
    
    .wc-cross-sells-variation-option.text-option {
        height: 18px;
        padding: 2px 4px;
        font-size: 8px;
        min-width: 18px;
    }
    
    .wc-cross-sells-quantity {
        height: 26px;
    }
    
    .wc-cross-sells-qty-btn {
        width: 26px;
        height: 100%;
        font-size: 12px;
    }
    
    .wc-cross-sells-qty-input {
        width: 32px;
        height: 100%;
        font-size: 12px;
    }
    
    .wc-cross-sells-more-info {
        height: 26px;
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .wc-cross-sells-stock-status {
        font-size: 9px;
        padding: 3px 6px;
    }
    
    .wc-cross-sells-quick-view-cart .cart {
        flex-direction: column;
        align-items: stretch;
    }
    
    .wc-cross-sells-quick-view-cart .quantity {
        text-align: center;
    }
}

/* Animation for adding to cart */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.wc-cross-sells-add-to-cart.adding {
    animation: pulse 0.3s ease;
}

/* Success message */
.wc-cross-sells-success {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: #fff;
    padding: 15px 20px;
    border-radius: 4px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

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

/* Layout Direction Styles */
.wc-cross-sells-container[data-layout-direction="vertical"] {
    border-top: none;
    padding-top: 0;
}

/* Simplified layout animations */
.wc-cross-sells-item {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

/* Optional subtle animation for enhanced experience */
.wc-cross-sells-item-visible {
    animation: subtle-fade-in 0.6s ease-out;
}

@keyframes subtle-fade-in {
    from {
        opacity: 0.7;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Error notification styles */
.wc-cross-sells-error {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: #fff;
    padding: 15px 20px;
    border-radius: 4px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

/* Lazy loading image placeholder */
.wc-cross-sells-image img[data-src] {
    background: #f5f5f5;
    min-height: 200px;
}

/* Enhanced hover effects */
.wc-cross-sells-item:hover {
    transform: translateY(-2px);
    transition: transform 0.3s ease;
}

/* Variation Selectors */
.wc-cross-sells-variations {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wc-cross-sells-variation-group {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wc-cross-sells-variation-label {
    font-size: 10px;
    font-weight: 600;
    color: #333;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.wc-cross-sells-variation-options {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    align-items: center;
}

.wc-cross-sells-variation-option {
    cursor: pointer;
    border: 1px solid #e0e0e0;
    background: #fff;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 500;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    user-select: none;
}

/* Color swatches */
.wc-cross-sells-variation-option.color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #e0e0e0, 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.wc-cross-sells-variation-option.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #007cba, 0 2px 5px rgba(0, 124, 186, 0.3);
}

.wc-cross-sells-variation-option.color-swatch.selected {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #007cba, 0 2px 5px rgba(0, 124, 186, 0.4);
}

.wc-cross-sells-variation-option.color-swatch.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 0 0 1px #e0e0e0 !important;
}

/* Text options */
.wc-cross-sells-variation-option.text-option {
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 20px;
    height: 20px;
    color: #495057;
    font-size: 9px;
    flex-shrink: 0;
}

.wc-cross-sells-variation-option.text-option:hover {
    background: #f8f9fa;
    border-color: #007cba;
    color: #007cba;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.wc-cross-sells-variation-option.text-option.selected {
    background: #007cba;
    border-color: #007cba;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 124, 186, 0.3);
}

.wc-cross-sells-variation-option.text-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8f9fa;
    color: #adb5bd;
    transform: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.wc-cross-sells-variation-option.text-option.disabled:hover {
    background: #f8f9fa;
    border-color: #e0e0e0;
    color: #adb5bd;
}

/* Hidden input for selected variation */
.wc-cross-sells-selected-variation {
    display: none;
}

/* Additional responsive breakpoints */
@media (min-width: 1200px) {
    .wc-cross-sells-container {
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
    }

    
}

@media (min-width: 769px) and (max-width: 1024px) {
    /* Tablet landscape adjustments */
    .wc-cross-sells-horizontal {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 640px) {
    /* Small tablet adjustments */
    .wc-cross-sells-horizontal {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 360px) {
    /* Extra small mobile phones */
    .wc-cross-sells-horizontal {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    /* Minimum viable height on very small screens */
    .wc-cross-sells-horizontal .wc-cross-sells-product-card {
        max-height: calc(var(--wc-cross-sells-max-height, 400px) * 0.5);
        min-height: 200px;
    }
    
    .wc-cross-sells-container {
        margin: 15px 0;
        padding: 10px 0;
    }
    
    .wc-cross-sells-vertical .wc-cross-sells-product-card {
        min-height: 70px;
    }
    
    .wc-cross-sells-vertical .wc-cross-sells-image {
        flex: 0 0 70px;
    }
} 