/**
 * Woodmart Attribute Grid - Complete Redesign
 * Custom styling to match modern e-commerce designs
 */

/* Reset - Prevent conflicts with other elements */
.wag-reset * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Main container - clean and simple */
.wag-attribute-grid {
    margin: 30px 0;
    width: 100%;
    font-family: inherit;
    line-height: 1.4;
}

/* Section title styling */
.wag-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(129, 129, 129, 0.2);
    color: #333;
}

/* Attribute container */
.wag-attribute-container {
    margin-bottom: 20px;
}

/* Attribute label */
.wag-attribute-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

/* Swatch grid container */
.wag-swatch-grid {
    display: grid;
    grid-template-columns: repeat(var(--wag-columns, 4), 1fr);
    gap: 15px;
    width: 100%;
}

/* Individual swatch wrapper */
.wag-swatch-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Base swatch styling */
.wag-swatch {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 65px;
    height: 65px;
    cursor: pointer;
    margin: 0 auto;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

/* Swatch hover effects */
.wag-swatch:hover,
.wag-swatch-link:hover .wag-swatch {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Swatch types */
.wag-swatch-image {
    background-size: cover;
    background-position: center;
}

.wag-swatch-color {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wag-swatch-text {
    background-color: #f7f7f7;
    font-size: 12px;
    padding: 5px;
}

/* Swatch label */
.wag-swatch-label {
    margin-top: 8px;
    font-size: 13px;
    color: #333;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Link styling */
.wag-swatch-link, 
.wag-swatch-label-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.wag-swatch-label-link {
    color: #333;
    transition: color 0.2s ease;
}

.wag-swatch-label-link:hover {
    color: #2271b1;
    text-decoration: none;
}

/* Tooltip styling */
.wag-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 12px;
    background: #ffffff;
    color: #333333;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
    min-width: 150px;
    max-width: 250px;
    width: max-content;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #f0f0f0;
    text-align: center;
}

/* Tooltip arrow */
.wag-tooltip:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 8px 0 8px;
    border-color: #ffffff transparent transparent transparent;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

/* Show tooltip on hover */
.wag-swatch-wrapper:hover .wag-tooltip {
    opacity: 1;
    visibility: visible;
    margin-bottom: 10px;
}

/* Custom attribute values */
.wag-custom-attribute-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.wag-custom-attribute-item {
    padding: 5px 10px;
    background-color: #f7f7f7;
    border-radius: 3px;
    font-size: 12px;
    border: 1px solid rgba(129, 129, 129, 0.2);
    transition: all 0.2s ease;
}

.wag-custom-attribute-item:hover {
    background-color: #f0f0f0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.wag-custom-attribute-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: color 0.2s ease;
}

.wag-custom-attribute-link:hover {
    color: #2271b1;
}

/* Error and notice messages */
.wag-notice {
    padding: 12px 15px;
    background-color: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-align: center;
    margin: 15px 0;
}

.wag-error {
    background-color: #fff5f5;
    border-color: #ffcccc;
    color: #d63638;
}

/* Make sure tooltips don't interfere with WooCommerce elements */
.wag-tooltip {
    white-space: normal;
}

/* Reset any WooCommerce/Woodmart styles that might conflict */
.summary-inner .wag-attribute-grid {
    margin-top: 20px;
}

/* Prevent conflicts with variation buttons */
.variations .wag-attribute-grid {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(129, 129, 129, 0.2);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .wag-swatch-grid {
        --wag-columns: 3;
    }
}

@media (max-width: 768px) {
    .wag-swatch-grid {
        --wag-columns: 3;
        gap: 12px;
    }
    
    .wag-swatch {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .wag-swatch-grid {
        --wag-columns: 2;
        gap: 10px;
    }
    
    .wag-swatch {
        width: 55px;
        height: 55px;
    }
    
    .wag-tooltip {
        min-width: 140px;
        max-width: 200px;
        padding: 10px;
        font-size: 12px;
    }
    
    .wag-swatch-label {
        font-size: 12px;
    }
}
