/* ═══════════════════════════════════════════════════════════════
   ChooseSportsbooks.top — Review Page Fixes & Enhancements
   
   Handles edge cases in expert review rendering:
   - TinyMCE content normalization
   - Image gallery layouts
   - Section spacing consistency
   - Table responsiveness
   - Mobile review layout
   ═══════════════════════════════════════════════════════════════ */

/* ─── REVIEW CONTAINER ───────────────────────────────────────── */
.review-container {
    max-width: 900px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    margin-top: 30px;
    margin-bottom: 60px;
}


/* ─── TINYMCE CONTENT NORMALIZATION ──────────────────────────── */
/* TinyMCE sometimes outputs inline styles, empty tags, etc. */

.section-content p:empty {
    display: none;
}

.section-content p + p {
    margin-top: 0;
}

/* Override TinyMCE inline font-family */
.section-content * {
    font-family: inherit !important;
}

/* Override TinyMCE font sizes to be consistent */
.section-content span[style*="font-size"] {
    font-size: inherit !important;
}

/* TinyMCE sometimes adds background colors */
.section-content span[style*="background-color: transparent"] {
    background-color: transparent !important;
}

/* Fix TinyMCE tables */
.section-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95rem;
    border-radius: 10px;
    overflow: hidden;
}

.section-content table th {
    background: #0f172a;
    color: #ffffff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-content table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #475569;
    vertical-align: top;
}

.section-content table tr:nth-child(even) td {
    background: #f8fafc;
}

.section-content table tr:hover td {
    background: #ecfdf5;
}

/* Responsive tables */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 20px 0;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.table-wrapper table {
    margin: 0;
    min-width: 500px;
}


/* ─── IMAGE GALLERY ──────────────────────────────────────────── */
.review-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin: 24px 0;
}

.review-image-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
    aspect-ratio: 16/10;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.review-image-item:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.review-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.review-image-item:hover img {
    transform: scale(1.05);
}

.review-image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #ffffff;
    padding: 24px 12px 10px;
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Lightbox (full-screen image viewer) */
.review-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    cursor: pointer;
}

.review-lightbox.active {
    display: flex;
}

.review-lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.review-lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    color: #ffffff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    background: none;
    border: none;
    font-family: inherit;
    line-height: 1;
}

.review-lightbox-close:hover {
    opacity: 1;
}


/* ─── SECTION SIDEBAR RATINGS ────────────────────────────────── */
/* Compact rating display next to section title */
.section-rating-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font-size: 0.85rem;
    font-weight: 700;
    color: #059669;
    background: #ecfdf5;
    padding: 4px 12px;
    border-radius: 8px;
}

.section-rating-inline .stars {
    font-size: 0.75rem;
}


/* ─── REVIEW SIDEBAR / QUICK INFO ────────────────────────────── */
.review-quick-info {
    background: #f8fafc;
    border-radius: 16px;
    padding: 24px;
    margin: 0 40px 24px;
}

.quick-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
}

.quick-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quick-info-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-info-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

.quick-info-value.highlight {
    color: #059669;
}

.quick-info-value.gold {
    color: #d97706;
}


/* ─── REVIEW TABLE OF CONTENTS ───────────────────────────────── */
.review-toc {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 24px;
    margin: 0 40px 10px;
}

.review-toc-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.review-toc-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.review-toc-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 0.88rem;
    color: #475569;
    border-radius: 6px;
    transition: all 0.15s;
    text-decoration: none;
}

.review-toc-list a:hover {
    background: #ffffff;
    color: #059669;
}

.review-toc-list .toc-number {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    min-width: 20px;
}


/* ─── BONUS HIGHLIGHT BOX ────────────────────────────────────── */
.bonus-highlight {
    background: linear-gradient(135deg, #fef3c7, #fffbeb);
    border: 2px solid #fcd34d;
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    text-align: center;
}

.bonus-highlight-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #92400e;
    margin-bottom: 6px;
}

.bonus-highlight-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 6px;
}

.bonus-highlight-code {
    display: inline-block;
    background: #0f172a;
    color: #fbbf24;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: monospace;
    letter-spacing: 1px;
    margin-top: 8px;
}

.bonus-highlight-terms {
    font-size: 0.78rem;
    color: #92400e;
    margin-top: 10px;
    opacity: 0.7;
}


/* ─── REVIEW CTA BAR (Sticky bottom on mobile) ──────────────── */
.review-cta-bar {
    display: none;
}

@media (max-width: 768px) {
    .review-cta-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 12px 16px;
        gap: 10px;
        z-index: 9998;
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    }

    .review-cta-bar .btn-primary,
    .review-cta-bar .btn-play {
        flex: 1;
        justify-content: center;
        padding: 14px 20px;
    }

    /* Add bottom padding to page so CTA bar doesn't cover content */
    .review-container {
        margin-bottom: 100px;
    }
}


/* ─── RESPONSIVE REVIEW FIXES ────────────────────────────────── */
@media (max-width: 768px) {
    .review-container {
        border-radius: 0;
        margin-top: 0;
        box-shadow: none;
    }

    .review-quick-info,
    .review-toc {
        margin: 0 16px 16px;
        padding: 16px;
    }

    .review-toc-list {
        grid-template-columns: 1fr;
    }

    .quick-info-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .review-images {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .bonus-highlight-value {
        font-size: 1.4rem;
    }

    /* Stack pros/cons */
    .pros-cons-grid {
        grid-template-columns: 1fr;
    }

    /* Review ratings compact */
    .review-ratings-grid {
        grid-template-columns: repeat(2, 1fr);
        padding: 16px;
    }

    /* Table scroll hint */
    .table-wrapper {
        position: relative;
    }

    .table-wrapper::after {
        content: '← Scroll →';
        position: absolute;
        bottom: -20px;
        right: 0;
        font-size: 0.72rem;
        color: #94a3b8;
        font-weight: 500;
    }
}

@media (max-width: 480px) {
    .review-images {
        grid-template-columns: 1fr;
    }

    .quick-info-grid {
        grid-template-columns: 1fr;
    }
}


/* ─── PRINT STYLES ───────────────────────────────────────────── */
@media print {
    .review-cta-bar,
    .review-lightbox {
        display: none !important;
    }

    .review-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .review-hero {
        background: #f5f5f5 !important;
        color: #000 !important;
    }

    .section-content a {
        color: #000;
        text-decoration: underline;
    }

    .section-content a::after {
        content: ' (' attr(href) ')';
        font-size: 0.8em;
        color: #666;
    }
}
