/* MODAL v.1.0.5 */

.modal-backdrop {
    z-index: 2000;
}

.modal-dialog {
    z-index: 2001;
    margin-top: 1%;
}

.modal-title {
    width: 90%;
    white-space: nowrap;
    overflow: hidden;
    -ms-text-overflow: ellipsis;
    text-overflow: ellipsis;
}

.modal-body img {
    background-color: #ddd;
    width: 100% !important;
    height: auto !important;
}

.modal-body .modal-description {
    margin: 15px 0 0;
}

.modal-body .modal-description p {
    width: 90%;
    -ms-word-wrap: break-word;
    word-wrap: break-word;
    white-space: normal;
}

.modal a:hover {
    text-decoration: none !important;
}

body > svg,
.modal .modal-img-svg {
    position: absolute;
    left: -800px;
    top: -800px;
    z-index: -99999;
}

@media (max-width: 1024px) {
    .modal-dialog {
        margin-top: 15%;
    }
}

@media (max-width: 800px) {
    .modal-dialog {
        margin-top: 25%;
    }
}

@media (min-width: 100px) and (max-width: 480px) {
    .modal-dialog {
        margin-top: 30%;
    }
    .modal-content {
        margin: 15px;
    }
}

/* Insights modal: nearly full viewport with 50px margin on all sides */

/* Web: two columns 50% each – chart left, insights right with vertical scroll */
@media (min-width: 768px) {
    .modal.insights-modal-full .modal-body {
        flex-direction: row;
    }
    .modal.insights-modal-full .modal-body .insights-viz-panel {
        flex: 0 0 50%;
        width: 50%;
        min-width: 0;
        border-right: 1px solid #ddd;
        border-bottom: none;
    }
    .modal.insights-modal-full .modal-body .insights-response-panel {
        flex: 0 0 50%;
        width: 50%;
        min-width: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        border-top: none;
    }
    .modal.insights-modal-full .modal-body .insights-response-header {
        flex-shrink: 0;
    }
    .modal.insights-modal-full .modal-body .insights-response-content {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }
}

/* Mobile: stacked 50% height each – chart top, insights bottom */
@media (max-width: 767px) {
    .modal.insights-modal-full .modal-body {
        flex-direction: column;
    }
    .modal.insights-modal-full .modal-body .insights-viz-panel {
        flex: 0 0 50%;
        min-height: 200px;
        border-bottom: 1px solid #ddd;
        border-right: none;
    }
    .modal.insights-modal-full .modal-body .insights-response-panel {
        flex: 1;
        min-height: 200px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        border-top: 1px solid #eee;
    }
    .modal.insights-modal-full .modal-body .insights-response-header {
        flex-shrink: 0;
    }
    .modal.insights-modal-full .modal-body .insights-response-content {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
    }
}

.modal.insights-modal-full .modal-dialog {
    margin: 50px;
    width: calc(100vw - 100px);
    max-width: none;
    height: calc(100vh - 70px);
}
.modal.insights-modal-full .modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}
.modal.insights-modal-full .modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    overflow: hidden;
}
.modal.insights-modal-full .modal-body .insights-viz-panel,
.modal.insights-modal-full .modal-body .insights-response-panel {
    min-height: 0;
    overflow: hidden;
}
.modal.insights-modal-full .modal-footer {
    flex-shrink: 0;
}

.insights-response-header {
    padding: 8px 10px;
    font-weight: 600;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
}
.insights-viz-container {
    margin: 10px;
    height: 100%;
}

.insights-markdown-content h1,
.insights-markdown-content h2,
.insights-markdown-content h3 {
    margin: 1em 0 0.5em;
    font-weight: 600;
}
.insights-markdown-content h1 { font-size: 1.25rem; }
.insights-markdown-content h2 { font-size: 1.1rem; }
.insights-markdown-content h3 { font-size: 1rem; }
.insights-markdown-content p { margin: 0.5em 0; }
.insights-markdown-content ul { margin: 0.5em 0; padding-left: 1.5em; }
.insights-markdown-content li { margin: 0.25em 0; }
