/* =========================================
   MARCHÉS V2 — COMPACT + PREMIUM
   Dashboard · TradingView · Glass
   ========================================= */

/* ── Section ── */
.marches-v2 {
    position: relative;
    background: transparent;
    overflow: hidden;
}

/* ── Header ── */
.marches-header {
    text-align: center;
    margin-bottom: 32px;
}

.marches-badge-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.marches-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 119, 182, 0.06);
    border: 1px solid rgba(0, 119, 182, 0.12);
    padding: 10px 22px;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #0077b6;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: livePulse 1.5s ease-in-out 3;
    flex-shrink: 0;
}

@keyframes livePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 0 5px rgba(239, 68, 68, 0); }
}

.market-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.04);
    color: #5a7d95;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.status-open {
    background: #10b981;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
}

.status-dot.status-closed {
    background: #94a3b8;
}

.market-data-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #0077b6;
    background: rgba(0, 119, 182, 0.06);
    border: 1px solid rgba(0, 119, 182, 0.12);
    margin-bottom: 10px;
    letter-spacing: 0.01em;
}

.market-data-date::before {
    content: '🕐';
    font-size: 0.8rem;
}

.marches-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    color: #0a2540;
    line-height: 1.15;
    margin: 0 0 14px;
    letter-spacing: -0.03em;
}

.marches-sub {
    font-size: 1.1rem;
    color: #5a7d95;
    margin: 0;
    font-weight: 500;
}

/* ── Grid ── */
.marches-edu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 20px;
}

/* ── Card ── */
.market-edu-card {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow:
        0 8px 30px rgba(0, 40, 80, 0.04),
        0 2px 6px rgba(0, 40, 80, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.market-edu-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 16px 44px rgba(0, 40, 80, 0.07),
        0 3px 10px rgba(0, 40, 80, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    border-color: rgba(0, 119, 182, 0.12);
}

/* Card Top */
.mcard-top {
    padding: 18px 18px 0;
}

.mcard-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.mcard-flag {
    font-size: 1.4rem;
    line-height: 1;
}

.mcard-title-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mcard-title-group h3 {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0a2540;
    margin: 0;
    line-height: 1.2;
}

.mcard-symbol {
    font-size: 0.6rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #0077b6, #00b4d8);
    padding: 2px 7px;
    border-radius: 5px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* TradingView Chart */
.mcard-chart-wrap {
    width: 100%;
    height: 160px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(0, 40, 80, 0.02);
    position: relative;
}

.mcard-chart-wrap .tradingview-widget-container {
    width: 100%;
    height: 100%;
}

/* Card Bottom — Compact */
.mcard-bottom {
    padding: 14px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    border-top: 1px solid rgba(0, 119, 182, 0.04);
}

/* Holdings Chips */
.holdings-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.holding-chip {
    font-size: 0.64rem;
    font-weight: 600;
    color: #3a5a6e;
    background: rgba(0, 119, 182, 0.04);
    border: 1px solid rgba(0, 119, 182, 0.06);
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.holding-chip:hover {
    background: rgba(0, 119, 182, 0.08);
    border-color: rgba(0, 119, 182, 0.12);
}

/* Sector Chips */
.mcard-sectors {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.mcard-updated {
    font-size: 0.62rem;
    color: #8fa8b8;
    font-style: italic;
    margin-top: 4px;
}

.sector-chip {
    font-size: 0.64rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
}

.sector-chip.sector-tech {
    background: rgba(99, 102, 241, 0.08);
    color: #6366f1;
    border: 1px solid rgba(99, 102, 241, 0.1);
}

.sector-chip.sector-finance {
    background: rgba(0, 119, 182, 0.08);
    color: #0077b6;
    border: 1px solid rgba(0, 119, 182, 0.1);
}

.sector-chip.sector-health {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.1);
}

.sector-chip.sector-energy {
    background: rgba(245, 158, 11, 0.08);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.1);
}

.sector-chip.sector-industry {
    background: rgba(107, 114, 128, 0.08);
    color: #4b5563;
    border: 1px solid rgba(107, 114, 128, 0.1);
}

.sector-chip.sector-consumer {
    background: rgba(236, 72, 153, 0.08);
    color: #db2777;
    border: 1px solid rgba(236, 72, 153, 0.1);
}

.sector-chip.sector-commodity {
    background: rgba(217, 119, 6, 0.08);
    color: #b45309;
    border: 1px solid rgba(217, 119, 6, 0.1);
}

.sector-chip.sector-safe {
    background: rgba(234, 179, 8, 0.08);
    color: #a16207;
    border: 1px solid rgba(234, 179, 8, 0.1);
}

/* Source — hidden in compact mode, kept for API updates */
.mcard-source {
    display: none;
}

/* ── Disclaimer ── */
.marches-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0, 119, 182, 0.05);
    border-radius: 10px;
    font-size: 0.68rem;
    color: #8ba3b5;
    line-height: 1.55;
}

.marches-disclaimer i,
.marches-disclaimer svg {
    color: #0077b6;
    flex-shrink: 0;
    margin-top: 1px;
}

/* =========================================
   RESPONSIVE
   ========================================= */

@media (max-width: 1100px) {
    .marches-edu-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .marches-edu-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .marches-header {
        margin-bottom: 24px;
    }

    .marches-title {
        font-size: 1.6rem;
    }

    .marches-sub {
        font-size: 0.92rem;
    }

    .mcard-top {
        padding: 14px 14px 0;
    }

    .mcard-bottom {
        padding: 12px 14px 14px;
    }

    .mcard-chart-wrap {
        height: 140px;
    }

    .mcard-title-group h3 {
        font-size: 0.9rem;
    }

    .marches-badge-row {
        flex-direction: column;
        gap: 10px;
    }

    .mkt-stats-bar {
        gap: 12px;
        padding: 10px 14px;
    }

    .mkt-stat {
        font-size: 0.72rem;
    }

    .mkt-filters {
        gap: 6px;
    }

    .mkt-filter-btn {
        padding: 6px 14px;
        font-size: 0.72rem;
    }

    .mkt-modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .mkt-modal {
        max-height: 80vh;
        border-radius: 16px 16px 0 0;
    }

    .mkt-modal-header {
        padding: 18px 18px 0;
    }

    .mkt-modal-body {
        padding: 16px 18px 20px;
    }

    .mkt-modal-title-group h3 {
        font-size: 1.05rem;
    }
}

/* ── Stats Bar ── */
.mkt-stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 119, 182, 0.08);
    border-radius: 12px;
}

.mkt-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #3a5a6e;
    white-space: nowrap;
}

.mkt-stat i, .mkt-stat svg {
    color: #0077b6;
}

/* ── Filter Tabs ── */
.mkt-filters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 22px;
}

.mkt-filter-btn {
    padding: 7px 18px;
    border-radius: 50px;
    border: 1.5px solid rgba(0, 119, 182, 0.12);
    background: rgba(255, 255, 255, 0.7);
    font-family: 'Montserrat', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    color: #5a7d95;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mkt-filter-btn:hover {
    border-color: rgba(0, 119, 182, 0.25);
    color: #0077b6;
    background: rgba(0, 119, 182, 0.04);
}

.mkt-filter-btn--active {
    background: linear-gradient(135deg, #0077b6, #00b4d8);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(0, 119, 182, 0.25);
}

.mkt-filter-btn--active:hover {
    background: linear-gradient(135deg, #006da8, #00a5c9);
    color: #fff;
    border-color: transparent;
}

/* ── Colored Accent Borders ── */
.mcard-accent--ca {
    border-top: 3px solid #ef4444;
}

.mcard-accent--us {
    border-top: 3px solid #3b82f6;
}

.mcard-accent--gold {
    border-top: 3px solid #eab308;
}

.mcard-accent--oil {
    border-top: 3px solid #1e293b;
}

/* ── Category Badges ── */
.mcard-cat {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 50px;
    white-space: nowrap;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    flex-shrink: 0;
    margin-left: auto;
}

.mcard-cat--indice {
    background: rgba(59, 130, 246, 0.08);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.mcard-cat--commodity {
    background: rgba(234, 179, 8, 0.08);
    color: #a16207;
    border: 1px solid rgba(234, 179, 8, 0.15);
}

/* ── Card filter transition ── */
.market-edu-card.mcard-hidden {
    display: none;
}

/* ── Clickable card hint ── */
.market-edu-card {
    position: relative;
}

.mcard-details-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px 0;
    border: none;
    border-top: 1px solid rgba(0, 119, 182, 0.06);
    background: rgba(0, 119, 182, 0.03);
    color: #0077b6;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.02em;
}

.mcard-details-btn i, .mcard-details-btn svg {
    width: 14px;
    height: 14px;
    transition: transform 0.25s ease;
}

.mcard-details-btn:hover {
    background: rgba(0, 119, 182, 0.07);
    color: #005a8c;
}

.mcard-details-btn:hover i,
.mcard-details-btn:hover svg {
    transform: translateX(3px);
}

/* ── Trend Badge (overlays chart) ── */
.mcard-trend-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: none;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2;
    letter-spacing: 0.02em;
}

.mcard-trend-badge i, .mcard-trend-badge svg {
    width: 12px;
    height: 12px;
}

.mcard-trend-badge.trend-up {
    display: inline-flex;
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.mcard-trend-badge.trend-down {
    display: inline-flex;
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ── Detail Modal ── */
.mkt-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mkt-modal-overlay.mkt-modal--open {
    opacity: 1;
    visibility: visible;
}

.mkt-modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 24px 80px rgba(0, 40, 80, 0.15), 0 4px 16px rgba(0, 40, 80, 0.06);
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(16px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.mkt-modal-overlay.mkt-modal--open .mkt-modal {
    transform: translateY(0) scale(1);
}

.mkt-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.mkt-modal-close:hover {
    background: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.1);
}

.mkt-modal-close i, .mkt-modal-close svg {
    width: 16px;
    height: 16px;
    color: #64748b;
}

.mkt-modal-accent {
    height: 4px;
    border-radius: 20px 20px 0 0;
}

.mkt-modal-accent--ca { background: #ef4444; }
.mkt-modal-accent--us { background: #3b82f6; }
.mkt-modal-accent--gold { background: #eab308; }
.mkt-modal-accent--oil { background: #1e293b; }

.mkt-modal-header {
    padding: 22px 24px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mkt-modal-flag {
    font-size: 2rem;
    line-height: 1;
}

.mkt-modal-title-group {
    flex: 1;
}

.mkt-modal-title-group h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: #0a2540;
    margin: 0 0 4px;
}

.mkt-modal-title-group .mcard-symbol {
    font-size: 0.65rem;
}

.mkt-modal-body {
    padding: 20px 24px 24px;
}

.mkt-modal-section {
    margin-bottom: 18px;
}

.mkt-modal-section:last-child {
    margin-bottom: 0;
}

.mkt-modal-section-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: #0077b6;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mkt-modal-section-title i,
.mkt-modal-section-title svg {
    width: 14px;
    height: 14px;
}

.mkt-modal-text {
    font-size: 0.88rem;
    color: #334155;
    line-height: 1.65;
    margin: 0;
}

.mkt-modal-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.mkt-modal-fact {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 8px;
    background: rgba(0, 119, 182, 0.04);
    border: 1px solid rgba(0, 119, 182, 0.08);
    font-size: 0.74rem;
    font-weight: 600;
    color: #3a5a6e;
}

.mkt-modal-fact i, .mkt-modal-fact svg {
    width: 13px;
    height: 13px;
    color: #0077b6;
}

.mkt-modal-divider {
    height: 1px;
    background: rgba(0, 119, 182, 0.06);
    margin: 16px 0;
}

.mkt-modal-holdings {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.mkt-modal-tv-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(0, 119, 182, 0.06);
    border: 1px solid rgba(0, 119, 182, 0.12);
    color: #0077b6;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.mkt-modal-tv-link:hover {
    background: rgba(0, 119, 182, 0.1);
    border-color: rgba(0, 119, 182, 0.2);
}

@media (max-width: 380px) {
    .marches-title {
        font-size: 1.4rem;
    }

    .mcard-chart-wrap {
        height: 130px;
    }
}
