/* Modal shell (shared by the growth chart), canvas, and the hover tooltip */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(20px);
    border: none;
    border-radius: 20px;
    padding: 0;
    width: 90vw;
    max-width: 500px;
    max-height: 90vh;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-header {
    background: linear-gradient(135deg, #2563eb, #a855f7, #2563eb);
    background-size: 250% 250%;
    padding: 30px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    animation: animateGradient 9s ease infinite;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(147, 51, 234, 0.1));
    backdrop-filter: blur(5px);
    border-radius: 20px 20px 0 0;
}

.modal-header h3 {
    color: white;
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.close-button {
    display: none;
}

.chart-container {
    position: relative;
    background: rgba(15, 23, 42, 0.8);
    margin: 20px;
    border-radius: 16px;
    padding: 20px;
    border: none;
    backdrop-filter: blur(10px);
}

#growthChart {
    display: block;
    width: 100%;
    max-height: 60vh;
    cursor: crosshair;
    border-radius: 8px;
}

.chart-tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    pointer-events: none;
    border: none;
    backdrop-filter: blur(10px);
    z-index: 1100;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

@media (min-width: 601px) {
    #chartModal .modal-content {
        width: min(100%, calc(var(--desktop-shell-width) * 0.8));
        max-width: calc(var(--desktop-shell-width) * 0.8);
        height: calc(var(--desktop-shell-height) * 0.8);
        min-height: calc(var(--desktop-shell-height) * 0.8);
        max-height: calc(var(--desktop-shell-height) * 0.8);
        border-radius: var(--shell-radius);
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #chartModal .modal-header {
        padding: 18px 56px 18px 24px;
        border-radius: var(--shell-radius) var(--shell-radius) 0 0;
        flex-shrink: 0;
    }

    #chartModal .chart-close-button {
        position: absolute;
        top: 50%;
        right: 16px;
        z-index: 3;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        border: 1px solid rgba(255, 255, 255, 0.4);
        background: rgba(15, 23, 42, 0.32);
        color: white;
        font-family: 'Poppins', sans-serif;
        font-size: 1.45rem;
        font-weight: 500;
        line-height: 1;
        transform: translateY(-50%);
        cursor: pointer;
        transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    }

    #chartModal .chart-close-button:hover,
    #chartModal .chart-close-button:focus-visible {
        background: rgba(15, 23, 42, 0.55);
        border-color: rgba(255, 255, 255, 0.7);
        outline: none;
        transform: translateY(-50%) scale(1.05);
    }

    #chartModal .modal-header::before {
        border-radius: var(--shell-radius) var(--shell-radius) 0 0;
    }

    #chartModal .modal-header h3 {
        font-size: 1.35rem;
    }

    #chartModal .chart-container {
        flex: 1 1 auto;
        min-height: 0;
        margin: 8px;
        padding: 8px 10px 10px;
        display: flex;
        flex-direction: column;
    }

    #chartModal #growthChart {
        display: block;
        width: 100%;
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
    }
}
