/* ==========================================================
   70 PREMIUM PAIRS - ANTI-CLS LAYOUT STYLES
   ========================================================== */

/* Wrapper with reserved baseline height to prevent content jumps */
.cpp-wrapper {
    max-width: 1100px;
    margin: 40px auto;
    padding: 20px !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
    /* Pre-reserves height for Title + 4 Rows of cards + Action button */
    min-height: 420px; 
    contain: layout style;
}

.cpp-title {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #111111;
    line-height: 1.3;
    /* Reserve vertical space for the heading */
    min-height: 34px; 
}

/* DESKTOP 4-COLUMN GRID LAYOUT */
.cpp-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 15px !important;
    margin-top: 20px !important;
    width: 100% !important;
    box-sizing: border-box;
    /* Reserve space for 4 rows of 16 initial cards on desktop */
    min-height: 290px; 
}

/* FIXED-DIMENSION CARDS (PREVENTS REFLOW) */
.cpp-card {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 14px 12px !important;
    background: #f7f9fa !important;
    border-radius: 10px !important;
    text-decoration: none !important;
    color: #333333 !important;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
    border: 1px solid #eef2f4 !important;
    box-sizing: border-box !important;
    /* Strictly lock card height to stop height snapping on render */
    height: 62px !important; 
    overflow: hidden;
}

/* Completely remove hidden cards from DOM flow without reserving extra space */
.cpp-card.cpp-hidden {
    display: none !important;
}

.cpp-card:hover {
    background: #ffffff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08) !important;
    border-color: #d1d9e0 !important;
}

/* FLAG IMAGE ASPECT-RATIO LOCK (ZERO CLS) */
.cpp-card img {
    width: 28px !important;
    height: 20px !important;
    /* Aspect-ratio lock prevents layout shift before image load */
    aspect-ratio: 7 / 5 !important; 
    object-fit: cover !important;
    border-radius: 3px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    flex-shrink: 0 !important;
}

/* TEXT CONTAINER LOCKS */
.cpp-card div {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    flex: 1;
}

.cpp-card strong {
    display: block !important;
    font-size: 14px !important;
    color: #222222 !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cpp-card span {
    font-size: 12px !important;
    color: #556575 !important;
    margin-top: 3px !important;
    line-height: 1.2 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* SHOW MORE / SHOW LESS BUTTON ACTION AREA */
.cpp-actions {
    text-align: center;
    margin-top: 25px;
    /* Reserve vertical space for button area */
    min-height: 48px; 
}

.cpp-btn {
    background-color: #0F172A;
    color: #ffffff;
    border: none;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    height: 44px;
    box-sizing: border-box;
}

.cpp-btn:hover {
    background-color: #004b99;
}

.cpp-loading-text {
    grid-column: 1 / -1;
    text-align: center;
    color: #777777;
    font-size: 14px;
    padding: 20px;
}

/* ==========================================================
   MOBILE & TABLET RESPONSIVE OVERRIDES
   ========================================================== */

/* Tablet View (3 Columns) */
@media screen and (max-width: 900px) {
    .cpp-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        min-height: 380px; 
    }
}

/* Mobile View (Strict 2 Columns) */
@media screen and (max-width: 540px) {
    .cpp-wrapper {
        padding: 21px 10px !important;
        margin: 20px auto;
        min-height: 600px;
    }

    .cpp-title {
        font-size: 20px;
        margin-bottom: 15px;
        min-height: 26px;
    }

    .cpp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
        min-height: 520px; /* Reserves space for 8 rows x 2 columns (16 cards) */
    }

    .cpp-card {
        gap: 8px !important;
        padding: 10px 8px !important;
        height: 56px !important; /* Slightly tighter height for mobile cards */
    }

    .cpp-card img {
        width: 22px !important;
        height: 16px !important;
        aspect-ratio: 11 / 8 !important;
    }

    .cpp-card strong {
        font-size: 13px !important;
    }

    .cpp-card span {
        font-size: 11px !important;
        margin-top: 1px !important;
    }
}