/* Scoped CSS for TWAP Interactive Chart Component */
.twap-chartbox {
    --twap-navy: #061126;
    --twap-purple: #4b00b5;
    --twap-blue: #0f66b7;
    --twap-orange: #ff7a00;
    --twap-green: #20a33a;
    --twap-red: #d92b2b;
    --twap-sdp: #36a640;
    --twap-win: rgba(109, 32, 230, 0.10);
    --twap-allowed: rgba(15, 102, 183, 0.12);
    
    position: relative;
    width: 100%;
    max-width: 100%;
    background: rgba(248, 249, 255, 0.95);
    border: 1px solid rgba(6, 17, 38, 0.08);
    border-radius: 28px;
    box-shadow: 0 24px 70px rgba(6, 17, 38, 0.13);
    padding: 30px 40px;
    margin: 0 auto;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--twap-navy);
}

svg.twap-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.twap-axis {
    stroke: rgba(6, 17, 38, 0.72);
    stroke-width: 1.4;
}

.twap-grid {
    stroke: rgba(6, 17, 38, 0.17);
    stroke-dasharray: 4 4;
}

.twap-tick, .twap-label {
    fill: var(--twap-navy);
    font-size: 13px;
    font-weight: 650;
}

.twap-label {
    font-size: 15px;
    font-weight: 760;
}

/* Premium Comment/Callout Boxes from Screenshot */
.twap-call-bg {
    fill: #ffffff;
    stroke: var(--twap-purple);
    stroke-width: 1.2;
}

.twap-call text {
    fill: var(--twap-purple);
    font-size: 13px;
    font-weight: 550;
    line-height: 1.3;
}

/* Styled Leader Lines with Arrowheads */
.twap-call-line {
    stroke: var(--twap-purple);
    stroke-width: 1.1;
    fill: none;
}

/* Legend items styling */
.twap-legend {
    display: flex;
    justify-content: center;
    gap: 20px 28px;
    flex-wrap: wrap;
    padding: 20px 24px 0;
    font-weight: 700;
}

.twap-lg {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--twap-navy);
    white-space: nowrap;
}

.twap-sw {
    width: 24px;
    height: 10px;
    border-radius: 3px;
}

.twap-ln {
    width: 30px;
    border-top: 3px solid currentColor;
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.twap-ln:after {
    content: "";
    position: absolute;
    left: 11px;
    top: -7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    border: 2px solid white;
}

/* Custom Interactive Tooltip */
.twap-tip {
    position: fixed;
    z-index: 1050;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -115%);
    background: rgba(6, 17, 38, 0.94);
    color: white;
    border-radius: 12px;
    padding: 10px 12px;
    min-width: 190px;
    font-size: 13px;
    box-shadow: 0 16px 40px rgba(6, 17, 38, 0.28);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.4;
    transition: opacity 0.15s ease;
}

.twap-tip b {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    color: #ff7a00;
}

/* Mobile rotate notice */
.twap-mobile-notice {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(75, 0, 181, 0.05);
    border: 1px dashed rgba(75, 0, 181, 0.25);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    color: var(--twap-purple);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.twap-mobile-notice svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    fill: currentColor;
    animation: twap-rotate-pulse 2s infinite ease-in-out;
}

@keyframes twap-rotate-pulse {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}

/* Responsiveness adjustments */
@media (max-width: 991px) {
    .twap-chartbox {
        padding: 20px 15px;
        border-radius: 16px;
    }
    .twap-tick, .twap-label {
        font-size: 11px;
    }
    .twap-legend {
        padding: 15px 10px 0;
        gap: 12px 16px;
    }
    .twap-lg {
        font-size: 12px;
    }
}

/* Orientation-specific rules for mobile/tablets */
@media (max-width: 991px) and (orientation: portrait) {
    .twap-mobile-notice {
        display: flex;
    }
    .twap-call {
        display: none !important;
    }
}

@media (max-width: 575px) {
    .twap-call {
        display: none !important;
    }
}