* {
   margin: 0;
   padding: 0;
   box-sizing: border-box;
}

body {
   font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
   background: #f5f5f5;
   overflow-x: hidden;
}

.header {
   background: linear-gradient(135deg, #dc2626, #ef4444);
   color: white;
   padding: 15px 0;
   text-align: center;
   box-shadow: 0 2px 10px rgba(0,0,0,0.1);
   flex-shrink: 0;
}

.main-container {
   display: flex;
   height: calc(100vh - 80px);
   max-width: none !important;
   padding: 0 !important;
}

/* --- Tab Styles --- */
.config-tabs-wrapper {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #dee2e6;
    background-color: #fff;
}

.nav-tabs {
    border-bottom: none;
    flex-wrap: nowrap;
    justify-content: space-around;
}

.nav-tabs .nav-link {
    border: none;
    padding: 0.5rem;
    color: #6c757d; /* Default icon color */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    height: 50px;
}

.nav-tabs .nav-link svg {
    transition: color 0.2s ease-in-out;
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-link:hover {
    color: #dc2626; /* Red/Orange for active and hover */
    background-color: transparent;
}

.nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #dc2626;
}

.tab-title-display {
    text-align: center;
    font-weight: 600;
    color: #343a40;
    padding-top: 0.75rem;
    margin-top: 1rem; /* Аккуратный отступ */
    font-size: 1.1rem;
}

/* --- Ausstattung Tab Styles --- */
.ausstattung-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.ausstattung-menu-item:hover {
    background-color: #f8f9fa;
}
.ausstattung-menu-item .content {
    display: flex;
    align-items: center;
}
.ausstattung-menu-item img {
    width: 80px;
    margin-right: 1rem;
}
.ausstattung-menu-item .title {
    font-weight: bold;
    margin-bottom: 0.25rem;
}
.ausstattung-menu-item .subtitle {
    font-size: 0.8rem;
    color: #6c757d;
    background-color: #e9ecef;
    padding: 0.1rem 0.4rem;
    border-radius: 0.25rem;
    display: inline-block;
    margin-right: 0.3rem;
}
.ausstattung-menu-item .arrow {
    font-size: 1.5rem;
    color: #6c757d;
}

.ausstattung-detail-view .btn-back {
    font-weight: bold;
    cursor: pointer;
    color: #343a40;
    margin-bottom: 2.5rem;
}
.ausstattung-detail-view .btn-back:hover {
    color: #dc2626;
}

.placement-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.placement-pill {
    background-color: #20c997;
    color: white;
    padding: 0.3rem 0.7rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
}
.placement-pill .btn-remove-pill {
    background: none;
    border: none;
    color: white;
    margin-left: 0.5rem;
    padding: 0;
    line-height: 1;
}
.material-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.material-option {
    border: 2px solid #e9ecef;
    border-radius: .25rem;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease;
    /* Добавленные стили */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.ausstattung-group-title {
    font-size: 1rem;
    font-weight: bold;
    color: #dc2626;
    border-bottom: 2px solid #dc2626;
    padding-bottom: 0.25rem;
    margin-bottom: 0.5rem;
    margin-left: 1rem;
    margin-right: 1rem;
    display: inline-block;
}
.material-option:hover {
    border-color: #adb5bd;
}
.material-option.selected {
    border-color: #20c997;
}
.material-option img {
    max-width: 60px;
    height: 60px;
    object-fit: cover;
    margin-bottom: 5px;
}
.material-option span {
    font-size: 0.8rem;
}
.btn-select-bays {
    font-weight: bold;
    cursor: pointer;
}
.btn-select-bays:hover {
    color: #dc2626;
}
#bay-selection-modal .form-check {
    padding-left: 2.5em; /* Increase padding to avoid text overlap */
}
#bay-selection-modal .form-check-label {
    padding-top: 0.15em;
}

/* --- Specific control styles from image --- */
.selection-box {
    border: 1px solid #ced4da;
    border-radius: .25rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.selection-box-content {
    display: flex;
    align-items: center;
}

.selection-box-content img {
    max-width: 60px;
    margin-right: 1rem;
}

.selection-box-label {
    font-weight: bold;
    margin-bottom: 0;
}

.form-check-input.is-large {
    width: 1.5em;
    height: 1.5em;
    margin-top: 0;
}
.option-preview {
    border: 2px solid #e9ecef;
    border-radius: .25rem;
    padding: 10px;
    text-align: center;
    cursor: pointer;
}
.option-preview.selected {
    border-color: #20c997;
}
.option-preview img {
    max-width: 80px;
    margin-bottom: 5px;
}

/* =============================================================== */
/* ИСПРАВЛЕНИЕ #1: Отображение панели на десктопе */
/* =============================================================== */
@media (min-width: 992px) {
    /* Заставляем Offcanvas вести себя как статичная боковая панель */
    #controls-panel.offcanvas {
        position: static;
        transform: translateX(0) !important; /* Важнейшее правило для отображения */
        visibility: visible !important;
        width: 380px !important;
        border-right: 1px solid #e0e0e0;
        box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    }
    /* Скрываем ненужные элементы Offcanvas на десктопе */
    #controls-panel .offcanvas-header,
    #controls-panel .offcanvas-footer {
        display: none;
    }
    #controls-panel .offcanvas-body {
        padding: 20px;
    }
    /* Скрываем фон-затемнение на десктопе */
    .offcanvas-backdrop {
        display: none !important;
    }
    #controls-content {
        padding: 0; /* Убираем лишний отступ, т.к. он есть у body */
    }
}

.viewer-container {
   flex: 1;
   position: relative;
   background: #f8f9fa;
   display: flex;
   flex-direction: column;
}

#scene-container {
    width: 100%;
    height: 100%;
    flex-grow: 1;
}

/* =============================================================== */
/* ИСПРАВЛЕНИЕ #2: Красные мобильные кнопки */
/* =============================================================== */
.mobile-controls-toggle .btn,
.offcanvas-footer .btn {
    background-color: #dc2626;
    border-color: #dc2626;
}
.mobile-controls-toggle .btn:hover,
.offcanvas-footer .btn:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}
.mobile-controls-toggle {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    border-top: 1px solid #dee2e6;
    z-index: 1040;
}

.control-section {
   padding-bottom: 20px;
   border-bottom: 1px solid #f0f0f0;
}

.section-title {
   font-size: 16px;
   font-weight: 600;
   color: white;
   margin-bottom: 15px;
   display: flex;
   align-items: center;
   background: #dc2626;
   padding: 10px 15px;
   border-radius: 0;
}

@media (min-width: 992px) {
    .section-title {
        margin: -20px -20px 15px -20px;
    }
}

.control-section.color-section .section-title {
   background: #dc2626;
   color: white;
}

.control-group {
   margin-bottom: 20px;
}

.control-label {
   display: block;
   font-size: 14px;
   font-weight: 500;
   color: #555;
   margin-bottom: 8px;
}

.range-display {
   font-size: 12px;
   color: #666;
   text-align: right;
   margin-bottom: 5px;
}

.color-options {
   display: flex !important;
   gap: 8px;
}

.color-option {
   display: flex !important;
   flex-direction: column;
   align-items: center;
   padding: 15px 10px;
   border: 2px solid #ddd;
   border-radius: 4px;
   cursor: pointer;
   background: white;
   flex: 1;
   text-align: center;
   transition: all 0.2s ease;
}

.color-option.selected {
   border-color: #20c997 !important;
}

.color-option.selected span {
   color: #000;
   font-weight: bold;
}

.color-option img {
   width: 50px;
   height: 50px;
   margin-bottom: 8px;
   object-fit: cover;
}

.color-option span {
   font-size: 13px;
   font-weight: 500;
}

.color-option:hover {
   box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
   border-color: #adb5bd !important;
}

.viewer-controls {
   padding: 0.75rem 1rem;
   background-color: #f8f9fa;
   border-bottom: 1px solid #dee2e6;
   flex-shrink: 0;
}

.loading-indicator {
   position: absolute;
   top: 50%;
   left: 50%;
   transform: translate(-50%, -50%);
   color: #666;
   font-size: 16px;
   padding: 1rem 1.5rem;
   background: rgba(255, 255, 255, 0.9);
   border-radius: 8px;
}

.offcanvas-body {
    overflow-x: hidden;
}

.offcanvas-body::-webkit-scrollbar {
   width: 8px;
}

.offcanvas-body::-webkit-scrollbar-track {
   background: #f1f1f1;
}

.offcanvas-body::-webkit-scrollbar-thumb {
   background: #dc2626;
   border-radius: 4px;
}

.offcanvas-body::-webkit-scrollbar-thumb:hover {
   background: #b91c1c;
}

@media (max-width: 991.98px) {
    body {
        height: 100vh;
        overflow: hidden;
    }
   .main-container {
       flex-direction: column;
       height: calc(100vh - 56px);
   }
   .viewer-container {
       height: 100%;
   }
}

/* =============================================================== */
/* ИСПРАВЛЕНИЕ #3: Верхние кнопки на мобильных */
/* =============================================================== */
@media (max-width: 767.98px) {
    .viewer-controls {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
}

/* --- Fixes for Component Colors --- */
.modal-footer .btn-primary {
    background-color: #dc2626;
    border-color: #dc2626;
}
.modal-footer .btn-primary:hover {
    background-color: #b91c1c;
    border-color: #b91c1c;
}
.form-check-input:checked {
    background-color: #dc2626;
    border-color: #dc2626;
}

/* Custom component colors */
.btn-primary {
    background-color: #dc2626;
    border-color: #dc2626;
}
.btn-primary:hover, .btn-primary:active, .btn-primary:focus {
    background-color: #b91c1c !important;
    border-color: #b91c1c !important;
    box-shadow: 0 0 0 0.25rem rgba(220, 38, 38, 0.5) !important;
}

.form-check-input:checked {
    background-color: #dc2626;
    border-color: #dc2626;
}

.form-check-input:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 0.25rem rgba(220, 38, 38, 0.25);
}

/* Уменьшение высоты кнопок-табов */
#config-tabs .nav-link {
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
    height: 55px; 
}

#config-tabs .nav-link svg {
    height: 28px;
    width: auto;
}

/* Скрытие текста на кнопках Назад/Вперед на мобильных */
@media (max-width: 991.98px) {
    #btn-prev .button-label-mobile-hide,
    #btn-next .button-label-mobile-hide {
        display: none;
    }
}