/**
 * Buzzetty Price Comparison Tables - Frontend Styles
 * Modern, optimized, and professional.
 */

:root {
    --buzzpct-border-color: #e5e7eb;
    --buzzpct-bg-color: #ffffff;
    --buzzpct-text-color: #374151;
    --buzzpct-header-bg: #f9fafb;
    --buzzpct-font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.buzzpct-comparison-table {
    margin: 40px auto;
    font-family: var(--buzzpct-font-family);
    width: 100%;
    overflow-x: auto;
    font-size: 16px;
    line-height: 1.5;
    color: var(--buzzpct-text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Base Desktop Table */
.buzzpct-table-desktop {
    display: block;
    width: 100%;
}

.buzzpct-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--buzzpct-bg-color);
    border-radius: 8px;
    /* Default radius */
    overflow: hidden;
    /* For radius clipping */
}

/* Feature Column Width Defaults */
.buzzpct-feature-col {
    width: 25%;
    text-align: left;
    background: #fff;
    font-weight: 600;
    color: #4b5563;
}

.buzzpct-product-col {
    width: 25%;
    /* Will distribute evenly if fewer products */
    position: relative;
    transition: background-color 0.2s ease;
}

/* Cell Spacing & Typography */
.buzzpct-table th,
.buzzpct-table td {
    padding: 20px 24px;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid var(--buzzpct-border-color);
    border-right: 1px solid var(--buzzpct-border-color);
}

.buzzpct-table th:last-child,
.buzzpct-table td:last-child {
    border-right: none;
}

.buzzpct-table tr:last-child td {
    border-bottom: none;
}

/* Header Styling */
.buzzpct-table thead th {
    background: var(--buzzpct-header-bg);
    vertical-align: bottom;
    padding-top: 48px;
    /* Space for badges */
    padding-bottom: 24px;
}

/* Product Info */
.buzzpct-product-name {
    font-size: 1.25rem;
    /* 20px */
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: block;
}

.buzzpct-product-price {
    font-size: 1.75rem;
    /* 28px */
    font-weight: 800;
    color: var(--accent-color, #2563eb);
    margin-bottom: 0.5rem;
    display: block;
    letter-spacing: -0.02em;
}

/* Badges */
.buzzpct-badge {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--highlight-color, #16a34a);
    color: #fff;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    /* 12px */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

/* Feature Rows */
.buzzpct-feature-name {
    text-align: left !important;
    font-weight: 500;
    color: #4b5563;
    font-size: 0.95rem;
}

.buzzpct-feature-value {
    color: #374151;
    font-weight: 500;
}

/* Icons */
.buzzpct-icon-check {
    color: #16a34a;
    /* Green-600 */
    font-size: 1.25em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #dcfce7;
    /* Green-100 */
    border-radius: 50%;
}

.buzzpct-icon-cross {
    color: #dc2626;
    /* Red-600 */
    font-size: 1.25em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #fee2e2;
    /* Red-100 */
    border-radius: 50%;
    opacity: 0.8;
}

/* Buttons */
.buzzpct-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    /* Reduced padding */
    background: #f3f4f6;
    color: #374151;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 1px solid #d1d5db;
    max-width: 100%;
    /* Prevent overflow */
    box-sizing: border-box;
    /* Ensure padding doesn't add to width */
    line-height: 1.2;
    text-align: center;
    white-space: normal;
    /* Allow text wrapping if needed */
}

.buzzpct-button:hover {
    background: #e5e7eb;
    text-decoration: none;
    transform: translateY(-1px);
}

.buzzpct-button-highlight {
    background: var(--accent-color, #2563eb);
    color: #ffffff;
    border-color: var(--accent-color, #2563eb);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.buzzpct-button-highlight:hover {
    background-color: var(--accent-color, #2563eb);
    filter: brightness(110%);
    color: #ffffff;
}

/* ==========================================================================
   THEME SPECIFIC STYLES
   ========================================================================== */

/* --- Simple Theme --- */
.buzzpct-theme-simple-layout .buzzpct-table {
    border: 1px solid #e5e7eb;
    box-shadow: none;
}

.buzzpct-theme-simple-layout th,
.buzzpct-theme-simple-layout td {
    padding: 16px 20px;
}

/* Simple Highlight */
.buzzpct-theme-simple-layout .buzzpct-highlighted {
    background-color: #eff6ff;
    /* Blue-50 */
}

.buzzpct-theme-simple-layout th.buzzpct-highlighted {
    background-color: #fff;
    border-bottom: 2px solid var(--accent-color, #2563eb);
}


/* --- Modern Theme --- */
.buzzpct-theme-modern-layout .buzzpct-table {
    border: none;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-radius: 16px;
    overflow: hidden;
}

.buzzpct-theme-modern-layout th,
.buzzpct-theme-modern-layout td {
    border-right: none;
    /* No vertical borders */
    border-bottom: 1px solid #f3f4f6;
}

.buzzpct-theme-modern-layout thead th {
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    padding-top: 60px;
}

.buzzpct-theme-modern-layout .buzzpct-feature-col {
    background: #f9fafb;
    /* Gray-50 sideal */
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

/* Modern Pill Buttons */
.buzzpct-theme-modern-layout .buzzpct-button {
    border-radius: 9999px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border: none;
    background: #fff;
    color: var(--buzzpct-text-color);
    border: 1px solid #e5e7eb;
}

.buzzpct-theme-modern-layout .buzzpct-button-highlight {
    background: var(--accent-color);
    color: #fff;
    border: none;
    box-shadow: 0 10px 15px -3px rgba(var(--accent-color-rgb), 0.3);
}

/* Modern Highlight Column */
.buzzpct-theme-modern-layout .buzzpct-highlighted {
    background: linear-gradient(to bottom, #fff, #f8fafc);
    transform: scale(1.02);
    z-index: 1;
    border-radius: 12px;
    box-shadow: 0 0 0 1px rgba(var(--accent-color-rgb), 0.1), 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.buzzpct-theme-modern-layout th.buzzpct-highlighted {
    background: #fff;
    border-bottom: none;
    padding-top: 65px;
    /* Visual pop */
    margin-top: -10px;
}


/* --- Professional Theme --- */
.buzzpct-theme-professional-layout .buzzpct-table {
    border: 1px solid #cbd5e1;
    /* Slate-300 */
    border-radius: 4px;
}

.buzzpct-theme-professional-layout thead th {
    background: #1e293b;
    /* Slate-800 */
    color: #ffffff;
    border-right: 1px solid #334155;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
}

.buzzpct-theme-professional-layout .buzzpct-product-name,
.buzzpct-theme-professional-layout .buzzpct-product-price {
    color: #ffffff;
}

.buzzpct-theme-professional-layout .buzzpct-feature-col {
    background: #f1f5f9;
    /* Slate-100 */
    font-weight: 700;
    color: #334155;
}

.buzzpct-theme-professional-layout td {
    border-color: #cbd5e1;
}

/* Professional Buttons: Sharp, clean */
.buzzpct-theme-professional-layout .buzzpct-button {
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    padding: 14px 20px;
}

/* Pro Highlight Override */
.buzzpct-theme-professional-layout th.buzzpct-highlighted {
    background: var(--accent-color);
    color: #fff;
    border-bottom: none;
    box-shadow: none;
}

.buzzpct-theme-professional-layout .buzzpct-highlighted {
    background: rgba(var(--accent-color-rgb), 0.05);
}


/* ==========================================================================
   MOBILE RESPONSIVE
   ========================================================================== */
.buzzpct-table-mobile {
    display: none;
}

@media (max-width: 768px) {
    .buzzpct-table-desktop {
        display: none;
    }

    .buzzpct-table-mobile {
        display: flex;
        flex-direction: column;
        gap: 24px;
        padding: 4px 4px 0;
    }

    .buzzpct-card {
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
        border: 1px solid #e5e7eb;
        overflow: hidden;
        position: relative;
    }

    .buzzpct-card-highlighted {
        border: 2px solid var(--accent-color);
        box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.15);
    }

    .buzzpct-card-header {
        padding: 24px;
        text-align: center;
        background: #f9fafb;
        border-bottom: 1px solid #f3f4f6;
    }

    .buzzpct-card-features {
        padding: 20px;
    }

    .buzzpct-card-feature {
        display: flex;
        justify-content: space-between;
        padding: 12px 0;
        border-bottom: 1px solid #f3f4f6;
        font-size: 0.95rem;
    }

    .buzzpct-card-feature:last-child {
        border-bottom: none;
    }

    .buzzpct-feature-label {
        color: #6b7280;
        font-weight: 500;
        text-align: left;
    }

    .buzzpct-feature-value {
        text-align: right;
        font-weight: 600;
        color: #111827;
    }

    .buzzpct-card-footer {
        padding: 20px;
        background: #fff;
        text-align: center;
        border-top: 1px solid #f3f4f6;
    }

    .buzzpct-card-highlighted .buzzpct-card-header {
        padding-top: 52px;
    }

    /* Section divider inside mobile cards */
    .buzzpct-card-section-divider {
        display: block;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: #9ca3af;
        background: #f3f4f6;
        padding: 6px 20px;
        margin: 8px -20px;
        width: calc(100% + 40px);
        box-sizing: border-box;
    }
}

/* ==========================================================================
   v1.1.0 — NEW FEATURES
   ========================================================================== */

/* Sticky table header on scroll */
.buzzpct-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Product image */
.buzzpct-product-image {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

.buzzpct-product-image img {
    max-width: 64px;
    max-height: 64px;
    object-fit: contain;
    border-radius: 6px;
}

/* "Best for" subtitle */
.buzzpct-product-best-for {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 400;
    margin-top: 4px;
    display: block;
    font-style: italic;
}

/* Star rating */
.buzzpct-stars {
    display: inline-flex;
    gap: 1px;
    font-size: 1.2rem;
    line-height: 1;
}

.buzzpct-star-full  { color: #f59e0b; }
.buzzpct-star-half  { color: #f59e0b; opacity: 0.6; }
.buzzpct-star-empty { color: #d1d5db; }

/* Section divider rows */
.buzzpct-group-header-row td {
    background: #f3f4f6 !important;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b7280;
    padding: 10px 24px !important;
    border-bottom: 1px solid #e5e7eb !important;
}

/* Tooltip */
.buzzpct-tooltip-wrap {
    display: inline-block;
    position: relative;
    margin-left: 4px;
    vertical-align: middle;
}

.buzzpct-tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: default;
    user-select: none;
}

.buzzpct-tooltip-content {
    display: none;
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    font-size: 0.78rem;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: nowrap;
    max-width: 220px;
    white-space: normal;
    z-index: 100;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    pointer-events: none;
}

.buzzpct-tooltip-wrap:hover .buzzpct-tooltip-content,
.buzzpct-tooltip-icon:focus + .buzzpct-tooltip-content {
    display: block;
}

/* Mobile: product image in cards */
.buzzpct-card .buzzpct-product-image {
    margin: 12px auto 0;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --buzzpct-border-color:  #374151;
        --buzzpct-bg-color:      #1f2937;
        --buzzpct-text-color:    #d1d5db;
        --buzzpct-header-bg:     #111827;
    }

    .buzzpct-product-name { color: #f9fafb; }

    .buzzpct-icon-check { background: #065f46; color: #34d399; }
    .buzzpct-icon-cross { background: #7f1d1d; color: #f87171; }

    .buzzpct-group-header-row td {
        background: #111827 !important;
        color: #9ca3af;
    }

    .buzzpct-card-section-divider {
        background: #1f2937;
        color: #6b7280;
    }

    .buzzpct-tooltip-icon {
        background: #374151;
        color: #9ca3af;
    }
}
