/* ContextIQ FAQ Page Styles */

/* Base Styles */
.ciq-faq-page * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* FIX 1: Contain ALL overflow at the root level */
.ciq-faq-page {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
}

/* Hero Section */
/* FIX 2: Hero must not exceed viewport width */
.ciq-faq-page .ciq-hero {
    padding: 72px 40px 64px;
    position: relative;
    width: 100%;
    overflow: hidden;
}

.ciq-faq-page .ciq-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
}

/* FIX 3: ciq-hero-inner declared ONCE with correct base styles */
.ciq-faq-page .ciq-hero-inner {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 40px;
    /* Ensure it never breaks out */
    min-width: 0;
    width: 100%;
}

.ciq-faq-page .ciq-hero-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    background: rgba(74, 144, 217, 0.12);
    border: 1px solid rgba(74, 144, 217, 0.3);
    padding: 5px 14px;
    border-radius: 2px;
    margin-bottom: 24px;
}

.ciq-faq-page .ciq-hero h1 {
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
    margin-bottom: 18px;
    /* FIX 4: Long titles must not overflow */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ciq-faq-page .ciq-hero-sub {
    color: rgba(255, 255, 255, 0.58);
    font-weight: 300;
    line-height: 1.65;
    max-width: 560px;
    margin-bottom: 40px;
}

/* FIX 5: hero-content must shrink properly in flex layout */
.ciq-faq-page .ciq-hero-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* Search */
.ciq-faq-page .ciq-search-wrap {
    position: relative;
    max-width: 600px;
    /* Ensure it doesn't exceed its parent */
    width: 100%;
}

.ciq-faq-page .ciq-search-input {
    width: 100%;
    padding: 18px 56px 18px 24px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.07);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: #fff;
    outline: none;
}

.ciq-faq-page .ciq-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.ciq-faq-page .ciq-search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.35);
    font-size: 20px;
    pointer-events: none;
}

/* Body Layout */
.ciq-faq-page .ciq-body-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 32px;
    display: grid;
    gap: 48px;
    /* FIX 6: Ensure body layout also can't overflow */
    width: 100%;
    overflow: hidden;
}

.ciq-faq-page .ciq-body-layout.has-sidebar {
    grid-template-columns: 240px 1fr;
}

.ciq-faq-page .ciq-body-layout.no-sidebar {
    grid-template-columns: 1fr;
}

/* Sidebar */
.ciq-faq-page .ciq-sidebar {
    position: sticky;
    top: 24px;
    /* FIX 7: Sidebar must not push the grid */
    min-width: 0;
    overflow: hidden;
}

.ciq-faq-page .ciq-sidebar-section {
    margin-bottom: 36px;
}

.ciq-faq-page .ciq-sidebar-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    color: #999;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e5de;
}

.ciq-faq-page .ciq-cat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    text-align: left;
    margin-bottom: 2px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
}

.ciq-faq-page .ciq-cat-btn:hover {
    background: #ede9e0;
}

.ciq-faq-page .ciq-cat-btn.active {
    color: #fff;
    font-weight: 600;
}

.ciq-faq-page .ciq-cat-count {
    margin-left: auto;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 2px 7px;
    flex-shrink: 0;
}

.ciq-faq-page .ciq-cat-btn.active .ciq-cat-count {
    background: rgba(255, 255, 255, 0.18);
}

/* Most Viewed Items */
.ciq-faq-page .ciq-most-viewed-item {
    padding: 11px 0;
    border-bottom: 1px solid #e8e5de;
    cursor: pointer;
}

.ciq-faq-page .ciq-most-viewed-item:last-child {
    border-bottom: none;
}

.ciq-faq-page .ciq-most-viewed-q {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
    margin-bottom: 4px;
    transition: color 0.15s;
    /* FIX 8: Long titles in sidebar must wrap */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ciq-faq-page .ciq-most-viewed-meta {
    font-size: 11px;
    color: #aaa;
}

/* Results Header */
.ciq-faq-page .ciq-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
}

.ciq-faq-page .ciq-results-title {
    font-size: 24px;
    font-weight: 700;
}

.ciq-faq-page .ciq-results-meta {
    font-size: 13px;
    color: #999;
}

/* Main content area must not overflow its grid column */
.ciq-faq-page .ciq-main-content {
    min-width: 0;
    overflow: hidden;
    width: 100%;
}

/* FAQ Items */
.ciq-faq-page .ciq-faq-item {
    background: #fff;
    border: 1px solid #e8e5de;
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
    max-width: 100%;
    /* FIX 9: Prevent item from exceeding column width */
    width: 100%;
}

.ciq-faq-page .ciq-faq-item.hidden {
    display: none;
}

.ciq-faq-page .ciq-faq-item:hover {
    border-color: #c5d5e8;
}

.ciq-faq-page .ciq-faq-item.open {
    box-shadow: 0 4px 20px rgba(30, 77, 140, 0.08);
}

/* Trigger: flex row, text must WRAP not clip */
.ciq-faq-page .ciq-faq-trigger {
    width: 100%;
    background: none;
    border: none;
    padding: 20px 22px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
    text-align: left;
    /* min-width:0 is the key flex fix — allows children to shrink below content size */
    min-width: 0;
    /* NO overflow:hidden here — that was clipping the question text */
}

.ciq-faq-page .ciq-faq-number {
    font-size: 11px;
    font-weight: 700;
    color: #ccc;
    letter-spacing: 1px;
    min-width: 26px;
    padding-top: 2px;
    flex-shrink: 0;
}

.ciq-faq-page .ciq-faq-question {
    flex: 1;
    font-weight: 600;
    line-height: 1.45;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
}

.ciq-faq-page .ciq-faq-chevron {
    font-size: 20px;
    color: #ccc;
    transition: transform 0.25s, color 0.2s;
    line-height: 1;
    flex-shrink: 0;
}

.ciq-faq-page .ciq-faq-item.open .ciq-faq-chevron {
    transform: rotate(180deg);
}

.ciq-faq-page .ciq-faq-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

.ciq-faq-page .ciq-faq-body.open {
    max-height: 800px;
}

.ciq-faq-page .ciq-faq-inner {
    padding: 0 22px 22px 64px;
    border-top: 1px solid #f0ede6;
}

/* FIX 11: Answer text must also wrap — this was missing from the original */
.ciq-faq-page .ciq-faq-answer {
    color: #444;
    line-height: 1.78;
    padding-top: 18px;
    margin-bottom: 16px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.ciq-faq-page .ciq-faq-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.ciq-faq-page .ciq-faq-tag {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: rgba(30, 77, 140, 0.07);
    padding: 3px 10px;
    border-radius: 2px;
    border: 1px solid rgba(30, 77, 140, 0.15);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.ciq-faq-page .ciq-faq-tag:hover {
    color: #fff;
}

.ciq-faq-page .ciq-read-more {
    display: inline-block;
    color: #fff;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.2s;
}

.ciq-faq-page .ciq-read-more:hover {
    opacity: 0.9;
}

/* Show All Button */
.ciq-faq-page .ciq-show-all-wrap {
    text-align: center;
    margin-top: 32px;
}

.ciq-faq-page .ciq-show-all-btn {
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ciq-faq-page .ciq-show-all-btn:hover {
    opacity: 0.9;
}

.ciq-faq-page .ciq-show-all-wrap.hidden {
    display: none;
}

/* Today Carousel */
.ciq-faq-page .ciq-today-carousel {
    position: relative;
    width: 280px;
    height: 120px;
    flex-shrink: 0;
}

/* FIX 12: Cards use position:absolute — carousel needs explicit height so it
   doesn't collapse; cards use width:100% of the carousel container */
.ciq-faq-page .ciq-today-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s, transform 0.5s;
    cursor: pointer;
    overflow: hidden;
}

.ciq-faq-page .ciq-today-card.active {
    opacity: 1;
    transform: translateY(0);
}

.ciq-faq-page .ciq-today-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.ciq-faq-page .ciq-today-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f2a5e;
    line-height: 1.4;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ciq-faq-page .ciq-today-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #4a90d9;
}


.ciq-faq-page .ciq-faq-trigger {
    white-space: normal;
}

.ciq-faq-page .ciq-faq-question {
    white-space: normal;
}


/* ============================================================
   MOBILE - max-width: 780px
   ============================================================ */
@media (max-width: 780px) {

    /* FIX 13: Force the entire page to stay within viewport */
    .ciq-faq-page {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }

    .ciq-faq-page .ciq-body-layout {
        grid-template-columns: 1fr !important;
        padding: 24px 16px;
        /* FIX 14: Gap causes issues in single column — reduce it */
        gap: 24px;
        /* Ensure the grid itself cannot overflow */
        width: 100%;
        overflow: hidden;
    }

    /* Show sidebar at top on mobile */
    .ciq-faq-page .ciq-sidebar {
        display: block;
        position: static;
        margin-bottom: 0;
        order: -1;
        width: 100%;
        overflow: hidden;
    }

    /* Make sidebar sections collapsible on mobile */
    .ciq-faq-page .ciq-sidebar-section {
        border: 1px solid #e8e5de;
        border-radius: 6px;
        overflow: hidden;
        margin-bottom: 12px;
    }

    .ciq-faq-page .ciq-sidebar-title {
        cursor: pointer;
        padding: 12px 14px;
        margin-bottom: 0;
        border-bottom: 1px solid #e8e5de;
        background: #f9f9f9;
        position: relative;
    }

    .ciq-faq-page .ciq-sidebar-title::after {
        content: '▼';
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 10px;
        transition: transform 0.3s;
    }

    .ciq-faq-page .ciq-sidebar-section.collapsed .ciq-sidebar-title::after {
        transform: translateY(-50%) rotate(-90deg);
    }

    .ciq-faq-page .ciq-sidebar-content {
        max-height: 500px;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding: 8px;
    }

    .ciq-faq-page .ciq-sidebar-section.collapsed .ciq-sidebar-content {
        max-height: 0;
        padding: 0;
    }

    /* Hero mobile */
    .ciq-faq-page .ciq-hero {
        padding: 40px 16px;
        overflow: hidden;
    }

    .ciq-faq-page .ciq-hero-inner {
        flex-direction: column;
        gap: 24px;
        width: 100%;
    }

    .ciq-faq-page .ciq-hero-content {
        width: 100%;
    }

    /* FIX 15: On mobile the carousel is full-width, not 280px fixed.
       It uses position:relative + absolute children, so we must set
       an explicit height (or use a different layout approach). */
    .ciq-faq-page .ciq-today-carousel {
        width: 100%;
        max-width: 100%;
        /* Keep explicit height so absolutely-positioned cards render */
        height: 110px;
    }

    .ciq-faq-page .ciq-today-card {
        width: 100%;
        max-width: 100%;
        left: 0;
        right: 0;
    }

    /* Hero title should shrink on small screens */
    .ciq-faq-page .ciq-hero h1 {
        font-size: clamp(28px, 8vw, 56px) !important;
        word-break: break-word;
    }

    /* FIX 16: Search must stay within hero padding */
    .ciq-faq-page .ciq-search-wrap {
        max-width: 100%;
        width: 100%;
    }

    .ciq-faq-page .ciq-search-input {
        font-size: 16px;
        /* Prevent iOS zoom */
    }

    /* Main content */
    .ciq-faq-page .ciq-main-content {
        width: 100%;
        overflow: hidden;
        min-width: 0;
    }

    /* FAQ items mobile */
    .ciq-faq-page .ciq-faq-item {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        /* FIX 17: Ensure inner content cannot overflow the card */
        overflow: hidden;
    }

    .ciq-faq-page .ciq-faq-trigger {
        padding: 15px 12px;
        gap: 10px;
        width: 100%;
        /* No overflow:hidden — text must wrap, not clip */
    }

    .ciq-faq-page .ciq-faq-number {
        min-width: 20px;
    }

    .ciq-faq-page .ciq-faq-question {
        font-size: 14px;
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
        min-width: 0;
    }

    /* FIX 18: Reduce left indent on mobile so answer doesn't get squeezed */
    .ciq-faq-page .ciq-faq-inner {
        padding: 0 16px 20px 16px;
    }

    /* FIX 19: Answer text overflow on mobile (was completely missing) */
    .ciq-faq-page .ciq-faq-answer {
        word-break: break-word;
        overflow-wrap: anywhere;
        hyphens: auto;
        font-size: 14px;
    }

    /* Tags mobile — allow wrapping, don't let tags push outside */
    .ciq-faq-page .ciq-faq-tags {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        overflow: hidden;
    }

    .ciq-faq-page .ciq-faq-tag {
        white-space: nowrap;
        flex-shrink: 0;
        /* If a single tag is longer than the screen, break it */
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Show all button full width on mobile */
    .ciq-faq-page .ciq-show-all-btn {
        width: 100%;
        max-width: 320px;
    }
}