* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0px;       
}

body {
    height: 100%;
    min-height: 100%;
    background: linear-gradient(262deg, #ffffff 0%, #25b18242 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;       
}

.container {
    width: 100%;
    background-color: rgb(255 255 255 / 50%);
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: visible;
    max-width: 95%;
    display: flex;
    flex: 1 auto;
    flex-direction: column;
    height: inherit;
    flex-grow: 1;
    overflow: hidden;
    height: 100vh;
}

.container .a {
    display: flex;
    flex-direction: row;
    height: 100%;
}

.container .b {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100vh;
}

.container .c {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.matrix-header {
    text-align: center;
    padding: 20px;    
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.matrix-header h1 {
    color: #4a5568;
    margin: 0;
    font-size: 1.8rem;
    font-weight: 400;
}

.matrix-container {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 5px;
    flex: 1;
    flex-grow: 1;
    flex-shrink: 0;
    min-height: 0;
}

/* Оси и подписи */
.axis-y {
    height: auto;
    align-items: center;
    writing-mode: sideways-lr;
    white-space: nowrap;
    font-weight: 400;
    z-index: 1;
    width: auto;
    padding: 4px;
    font-size: 20px;
    display: flex;
    flex-direction: row-reverse;
    justify-content: start;
    flex-shrink: 0;
    padding-bottom: 50px;
}

.axis-x {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    font-weight: 400;
    z-index: 1;
    width: auto;
    padding: 4px;
    font-size: 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: start;    
}

.arrow-y, .arrow-x {
    color: #25b182;
    font-size: larger;
}

.arrow-y {
    writing-mode: horizontal-tb;
}


/* Квадранты матрицы */
.quadrant {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #ffffff;
    height:100%;
}

.quadrant:hover {        
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.label {
    text-align: center;    
    margin-bottom: 15px;
    font-size: 16px;
    color: #2d3748;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-container {
    width: 100%;
    height: 100%;
    min-height: 300px;
    position: relative;
}

#custom-tooltip {
    opacity: 0;
    pointer-events: none;
}

/* Выезжающая панель */
.slide-panel {
    position: fixed;
    right: 0px;
    top: 50%;
    transform: translateY(-50%);
    width: 500px;
    height: 100%;
    background-color: white;
    border-radius: 15px 0 0 15px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
    transition: right 0.4s ease-in-out;
    overflow: hidden;
    z-index: 10500;
    max-height: 100%;
    overflow: auto;
}

.slide-panel.open {
    right: 0!important;
}

.panel-header {
    background: #25b182;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    outline: none;
}

.panel-content {
    padding: 10px;
    overflow-y: auto;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 16px;
    color: #718096;
}

.btn-group-h {
    position: absolute;
    right: 0;
    top: -40px;
    display: flex;
    gap: 5px;
}

.fullscreen-btn, .list-btn {
    padding: 8px 16px;
    background-color: #ececec;
    color: #000000;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.fullscreen-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
}
/* Модальное окно */

#modalChartContainer {
    width: 100%;
    height: 100%;
    min-height: 400px; /* минимальная высота */
    margin: 20px;
}

#modalChart {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(255 255 255 / 81%);
    display: none;
    z-index: 10000;
}

.modal {
    display:none;
    padding: 20px;
    border: 1px solid #888;
    width: 100%;
    max-width: calc(100%);
    position: fixed;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    left: 0;
    top: 0;
}

.modal-content {
    background-color: #fff;
    box-shadow: 7px 9px 2px #0000001f;
    margin: 0 auto;
    padding: 20px;
    border: 1px solid #dddddd;
    width: 90%;
    height: calc(100% - 30px);
    position: relative;
    border-radius: 10px;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;    
    cursor: pointer;
}

.info {
    position: fixed;
    z-index: 1;
    right: 0;
    bottom: 0;
    background: #ebebeb9c;
    border: 1px solid #c9c9c94a;
    box-shadow: 6px 9px 3px #cbcbcb;
    font-size: .8rem;
}

.modebar-container {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
}

.modebar {
    margin: 0 auto !important;
}

.list-bn {
    padding: 10px;
    background: #f1f1f1;
    border-radius: 10px;
    margin:10px;
}

.panel-content a {
    color: #2d2d2d;
    text-decoration: none;
}


/* Адаптивность */
@media (max-width: 992px) {
    .matrix-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        overflow: auto;
    }

    .axis-y, .axis-x {
        display: none;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        overflow:auto;
    }

    .container {
        border-radius: 10px;
        height: 100%;
    }

    .matrix-header h1 {
        font-size: 1.5rem;
    }

    .slide-panel {
        width: 100%;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .matrix-header {
        padding: 15px;
    }

        .matrix-header h1 {
            font-size: 1.3rem;
        }

    .quadrant {
        padding: 10px;
    }

    .label {
        font-size: 14px;
    }

    .chart-container {
        height: 250px;
    }

    .slide-panel {
        width: 100%;       
        height: 100%;        
        z-index: 5000;
        position: fixed;
        display: block;
    }
}
