/* Основные стили */
body {
    font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
    margin: 0;
    background: #f0f0f0;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 80vh;
    position: relative;
    z-index: 1;
}

.control-panel {
    width: 300px;
    padding: 20px;
    background: #fff;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 2;
}

#viewport {
    width: 50%;
    height: 100%;
    background: #2d2d2d;
    z-index: 1;
}

.templates-panel {
    width: 380px;
    padding: 20px;
    background: #fff;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 2;
    position: fixed;
    right: 0;
    top: 0;
    height: 100%;
}

.templates-panel h3 {
    margin-top: 0;
}

#templates-list {
    list-style-type: none;
    padding: 0;
}

#templates-list li {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#templates-list li:hover {
    background: #f1f1f1;
}

#templates-list li button {
    background: #ff4d4d;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    width: 100px;
}

#templates-list li button:hover {
    background: #ff1a1a;
}

/* Темная тема */
body.dark-theme {
    background: #121212;
    color: #ffffff;
}

body.dark-theme .control-panel {
    background: #1e1e1e;
    color: #ffffff;
}

body.dark-theme #viewport {
    background: #2d2d2d;
}

body.dark-theme .cargo-list {
    background: #1e1e1e;
    color: #ffffff;
}

body.dark-theme #cargo-table th,
body.dark-theme #cargo-table td {
    border: 1px solid #444;
}

body.dark-theme #cargo-table th {
    background: #2d2d2d;
}

body.dark-theme #cargo-table tr:hover {
    background: #444;
}

/* Остальные стили остаются без изменений */

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 300px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

/* Стили для страницы настроек */
.settings-container {
    width: 80%;
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.settings-container h1 {
    margin-top: 0;
}

.settings-container .form-section {
    margin-bottom: 20px;
}

.settings-container .form-group {
    margin-bottom: 15px;
}

.settings-container .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.settings-container .form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.settings-container button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s ease;
}

.settings-container button:hover {
    background: #45a049;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 300px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

body.dark-theme {
    background: #121212;
    color: #ffffff;
}

body.dark-theme .control-panel {
    background: #1e1e1e;
    color: #ffffff;
}

body.dark-theme #viewport {
    background: #2d2d2d;
}

body.dark-theme .cargo-list {
    background: #1e1e1e;
    color: #ffffff;
}

body.dark-theme #cargo-table th,
body.dark-theme #cargo-table td {
    border: 1px solid #444;
}

body.dark-theme #cargo-table th {
    background: #2d2d2d;
}

body.dark-theme #cargo-table tr:hover {
    background: #444;
}

.container {
    display: flex;
    height: 80vh;
    position: relative; /* Добавляем относительное позиционирование */
    z-index: 1; /* Убедимся, что контейнер выше других элементов */
}

.control-panel {
    width: 300px;
    padding: 20px;
    background: #fff;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 2; /* Убедимся, что панель управления выше других элементов */
}

#viewport {
    width: 50%;
    height: 100%;
    background: #f8f8f8;
    z-index: 1; /* Убедимся, что 3D-визуализация ниже панели управления */
}

.cargo-list {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20vh;
    background: #fff;
    padding: 15px;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    overflow-y: auto;
    z-index: 2; /* Убедимся, что список грузов выше других элементов */
}
.form-section {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.dimensions-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s ease;
}

button:hover {
    background: #45a049;
}

.stats {
    margin: 20px 0;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 8px;
}

.stats p {
    margin: 5px 0;
    font-size: 14px;
}

#total-mass {
    font-weight: bold;
    color: #4CAF50;
}

#max-mass {
    font-weight: bold;
    color: #555;
}

.cargo-list {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20vh;
    background: #fff;
    padding: 15px;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    overflow-y: auto;
}

#cargo-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

#cargo-table th,
#cargo-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    font-size: 14px;
}

#cargo-table th {
    background: #f8f8f8;
}

#cargo-table tr:hover {
    background: #f1f1f1;
}

.label {
    color: white;
    font-family: Arial, sans-serif;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.7);
    padding: 5px;
    border-radius: 5px;
    transition: opacity 0.3s ease;
}

.label:hover {
    opacity: 0.9;
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
        height: auto;
    }

    .control-panel {
        width: 100%;
        height: auto;
        padding: 10px;
    }

    #viewport {
        width: 100%;
        height: 50vh;
    }

    .cargo-list {
        position: static;
        height: auto;
    }
}
.import-button {
    background: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    margin-top: 10px;
    display: block;
}

.import-button:hover {
    background: #45a049;
}