/**
 * Product Characteristics Styles
 *
 * Simple, reliable tooltip implementation
 */

/* Main Section */
.product-characteristics-section h2.characteristics-heading {
    color: #333;
    font-size: 1.5em;
    font-weight: 600;
}

/* Table Styling - Traditional WooCommerce */
.product-characteristics-section .shop_attributes {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.618em;
}

.product-characteristics-section .shop_attributes th {
    font-weight: 700;
    padding: 8px 8px 8px 0;
    vertical-align: top;
    width: 25%;
    color: #636363;
    border-bottom: 1px dotted rgba(0, 0, 0, 0.1);
    line-height: 1.5;
}

.product-characteristics-section .shop_attributes td {
    padding: 8px 0;
    border-bottom: 1px dotted rgba(0, 0, 0, 0.1);
    vertical-align: top;
    line-height: 1.5;
}

.product-characteristics-section .shop_attributes td p {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* Characteristic Items */
.characteristic-with-tooltip {
    position: relative;
    display: inline-block;
}

.characteristic-term-link {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: #f7f7f7;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9em;
    font-weight: normal;
    transition: all 0.2s ease;
    white-space: nowrap;
    cursor: help;
}

.characteristic-term-link:hover {
    background: #eee;
    border-color: #bbb;
    text-decoration: none;
    color: #333;
}

/* Custom field links styling */
.product-characteristics-section .shop_attributes td p a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.product-characteristics-section .shop_attributes td p a:hover {
    color: #5a67d8;
    border-bottom-color: #5a67d8;
    text-decoration: none;
}

.product-characteristics-section .shop_attributes td p a:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Tooltip wrapper */
.characteristic-with-tooltip {
    position: relative !important;
    display: inline-block !important;
}

/* Tooltip container (appended to body) */
#characteristics-tooltips {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999;
    pointer-events: none;
}

.characteristics-tooltip {
    position: fixed;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 13px;
    max-width: 250px;
    white-space: normal;
    text-align: left;
    z-index: 99999;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: auto;
    transform: translate(-50%, -100%);
}

.characteristics-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
}

.tooltip-content {
    line-height: 1.3;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Hide tooltips on mobile */
    .characteristic-with-tooltip {
        pointer-events: none;
    }

    .characteristics-tooltip {
        display: none !important;
    }

    .product-characteristics-section .shop_attributes tr {
        display: flex;
        flex-direction: column;
    }

    .product-characteristics-section .shop_attributes th {
        padding-bottom: 4px;
        border-bottom: none;
    }

    .product-characteristics-section .shop_attributes td {
        padding-top: 4px;
    }

    .characteristic-term-link {
        font-size: 0.85em;
        padding: 3px 6px;
    }

    .characteristics-tooltip {
        font-size: 12px;
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    body .product-characteristics-section .shop_attributes tbody tr {
        display: flex !important;
        flex-direction: column;
    }

    .product-characteristics-section .shop_attributes th,
    .product-characteristics-section .shop_attributes td {
        display: block;
        width: 100%;
        padding: 8px 0;
    }

    /* FAQ section mobile padding */
    .product-faq-section.wp-block-rank-math-faq-block {
        padding-left: 15px;
        padding-right: 15px;
    }
}

/* Admin button styles */
.characteristic-link-button.button.button-secondary {
    background: #667eea !important;
    border-color: #667eea !important;
    color: white !important;
    text-shadow: none !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
}

.characteristic-link-button.button.button-secondary:hover {
    background: #5a67d8 !important;
    border-color: #5a67d8 !important;
    color: white !important;
}

.characteristic-link-button.button.button-secondary:focus {
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.5) !important;
    outline: none !important;
}

/* Modal admin styles */
#characteristic-link-modal .button {
    font-size: 14px !important;
    padding: 8px 16px !important;
    height: auto !important;
    line-height: 1.4 !important;
}

#characteristic-link-modal .button-primary {
    background: #0073aa !important;
    border-color: #0073aa !important;
    color: white !important;
}

#characteristic-link-modal .button-primary:hover {
    background: #005a87 !important;
    border-color: #005a87 !important;
}

/* Animation for page load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-characteristics-section {
    animation: fadeInUp 0.6s ease-out;
}

/* Focus states for accessibility */
.characteristic-term-link:focus {
    outline: 2px solid #0073aa;
    outline-offset: 1px;
}
