/* ========== WRAPPER LAYOUT ========== */

.ccf-wrapper {
    display: flex;
    gap: 24px;
    margin: 20px 0;
    flex-wrap: wrap; /* allows Load More to go to next line */
}

/* Filter sidebar (desktop base) */

.ccf-filter-sidebar {
    flex: 0 0 220px;
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.03);
    border: 1px solid #eee;
}

.ccf-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ccf-filter-sidebar h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.ccf-filter-toggle {
    display: none;
    border: none;
    background: #15549b;
    color: #fff;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 999px;
    cursor: pointer;
}

.ccf-filter-body {
    margin-top: 4px;
}

.ccf-filter-group {
    margin-bottom: 12px;
}

.ccf-filter-group-title {
    font-size: 15px;
    font-weight: 600;
    color: #15549b;
    margin-bottom: 4px;
}

.ccf-filter-group label {
    display: flex;
    align-items: center;
    font-size: 13px;
    margin-bottom: 4px;
    cursor: pointer;
}

.ccf-filter-group input[type="checkbox"] {
    margin-right: 6px;
}

/* ✅ Reset button footer inside filters (BOTTOM of all checkboxes) */
.ccf-filter-footer{
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f1f1f1;
    display: flex;
    justify-content: center;
}

.ccf-reset-filters{
    width: 100%;
    border: 1px solid #15549b;
    background: #fff;
    color: #15549b;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 999px;
    cursor: pointer;
}

.ccf-reset-filters:hover{
    opacity: 0.9;
}

/* Card list */

.ccf-card-list {
    flex: 1 1 calc(100% - 244px);
    min-width: 0;
}

/* ========== CARD LOOK ========== */

.ccf-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    margin-bottom: 18px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.04);
    border: 1px solid #f0f0f0;
    overflow: hidden;
}

/* Title row */

.ccf-card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 22px 4px;
}

.ccf-card-name {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.2;
    color: #15549b !important;
}

.ccf-sponsored-badge {
    background: #ffc107;
    color: #fff;
    font-size: 13px;
    padding: 5px 16px;
    border-radius: 999px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    align-self: flex-start;
}

/* Desktop main body (base; desktop grid overrides are at bottom) */

.ccf-card-main {
    display: flex;
    align-items: center;
    padding: 4px 22px 12px;
    column-gap: 22px;
}

/* Left: logo + bank */

.ccf-card-left {
    flex: 0 0 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ccf-card-image img {
    max-width: 150px;
    height: auto;
    display: block;
    margin: 0 auto 4px;
}

.ccf-card-bank {
    font-size: 13px;
    color: #777;
    text-align: center;
    width: 100%;
}

/* Center */

.ccf-card-center {
    flex: 1.6;
}

.ccf-card-highlights-block {
    margin-bottom: 6px;
}

.ccf-card-highlights-title {
    font-size: 15px;
    font-weight: 600;
    color: #15549b;
    margin-bottom: 2px;
}

/* Tick bullets */
.ccf-card-highlights,
.ccf-compare-highlights {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.ccf-card-highlights li,
.ccf-compare-highlights li {
    position: relative;
    padding-left: 18px;
    margin: 2px 0;
}

.ccf-card-highlights li::before,
.ccf-compare-highlights li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 0;
    font-size: 12px;
    line-height: 1.2;
    color: #15549b;
    font-weight: 700;
}

.ccf-card-features-row {
    font-size: 13px;
    margin-bottom: 4px;
}

.ccf-card-features-label {
    font-weight: 600;
    color: #15549b;
}

/* Stats column */

.ccf-card-stats-vertical {
    flex: 0 0 170px;
    display: flex;
    flex-direction: column;
    row-gap: 8px;
}

.ccf-stat {
    text-align: left;
}

.ccf-stat-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #15549b;
}

.ccf-stat-value {
    font-size: 13px;
    font-weight: 600;
    color: #000;
}

/* Right: Apply + Compare */

.ccf-card-actions {
    flex: 0 0 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.ccf-apply-btn {
    display: inline-block;
    padding: 7px 20px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff399b 0%, #15549b 100%);
    color: #fff !important;
    font-size: 13px;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ccf-compare-label {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #666;
}

.ccf-compare-label input {
    margin-right: 4px;
}

/* ✅ LOAD MORE (desktop centered under cards) */
.ccf-load-more-wrap {
    flex: 0 0 100%;
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 10px 0 20px;
    clear: both;
}

.ccf-load-more-btn {
    display: none;
    padding: 8px 20px;
    border-radius: 999px;
    border: none;
    background: #15549b;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    position: static;
    float: none;
}

/* Hidden states */
.ccf-card.ccf-filter-hidden,
.ccf-card.ccf-page-hidden {
    display: none !important;
}

/* Footer / accordion */

.ccf-card-footer {
    border-top: 1px solid #f5f5f5;
}

.ccf-accordion-toggle {
    width: 100%;
    text-align: left;
    padding: 8px 22px;
    border: none;
    background: #f9f9ff;
    font-size: 13px;
    font-weight: 500;
    color: #15549b;
    cursor: pointer;
}

.ccf-accordion-content {
    display: none;
    padding: 10px 22px 14px;
    font-size: 13px;
}

.ccf-detail-row {
    margin-bottom: 6px;
}

/* ========== COMPARE BAR & MODALS ========== */

.ccf-compare-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #15549b;
    color: #fff;
    padding: 10px 16px;
    font-size: 13px;
    display: none;
    justify-content: center;
    align-items: center;
    gap: 12px;
    z-index: 9999;
}

.ccf-compare-bar.show {
    display: flex;
}

#ccf-compare-btn {
    background: #ff399b;
    border: none;
    border-radius: 999px;
    padding: 7px 24px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

/* Modal base */

.ccf-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
}

.ccf-modal.open {
    display: block;
}

.ccf-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

.ccf-modal-content {
    position: relative;
    background: #fff;
    max-width: 900px;
    margin: 60px auto;
    border-radius: 14px;
    padding: 18px 20px 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.ccf-modal-close {
    position: absolute;
    right: 12px;
    top: 8px;
    border: none;
    background: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

/* Compare modal */

.ccf-compare-results {
    overflow-x: auto;
}

.ccf-compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ccf-compare-table th,
.ccf-compare-table td {
    border: 1px solid #eee;
    padding: 8px;
    text-align: left;
}

.ccf-compare-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ccf-compare-card-header img {
    max-width: 60px;
    height: auto;
}

/* Affiliate modal */

.ccf-affiliate-modal-content h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.ccf-form-group {
    margin-bottom: 10px;
}

.ccf-form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
}

.ccf-form-group input {
    width: 100%;
    padding: 7px 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 13px;
}

.ccf-apply-submit {
    background: #ff399b;
    color: #fff;
    border-radius: 999px;
    padding: 7px 22px;
    border: none;
    cursor: pointer;
    font-size: 13px;
}

.ccf-form-message {
    margin-top: 8px;
    font-size: 13px;
}

/* Floating filter FAB */

.ccf-filter-fab {
    display: none;
    position: fixed;
    right: 16px;
    bottom: 120px;
    z-index: 10001;
    background: #15549b;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    cursor: pointer;
}

/* ========== RESPONSIVE (MOBILE ONLY) ========== */

@media (max-width: 900px) {

    .ccf-wrapper {
        flex-direction: column;
        flex-wrap: nowrap;   /* important on mobile */
    }

    /* FORCE order */
    .ccf-filter-sidebar { order: 1; }
    .ccf-card-list      { order: 2; }
    .ccf-load-more-wrap { order: 3; }

    /* Load More spacing */
    .ccf-load-more-wrap {
        width: 100%;
        margin: 16px 0 90px; /* space above compare bar */
        justify-content: center;
    }

    /* Turn sidebar into hidden top drawer */
    .ccf-filter-sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        margin: 0;
        border-radius: 0 0 16px 16px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.18);
        padding: 12px 16px;
        background: #fff;
        z-index: 10000;
        transform: translateY(-120%);
        transition: transform 0.25s ease;
    }

    .ccf-filter-sidebar.ccf-open {
        transform: translateY(0);
    }

    .ccf-card-list {
        flex: 1 1 auto;
        width: 100%;
    }

    /* Show FAB on mobile */
    .ccf-filter-fab {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        top: 90px;
        right: 16px;
        bottom: auto;
    }

    /* Card main stack vertically */
    .ccf-card-main {
        flex-direction: column;
        align-items: center;
        row-gap: 6px;
        padding-bottom: 6px;
    }

    .ccf-card-left {
        align-items: center;
    }

    .ccf-card-bank {
        text-align: center;
    }

    .ccf-card-center {
        width: 100%;
    }

    /* Stats: horizontal row */
    .ccf-card-stats-vertical {
        width: 100%;
        flex: 0 0 auto;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        column-gap: 6px;
    }

    .ccf-stat {
        flex: 1;
        text-align: center;
    }

    /* Apply & Compare centered */
    .ccf-card-actions {
        width: 100%;
        align-items: center;
        margin-top: 4px;
        margin-bottom: 4px;
    }

    .ccf-apply-btn {
        margin-bottom: 2px;
    }

    .ccf-compare-label {
        justify-content: center;
    }

    .ccf-modal-content.ccf-compare-modal-content {
        max-width: 100%;
        margin: 40px 10px;
    }

    .ccf-compare-table {
        min-width: 700px;
    }
}

/* =========================================================
   DESKTOP ONLY: Fix big gap + align stats/actions with 1st bullet
   + make Features span till Apply button before wrapping
   (Mobile unchanged)
========================================================= */

@media (min-width: 901px) {

    /* Switch desktop layout to grid (removes the empty gap issue) */
    .ccf-card-main {
        display: grid;
        grid-template-columns: 150px 1fr 160px 140px; /* left | highlights | stats | actions */
        column-gap: 18px;
        align-items: start;
    }

    /* Left block aligned with Top Highlights heading */
    .ccf-card-left {
        align-self: start;
        padding-top: 2px;
    }

    /* Make center children become grid items so we can span Features */
    .ccf-card-center {
        display: contents;
    }

    /* Highlights block in column 2 */
    .ccf-card-highlights-block {
        grid-column: 2;
        grid-row: 1;
    }

    /* Stats in column 3 aligned with FIRST bullet point */
    .ccf-card-stats-vertical {
        grid-column: 3;
        grid-row: 1;
        margin-top: 22px; /* aligns with first bullet point */
        flex: none;
        width: auto;
    }

    /* Actions in column 4 aligned with FIRST bullet point */
    .ccf-card-actions {
        grid-column: 4;
        grid-row: 1;
        margin-top: 22px;  /* aligns with first bullet point */
        flex: none;
        width: auto;

        /* ✅ center Apply + Compare vertically */
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
    }

    /* ✅ Compare checkbox centered under Apply button */
    .ccf-compare-label {
        justify-content: center;
        width: 100%;
    }

    /* Features row spans across highlights + stats + actions width */
    .ccf-card-features-row {
        grid-column: 2 / 5;  /* ✅ this is the key: goes till Apply column */
        grid-row: 2;
        margin-top: 8px;
        min-width: 0;
    }
}

/* Hide filter groups depending on shortcode context */
.ccf-context-bank .ccf-filter-group-banks { display: none !important; }
.ccf-context-category .ccf-filter-group-category { display: none !important; }
.ccf-context-benefit .ccf-filter-group-benefit { display: none !important; }


/* ===== Improve modal close (X) visibility – NO background ===== */

.ccf-modal-close {
    color: #111;        /* solid dark color */
    font-size: 28px;    /* larger X */
    font-weight: 800;   /* bold */
    opacity: 1;         /* remove transparency */
    line-height: 1;
    cursor: pointer;
}

/* Slight hover feedback (desktop only) */
.ccf-modal-close:hover {
    opacity: 0.8;
}

/* Mobile: slightly bigger for easy tap */
@media (max-width: 900px) {
    .ccf-modal-close {
        font-size: 30px;
    }
}
/* ===== Dirham currency icon (black PNG → #ff399b) ===== */

.ccf-currency-dirham {
    position: relative;
    padding-left: 20px;   /* space for icon */
    display: inline-block;
}

.ccf-currency-dirham::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;

    background-image: url('../img/dirham.png');
    background-size: contain;
    background-repeat: no-repeat;

    /* 🎯 Recolor black PNG to #ff399b */
    filter: brightness(0) saturate(100%)
            invert(36%)
            sepia(94%)
            saturate(3500%)
            hue-rotate(315deg)
            brightness(102%)
            contrast(102%);
}
/* ===== Interest rate % sign in brand color ===== */

.ccf-interest-rate::after {
    content: "%";
    margin-left: 3px;
    color: #ff399b;
    font-weight: 700;
}
/* ===== Compare modal Apply Now button – match card list style ===== */

.ccf-compare-apply {
    background: #ff399b !important;
    color: #fff !important;
    border: none !important;
    border-radius: 999px;
    padding: 7px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-width: auto;
}

/* Hover effect (same feel as card Apply button) */
.ccf-compare-apply:hover {
    opacity: 0.9;
}
.ccf-card-highlights li::before,
.ccf-compare-highlights li::before {
    top: 0.30rem;  /* adjust between 0.15rem to 0.35rem */
}

/* =========================================================
   COMPARE MODAL – FORCE EQUAL CARD COLUMNS
   (Paste at VERY BOTTOM of CSS)
========================================================= */

/* Force equal column widths */
.ccf-compare-table {
    table-layout: fixed;
    width: 100%;
}

/* Fixed width for left label column */
.ccf-compare-table th:first-child,
.ccf-compare-table td:first-child {
    width: 160px;
    font-weight: 600;
    white-space: normal;
}

/* Equal-width card columns */
.ccf-compare-table th:not(:first-child),
.ccf-compare-table td:not(:first-child) {
    width: auto;
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Card header inside compare modal */
.ccf-compare-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* Prevent card name from forcing width */
.ccf-compare-card-header * {
    min-width: 0;
}

.ccf-compare-card-header strong,
.ccf-compare-card-header span,
.ccf-compare-card-header div {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Align bullet highlights perfectly */
.ccf-compare-highlights li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding-left: 0;
}

.ccf-compare-highlights li::before {
    content: "✓";
    flex-shrink: 0;
    font-size: 12px;
    line-height: 1.2;
    color: #15549b;
    font-weight: 700;
    margin-top: 2px;
}
/* =========================================================
   FIX: Compare Modal Bullet Tick Alignment (FINAL)
========================================================= */

/* Remove old absolute-position logic */
.ccf-compare-highlights li {
    position: static;
    padding-left: 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* Proper tick alignment */
.ccf-compare-highlights li::before {
    content: "✓";
    position: static;          /* 🔥 KEY FIX */
    flex-shrink: 0;
    font-size: 12px;
    line-height: 1.2;
    color: #15549b;
    font-weight: 700;
    margin-top: 2px;           /* pixel-perfect alignment */
}
