/* Amazon Comparison Table Block - Modern 2026 Design */

/* =============================================
   CSS RESET FOR AMAZON IMAGES
   ============================================= */
.amazon-product-img,
.amazon-single-img,
.amazonai-product-image,
.product-image img,
.amazon-image-container img,
.amazon-comparison-showcase img,
.amazon-comparison-table img,
.product-image a img,
.amazon-comparison-showcase a img {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    float: none !important;
    display: inline-block !important;
}

.post .entry-content .amazon-comparison-showcase img,
.post .entry-content .amazon-comparison-table img,
.post .entry-content .product-image img,
.post .entry-content .product-image a img,
.entry-content .amazon-comparison-showcase img,
.entry-content .amazon-comparison-table img,
.entry-content .product-image img,
.entry-content .product-image a img {
    margin: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    float: none !important;
    display: inline-block !important;
}

/* =============================================
   MAIN CONTAINER
   ============================================= */
.amazon-comparison-showcase {
    width: 100%;
    max-width: 100%;
    margin: 2rem 0;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.04),
        0 4px 12px rgba(0, 0, 0, 0.03);
}

.amazon-comparison-container {
    width: 100%;
}

/* =============================================
   HEADER
   ============================================= */
.amazon-comparison-header {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    padding: 1.25rem 1.5rem;
    color: #ffffff;
    position: relative;
}

.amazon-comparison-title,
.entry-content .amazon-comparison-title,
.entry-content h2.amazon-comparison-title {
    color: #ffffff !important;
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    margin: 0 0 0.5rem 0 !important;
    margin-top: 0 !important;
    letter-spacing: -0.01em;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    padding-bottom: 0.5rem !important;
    padding-top: 0 !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15) !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    background: transparent !important;
}

.amazon-comparison-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 400;
    margin: 0;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* =============================================
   SCROLL HINT
   ============================================= */
.amazon-comparison-scroll-hint {
    display: block;
    text-align: center;
    padding: 0.625rem 1rem;
    margin: 0;
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.2s ease;
}

.amazon-comparison-scroll-hint:hover {
    background: #f3f4f6;
}

.amazon-comparison-scroll-hint .hint-mobile {
    display: inline;
}

.amazon-comparison-scroll-hint .hint-desktop {
    display: none;
}

@media (min-width: 768px) {
    .amazon-comparison-scroll-hint .hint-mobile {
        display: none;
    }

    .amazon-comparison-scroll-hint .hint-desktop {
        display: inline;
    }
}

/* =============================================
   TABLE WRAPPER - HORIZONTAL SCROLL
   ============================================= */
.amazon-comparison-table-wrapper {
    overflow-x: auto;
    padding: 1rem;
    background: #fafbfc;
    position: relative;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    cursor: pointer;
    transition: background 0.2s ease;
}

.amazon-comparison-table-wrapper:hover {
    background: #f5f6f7;
}

/* =============================================
   TABLE
   ============================================= */
.amazon-comparison-table {
    width: 100%;
    min-width: 800px;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Table Headers */
.amazon-comparison-table thead {
    background: #f8fafc;
}

.spec-header {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #ffffff;
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    width: 140px;
    min-width: 140px;
    vertical-align: top;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.product-header {
    padding: 1rem 0.75rem;
    text-align: center;
    vertical-align: top;
    border-bottom: 1px solid #e5e7eb;
    width: 160px;
    min-width: 160px;
    background: #fff;
}

/* =============================================
   PRODUCT COLUMN IN HEADER
   ============================================= */
.product-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
}

.product-image {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
    padding: 6px;
}

.product-image img {
    max-width: 100px;
    max-height: 100px;
    object-fit: contain;
    object-position: center;
}

.product-image a {
    display: flex;
    align-items: center;
    justify-content: center;
}

.amazon-comparison-placeholder-image {
    width: 80px;
    height: 80px;
    background: #f3f4f6;
    border-radius: 6px;
    border: 2px dashed #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    color: #9ca3af;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.product-title {
    min-height: 2.25rem;
    display: flex;
    align-items: center;
    text-align: center;
}

.product-title-link {
    color: #111827;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8125rem;
    line-height: 1.35;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: color 0.15s ease;
}

.product-title-link:hover {
    color: #2563eb;
}

/* Price Button */
.product-price {
    margin-top: auto;
}

.price-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #000;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    box-shadow:
        0 2px 4px rgba(245, 158, 11, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: nowrap;
}

.price-button:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transform: translateY(-1px);
    box-shadow:
        0 4px 8px rgba(245, 158, 11, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    color: #000;
}

/* =============================================
   TABLE BODY
   ============================================= */
.amazon-comparison-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.amazon-comparison-table tbody tr:hover {
    background: #f3f4f6;
}

.spec-name {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #ffffff;
    padding: 0.75rem;
    font-weight: 600;
    font-size: 0.75rem;
    border-right: 1px solid #374151;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.spec-value {
    padding: 0.75rem;
    text-align: center;
    color: #374151;
    font-size: 0.8125rem;
    line-height: 1.4;
    border-right: 1px solid #e5e7eb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    vertical-align: middle;
}

.spec-value:last-child {
    border-right: none;
}

/* =============================================
   FOOTER
   ============================================= */
.amazon-comparison-footer {
    padding: 1rem 1.25rem;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.amazon-comparison-footer p {
    color: #6b7280;
    font-size: 0.8125rem;
    line-height: 1.5;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* =============================================
   MODAL STYLES
   ============================================= */
.comparison-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.comparison-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    width: 95%;
    max-width: 1400px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.comparison-modal-close {
    position: sticky;
    top: 10px;
    right: 10px;
    float: right;
    font-size: 24px;
    font-weight: bold;
    color: #6b7280;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1;
    margin: 10px;
    padding: 0;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comparison-modal-close:hover {
    background: #f3f4f6;
    color: #111827;
    transform: scale(1.05);
}

#comparison-modal-body {
    clear: both;
    padding: 20px;
}

/* Modal table adjustments */
#comparison-table-modal-clone {
    width: 100%;
    min-width: auto;
}

#comparison-table-modal-clone .amazon-comparison-table {
    min-width: auto;
    width: 100%;
}

#comparison-table-modal-clone .amazon-comparison-table-wrapper {
    cursor: default;
}

#comparison-table-modal-clone .amazon-comparison-table-wrapper:hover {
    background: #fafbfc;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .amazon-comparison-showcase {
        margin: 1.5rem 0;
        border-radius: 12px;
    }

    .amazon-comparison-header {
        padding: 1rem 1.25rem;
    }

    .amazon-comparison-title {
        font-size: 1.125rem;
    }

    .amazon-comparison-subtitle {
        font-size: 0.875rem;
    }

    .amazon-comparison-table-wrapper {
        padding: 0.75rem;
    }

    .amazon-comparison-table {
        min-width: 600px;
    }

    .spec-header,
    .product-header {
        padding: 0.75rem 0.5rem;
    }

    .product-header {
        width: 140px;
        min-width: 140px;
    }

    .spec-header {
        width: 120px;
        min-width: 120px;
    }

    .product-image {
        padding: 4px;
    }

    .product-image img {
        max-width: 80px;
        max-height: 80px;
    }

    .product-title-link {
        font-size: 0.75rem;
    }

    .price-button {
        padding: 0.4rem 0.75rem;
        font-size: 0.6875rem;
    }

    .spec-name,
    .spec-value {
        padding: 0.625rem 0.5rem;
        font-size: 0.75rem;
    }

    .amazon-comparison-footer {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .amazon-comparison-table-wrapper {
        padding: 0.5rem;
    }

    .amazon-comparison-table {
        min-width: 500px;
    }

    .product-header {
        width: 120px;
        min-width: 120px;
    }

    .spec-header {
        width: 100px;
        min-width: 100px;
    }

    .product-image img {
        max-width: 70px;
        max-height: 70px;
    }

    .amazon-comparison-placeholder-image {
        width: 60px;
        height: 60px;
        font-size: 0.5rem;
    }
}

/* Reusable Amazon Image Container */
.amazon-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
    padding: 6px;
}

.amazon-image-container img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    object-position: center;
}
