body {
    background: rgba(0, 0, 0, 0.8);
    font-family: 'Montserrat', sans-serif;
    color: #fff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    margin: 0; /* убираем отступы браузера */
}

/* ===================== ОСНОВНОЕ ОКНО ===================== */
#window {
    position: absolute;
    left: 100px;
    top: 100px;
    width: 800px;
    height: 500px;
    background: #212529;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    resize: both;
    overflow: hidden;
    min-width: 570px;
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

#titleBar {
    height: 40px;
    background: #343a40;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    cursor: move;
    user-select: none;
    font-weight: 400;
    position: relative;
    flex-shrink: 0;
}
#titleText {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    white-space: nowrap;
}
#tabButtons {
    position: absolute;
    right: 10px;
    display: flex;
    gap: 8px;
}
.tab-button {
    width: 24px;
    height: 24px;
    background-color: #495057;
    border: none;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s, box-shadow 0.3s;
    padding: 0;
    color: #fff;
}
.tab-button:hover {
    background-color: #6c757d;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}
.tab-button.active {
    background-color: orange;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* ===================== ВКЛАДКИ (Tab Content) ===================== */
.tab-content {
    flex: 1;
    min-height: 0;
    display: none;
    position: relative;
}
.tab-content.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* чтобы вложенный flex не растягивал родителя */
}

.tab-content::before {
    content: "";
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 256px;
    height: 256px;
    background: url("https://eyeauras.net/assets/img/mainIcon.webp") no-repeat center center;
    background-size: contain;
    opacity: 0.2;
    pointer-events: none;
}

.monaco-editor-container {
    position: relative;
    flex: 1;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden; /* чтобы именно Monaco сам показывал скролл */
    z-index: 0;
}



#executeBtn {
    height: 40px;
    font-size: 16px;
    cursor: pointer;
    background: #495057;
    color: #fff;
    border: none;
    border-radius: 0;
    width: 100%;
    transition: background-color 0.3s;
    flex-shrink: 0;
}
#executeBtn:hover {
    background: #6c757d;
}

/* ===================== ВКЛАДКА OnServer (Таблица) ===================== */
#onserverContainer {
    flex: 1;
    min-height: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    position: relative;
}

#eventTableWrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    position: relative;
    overflow: auto;
    scrollbar-width: none;
}
#eventTableWrapper::-webkit-scrollbar {
    display: none;
}

#eventTable {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0;
}
#eventTable thead {
    position: sticky;
    top: 0px;
}
#eventTable thead th {
    background-color: #495057;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid #6c757d;
}
#eventTable th,
#eventTable td {
    font-size: 12px;
    padding: 4px 6px;
    border-bottom: 1px solid #6c757d;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#eventTable th {
    font-weight: 400;
    position: relative;
    padding-right: 40px;
}

/* Фиксированные ширины столбцов */
#eventTable th:nth-child(1),
#eventTable td:nth-child(1) {
    width: 180px;
}
#eventTable th:nth-child(2),
#eventTable td:nth-child(2) {
    width: 100%;
}
#eventTable th:nth-child(3),
#eventTable td:nth-child(3) {
    width: 120px;
    text-align: center;
}
#eventTable tbody {
    display: block;
    max-height: 100%;
    overflow-y: auto;
}
#eventTable thead,
#eventTable tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

/* Кнопки действий */
.action-button {
    width: 26px;
    height: 26px;
    margin: 0 2px;
    background-color: #6c757d;
    border: none;
    border-radius: 0;
    color: #fff;
    cursor: pointer;
}
.action-button:hover {
    background-color: #868e96;
}
.action-button i {
    pointer-events: none;
}

/* ===================== КАСТОМНОЕ "МОДАЛЬНОЕ" ОКНО ===================== */
#editModal {
    display: none; /* скрыто по умолчанию */
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* полупрозрачная подложка */
    overflow: auto; /* если контент вылезет за пределы окна */
}
#editModalContent {
    background-color: #212529;
    color: #fff;
    margin: 5% auto; /* отступ сверху и выравнивание по центру */
    padding: 20px;
    border: 1px solid #444;
    width: 60%;
    max-width: 800px;    /* чтобы не росло слишком широко */
    min-width: 400px;    /* минимальная ширина */
    position: relative;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.7);
    font-size: 12px;     /* маленький шрифт, как в таблице */
}
#editModalClose {
    color: #aaa;
    float: right;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    margin-top: -4px;
}
#editModalClose:hover {
    color: #fff;
}
#editModalLabel {
    font-size: 14px;
    margin-bottom: 5px;
    font-weight: normal;
}
.editModalSubtitle {
    font-size: 11px;
    margin-bottom: 6px;
    color: #ccc;
}
#editArgumentsInput {
    width: 100%;
    height: 250px;       /* фиксированная высота, чтобы большой JSON прокручивался */
    background-color: #343a40;
    color: #fff;
    border: none;
    padding: 8px;
    resize: vertical;
    font-size: 12px;
    font-family: monospace; /* моноширинный шрифт для JSON */
    line-height: 1.4;
    white-space: pre;
    overflow: auto;
}
#saveEditBtn {
    background-color: #495057;
    color: #fff;
    border: none;
    padding: 6px 16px;
    cursor: pointer;
    margin-top: 10px;
    font-size: 12px;
}
#saveEditBtn:hover {
    background-color: #6c757d;
}

/* ===================== ВКЛАДКА Emit Server (копия таблицы OnServer) ===================== */
#emitServerContainer {
    /* Тот же набор стилей, что и у onserverContainer */
    flex: 1;
    min-height: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    position: relative;
}

#clientEmitTableWrapper {
    /* Тот же набор стилей, что и у eventTableWrapper */
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    position: relative;
    overflow: auto;
    scrollbar-width: none;
}
#clientEmitTableWrapper::-webkit-scrollbar {
    display: none;
}

#clientEmitTable {
    /* Тот же набор стилей, что и у eventTable */
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0;
}
#clientEmitTable thead {
    position: sticky;
    top: 0px;
}
#clientEmitTable thead th {
    background-color: #495057;
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 1px solid #6c757d;
}
#clientEmitTable th,
#clientEmitTable td {
    font-size: 12px;
    padding: 4px 6px;
    border-bottom: 1px solid #6c757d;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#clientEmitTable th {
    font-weight: 400;
    position: relative;
    padding-right: 40px;
}

/* Фиксированные ширины столбцов */
#clientEmitTable th:nth-child(1),
#clientEmitTable td:nth-child(1) {
    width: 180px;
}
#clientEmitTable th:nth-child(2),
#clientEmitTable td:nth-child(2) {
    width: 100%;
}
#clientEmitTable th:nth-child(3),
#clientEmitTable td:nth-child(3) {
    width: 120px;
    text-align: center;
}
#clientEmitTable tbody {
    display: block;
    max-height: 100%;
    overflow-y: auto;
}
#clientEmitTable thead,
#clientEmitTable tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

/* ===================== Кнопки очистки для таблиц ===================== */
#clearTableBtn,
#clearClientEmitTableBtn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-color: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}
#clearTableBtn:hover,
#clearClientEmitTableBtn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
}
#clearTableBtn svg,
#clearClientEmitTableBtn svg {
    width: 12px;
    height: 12px;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
}
