/* ==========================================================
   🔥 SAFE ISOLATION & TYPOGRAPHY
   ========================================================== */
.ccp-isolated {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #1e293b;
}

.ccp-isolated * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ==========================================================
   MAIN WRAPPER (CLS SAFE)
   ========================================================== */
.ccp-wrapper-main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    contain: layout style; /* Locks layout boundaries for browser rendering */
}

/* ==========================================================
   🖼️ ACCENTED TITLE DESIGN
   ========================================================== */
.ccp-main-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 16px;
    line-height: 1.3;
    padding-left: 12px;
    border-left: 4px solid #2563eb;
    display: block;
    min-height: 28px; /* 🚀 CLS FIX: Reserves space before dynamic text renders */
}

.ccp-seo-title {
    display: inline;
}

/* ==========================================================
   💎 HEADER
   ========================================================== */
.ccp-top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f8fafc;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    min-height: 88px; /* 🚀 CLS FIX: Pre-allocates space for flags & price text */
}

.ccp-chart-hint {
    font-size: 12.5px;
    font-weight: 500;
    color: #64748b;
    text-align: right;
    margin-top: 10px;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.ccp-flags {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
}

.ccp-flags img {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2.5px solid #ffffff;
    object-fit: cover;
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
}

.ccp-flags img:first-child {
    top: 0;
    left: 0;
    z-index: 2;
}

.ccp-flags img:last-child {
    bottom: 0;
    right: 0;
    z-index: 1;
}

.ccp-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 48px; /* 🚀 CLS FIX */
}

.ccp-main-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #0f172a;
    line-height: 1.2;
}

.ccp-main-line span:nth-child(2) {
    color: #94a3b8;
    font-weight: 400;
}

#ccp-change {
    font-size: 14px;
    font-weight: 600;
    margin-top: 4px;
    letter-spacing: -0.01em;
    min-height: 18px; /* 🚀 CLS FIX */
}

/* ==========================================================
   💎 CHART WRAPPER (CLS SAFE & TOUCH/POINTER HIGHLIGHT ENABLED)
   ========================================================== */
.ccp-chart-wrapper {
    width: 100%;
    height: 442px; /* 🚀 CLS FIX: Fixed size (400px chart + 40px padding + 2px border) */
    margin-top: 7px;
    background: #0f172a;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid #1e293b;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    position: relative;
    overflow: hidden;
    touch-action: pan-y !important; /* 🎯 Allows page scrolling vertically while dragging chart horizontally */
    -webkit-user-select: none;
    user-select: none;
}

.ccp-chart {
    width: 100% !important;
    height: 400px !important;
    display: block;
    touch-action: pan-y !important;
    pointer-events: auto !important; /* 🎯 Guarantees touch events pass through to canvas */
}

.ccp-chart canvas {
    touch-action: pan-y !important;
    pointer-events: auto !important; /* 🎯 Ensures Lightweight Charts captures touch move on mobile */
}

/* ==========================================================
   💎 CAPSULE BUTTONS
   ========================================================== */
.ccp-buttons {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
    min-height: 38px; /* 🚀 CLS FIX: Reserves height for range pills */
}

.ccp-buttons button {
    padding: 8px 18px;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    letter-spacing: -0.01em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ccp-buttons button:hover {
    background: #f8fafc;
    color: #0f172a;
    border-color: #cbd5e1;
}

.ccp-buttons button.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.1);
}

/* ==========================================================
   💎 GRID LAYOUT
   ========================================================== */
.ccp-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 24px;
    align-items: start;
}

.ccp-table-box {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
    min-height: 230px; /* 🚀 CLS FIX: Holds space for header + 4 rows */
}

.ccp-stats-header {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    background: #0f172a; 
    color: #ffffff;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    height: 46px; /* 🚀 CLS FIX */
}

.ccp-stats-header div:first-child {
    text-transform: none;
    letter-spacing: -0.01em;
    font-size: 14px;
    color: #f8fafc;
}

.ccp-stats-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    background: #ffffff;
    align-items: center;
    height: 46px; /* 🚀 CLS FIX */
}

.ccp-stats-row:last-child {
    border-bottom: none;
}

.ccp-stats-row div:first-child {
    font-weight: 600;
    color: #64748b;
}

.ccp-stats-row div:not(:first-child) {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 13.5px;
    color: #0f172a;
    font-weight: 600;
}

.ccp-seo-box {
    background: #f8fafc;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    min-height: 230px; /* 🚀 CLS FIX: Holds space for dynamic text */
}

.ccp-seo-box h3 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    color: #0f172a;
}

.ccp-seo-box p {
    font-size: 14.5px;
    line-height: 1.65;
    color: #475569;
    margin-bottom: 14px;
}

.ccp-seo-box p:last-child {
    margin-bottom: 0;
}

/* ==========================================================
   📱 MOBILE RESPONSIVE ADJUSTMENTS (CLS SAFE)
   ========================================================== */
@media (max-width: 768px) {
    .ccp-main-title {
        font-size: 16px;
        padding-left: 10px;
        border-left-width: 3px;
        line-height: 1.4;
        min-height: 24px;
    }
    
    .ccp-top-bar {
        padding: 16px;
        gap: 12px;
        min-height: 76px;
    }
    
    .ccp-chart-hint {
        text-align: center;
        font-size: 11.5px;
    }

    .ccp-main-line {
        font-size: 21px;
        gap: 6px;
    }

    .ccp-bottom-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .ccp-stats-header, .ccp-stats-row {
        padding: 12px 14px;
        font-size: 13px;
        height: 42px;
    }
    
    .ccp-stats-row div:not(:first-child) {
        font-size: 12.5px;
    }

    .ccp-seo-box {
        padding: 20px;
        min-height: auto;
    }

    .ccp-chart {
        pointer-events: auto !important; /* 🎯 Ensures touch selection stays active on mobile screens */
    }
}