/* =========================================
   1. ГЛОБАЛЬНЫЕ НАСТРОЙКИ И ПЕРЕМЕННЫЕ
   ========================================= */
:root {
    --bg-gradient: radial-gradient(circle at center, #2a2a2a 0%, #000000 100%);
    --panel-bg: rgba(20, 20, 20, 0.95);
    --accent-color: #c52f2f;
    --text-color: #e0e0e0;
    --gulf-red: #b70000;
}

body,
html {
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    overflow-x: hidden;
    min-height: 100%;
}

/* =========================================
   2. АГРЕССИВНАЯ ШАПКА (ИЗ HOME.CSS)
   ========================================= */
.main-header.journal-header {
    height: 80px;
    background: linear-gradient(to bottom, #000 0%, #0a0a0a 100%);
    border-bottom: 2px solid #1a1a1a;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.header-flex {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Логотип */
.logo-text-aggresive {
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 28px;
    font-weight: 900;
    text-transform: uppercase;
    font-style: italic;
    letter-spacing: -1px;
    color: #fff;
    display: flex;
    gap: 10px;
    position: relative;
    transition: all 0.3s ease;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 1);
}

.gulf-word {
    color: #fff;
}

.perf-word {
    color: var(--gulf-red);
    position: relative;
    transition: all 0.2s ease;
}

.logo-text-aggresive:hover {
    transform: skewX(-5deg);
}

.logo-text-aggresive:hover .gulf-word {
    text-shadow: 2px 0 0 rgba(255, 255, 255, 0.2), -1px 0 0 rgba(255, 255, 255, 0.2);
}

.logo-text-aggresive:hover .perf-word {
    color: #fff;
    text-shadow: 3px 0px 0px #ff0000, -3px 0px 0px #b70000, 0 0 20px rgba(183, 0, 0, 0.8);
    animation: glitch-pulse 0.4s infinite alternate;
}

.logo-text-aggresive::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--gulf-red);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--gulf-red);
}

.logo-text-aggresive:hover::after {
    width: 100%;
}

@keyframes glitch-pulse {
    0% {
        transform: translate(0);
        color: #ff3333;
    }

    50% {
        transform: translate(-1px, 1px);
        color: #b70000;
        text-shadow: 3px 0px 10px rgba(183, 0, 0, 0.9);
    }

    100% {
        transform: translate(1px, -1px);
        color: #ffffff;
    }
}

/* Кнопка "Назад" */
.gulf-back-btn {
    position: relative;
    display: inline-block;
    padding: 12px 28px;
    background: transparent;
    color: #ffffff;
    text-decoration: none;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: pointer;
}

.btn-content {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 2;
}

.arrow svg {
    width: 18px;
    height: 18px;
    transition: transform 0.4s ease;
}

.gulf-back-btn:hover {
    color: #fff;
    border-color: #b70000;
    box-shadow: 0 0 25px rgba(183, 0, 0, 0.4);
    transform: translateY(-2px);
}

.gulf-back-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(183, 0, 0, 0.1), transparent);
    transition: all 0.6s ease;
    z-index: 1;
}

.gulf-back-btn:hover::before {
    left: 100%;
}

.gulf-back-btn:hover .arrow {
    transform: translateX(-5px);
    color: #b70000;
}

.gulf-back-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: #b70000;
    transition: all 0.4s ease;
    transform: translateX(-50%);
}

.gulf-back-btn:hover::after {
    width: 100%;
}

.btn-glitch-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #b70000;
    display: block;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
    z-index: 1;
}

.gulf-back-btn:hover .btn-glitch-layer {
    transform: scaleX(1);
    transform-origin: left;
    transition-delay: 0s;
    opacity: 0.1;
}

/* =========================================
   3. ГЛАВНАЯ СЕТКА КОНФИГУРАТОРА (ПК)
   ========================================= */
.configurator-container {
    display: grid;
    grid-template-columns: 320px 1fr 300px;
    height: calc(100vh - 80px);
    margin-top: 80px;
    /* Отступ под шапку */
    min-height: 500px;
    box-sizing: border-box;
}

.mobile-tabs-container {
    display: none;
}

/* =========================================
   4. БОКОВЫЕ ПАНЕЛИ
   ========================================= */
.sidebar {
    padding: 15px;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    display: block !important;
}

.panel-box {
    background: var(--panel-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
}

.panel-box h2 {
    font-size: 15px;
    text-align: center;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.filter-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.config-input {
    background: #222;
    color: #fff;
    border: 1px solid #444;
    padding: 12px;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}

.scrollable-list {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column !important;
    gap: 10px;
    padding-right: 5px;
}

.scrollable-list::-webkit-scrollbar {
    width: 6px;
}

.scrollable-list::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable-list::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.option-btn {
    width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #444;
    color: #ccc;
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}

.option-btn:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.option-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    font-weight: bold;
}

.canopy-option {
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: 0.3s;
}

.canopy-option:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #777;
}

.canopy-option.active {
    border-color: var(--accent-color);
    background: rgba(197, 47, 47, 0.05);
}

.blueprint-icon {
    width: 60px;
    height: 40px;
    flex-shrink: 0;
    opacity: 0.7;
    color: #fff;
}

.canopy-option.active .blueprint-icon {
    opacity: 1;
    transform: scale(1.05);
    stroke: var(--accent-color);
}

.canopy-text {
    display: flex;
    flex-direction: column;
}

.c-title {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.c-desc {
    font-size: 11px;
    color: #777;
    margin-top: 2px;
}

/* =========================================
   5. 3D ВЬЮВЕР И УПРАВЛЕНИЕ
   ========================================= */
.viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

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

/* Скрываем кнопки камеры, если они остались в HTML */
.camera-controls {
    display: none !important;
}

/* Материалы (сверху) */
.top-controls {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.top-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #888;
    text-transform: uppercase;
}

.materials-row {
    display: flex;
    gap: 15px;
}

.material-pill {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid #555;
    padding: 8px 15px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #ccc;
    font-size: 13px;
    font-weight: 600;
    transition: 0.3s;
}

.material-pill.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

.info-icon {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-icon svg {
    width: 10px;
    height: 10px;
}

.tooltip-popup {
    display: none !important;
}

/* =========================================
   6. ПРЕМИУМ-КНОПКИ ВНИЗУ
   ========================================= */
.bottom-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    align-items: center;
    z-index: 50;
    width: auto;
    background: transparent;
    border: none;
    padding: 0;
}

#action-controls {
    display: none;
}

button#door-toggle-btn,
.order-btn {
    height: 50px;
    padding: 0 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

button#door-toggle-btn {
    background: rgba(30, 30, 30, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    gap: 15px;
}

button#door-toggle-btn:hover {
    background: rgba(50, 50, 50, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
}

button#door-toggle-btn.active {
    border-color: #e63946;
    box-shadow: 0 0 0 1px #e63946, 0 5px 15px rgba(0, 0, 0, 0.5);
}

#door-toggle-btn .icon-box svg {
    width: 14px;
    height: 14px;
    stroke: #aaa;
    stroke-width: 3px;
    transition: 0.4s ease;
}

button#door-toggle-btn.active .icon-box svg {
    transform: rotate(180deg);
    stroke: #e63946;
}

#door-toggle-btn .status-light {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #444;
}

button#door-toggle-btn.active .status-light {
    background-color: #e63946;
    box-shadow: 0 0 8px #e63946;
}

.order-btn {
    background: var(--accent-color);
    color: #fff;
    border: none;
}

.order-btn:hover {
    background: #e03e3e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(197, 47, 47, 0.5);
}

.config-summary {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 20;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #444;
    border-radius: 12px;
    padding: 15px 25px;
    backdrop-filter: blur(10px);
    text-align: center;
    width: 300px;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.config-summary.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.summary-title {
    font-size: 10px;
    color: var(--accent-color);
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.summary-text {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

/* =========================================
   7. ДЕТАЛЬНОЕ ОПИСАНИЕ И ГАЛЕРЕЯ
   ========================================= */
.details-section {
    background: #0a0a0a;
    border-top: 1px solid #333;
    padding: 80px 20px;
    color: #fff;
}

.details-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 60px;
    align-items: center;
}

.details-info h2 {
    font-size: 32px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 20px;
}

.detail-desc {
    font-size: 16px;
    line-height: 1.8;
    color: #ccc;
    margin-bottom: 30px;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.feature-list li {
    font-size: 14px;
    color: #eee;
    display: flex;
    align-items: center;
    gap: 10px;
}

.feature-list li::before {
    content: "✔";
    color: var(--accent-color);
    font-weight: bold;
}

.details-gallery-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.slider-viewport {
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid #333;
    background: #1a1a1a;
    position: relative;
}

.slider-track {
    display: flex;
    height: 100%;
    transition: transform 0.4s ease-in-out;
}

.gallery-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-weight: bold;
}

.slider-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid #444;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    z-index: 5;
    flex-shrink: 0;
}

.slider-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

/* =========================================
   8. УТИЛИТЫ (TOOLTIP, LIGHTBOX)
   ========================================= */
#global-tooltip {
    position: fixed;
    z-index: 9999;
    background: #111;
    border: 1px solid #444;
    color: #ccc;
    width: 220px;
    padding: 15px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s;
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.lightbox.open {
    display: flex;
    opacity: 1;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.lightbox-close:hover {
    color: var(--accent-color);
}

/* =========================================
   9. ИДЕАЛЬНАЯ АДАПТИВНОСТЬ (МОБИЛЬНАЯ ВЕРСИЯ С ВКЛАДКАМИ)
   ========================================= */
@media (max-width: 900px) {
    .configurator-container {
        display: flex; flex-direction: column; height: auto !important; min-height: 100vh;
        padding-top: 80px; margin-top: 0; overflow-x: hidden;
    }
    
    .viewer-container { order: 1; height: 50vh; min-height: 380px; width: 100%; position: relative; }
    
    /* 1. ПРЯЧЕМ ПЛАШКУ READY НА МОБИЛЬНЫХ (чтобы не перекрывала машину) */
    .config-summary { display: none !important; }

    /* 2. КОМПАКТНЫЕ МАТЕРИАЛЫ СВЕРХУ */
    .top-controls { top: 10px; width: 100%; }
    .top-label { font-size: 10px; margin-bottom: 5px; }
    .materials-row { gap: 8px; }
    .material-pill { padding: 6px 12px; font-size: 11px; border-radius: 20px; }
    .info-icon { width: 14px; height: 14px; }
    .info-icon svg { width: 8px; height: 8px; }

    /* 3. КНОПКИ ORDER И DOORS */
    .bottom-controls { 
        width: 92% !important; 
        bottom: 10px !important; /* Прижимаем к низу */
        flex-direction: row !important; 
        gap: 10px !important; 
    }
    .order-btn, button#door-toggle-btn { 
        flex: 1 !important; 
        width: 100% !important; 
        height: 45px !important; 
        font-size: 12px !important;
        margin: 0 !important; 
        padding: 0 !important; 
    }
    #action-controls { flex: 1 !important; margin: 0 !important; display: block; }

    /* Вкладки */
    .mobile-tabs-container {
        display: flex; order: 2; width: 100%; padding: 15px; box-sizing: border-box;
        gap: 10px; background: #0a0a0a; border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.05); z-index: 10;
    }
    .mobile-tab {
        flex: 1; padding: 12px 0; background: rgba(255, 255, 255, 0.05); border: 1px solid #333;
        color: #888; border-radius: 8px; font-weight: 800; font-size: 12px;
        text-transform: uppercase; letter-spacing: 1px; cursor: pointer;
    }
    .mobile-tab.active { background: var(--accent-color); color: #fff; border-color: var(--accent-color); }

    /* Боковые панели */
    .sidebar { display: none !important; order: 3; width: 100%; padding: 15px; box-sizing: border-box; animation: slideUpFade 0.3s ease forwards; }
    .sidebar.active-panel { display: block !important; }
    .panel-box h2 { display: none !important; }

    .sidebar#panel-model .scrollable-list { display: block !important; max-height: 40vh; overflow-y: auto; width: 100%; }
    .option-btn { margin: 0 0 10px 0 !important; }

    .sidebar#panel-canopy .scrollable-list { display: flex !important; flex-direction: row !important; gap: 10px !important; width: 100% !important; overflow-x: auto; }
    .canopy-option { flex: 1 !important; flex-direction: column !important; align-items: center !important; text-align: center !important; padding: 12px 5px !important; margin: 0 !important; border-radius: 8px !important; min-width: 90px; }
    .c-desc { display: none !important; }
    
    .details-container { grid-template-columns: 1fr !important; gap: 30px !important; }
    .details-info h2 { font-size: 26px; }
    .details-gallery-wrapper { width: 100% !important; }
    .slider-viewport { height: 250px !important; width: 100% !important; }
}

@media (max-width: 600px) {
    .header-flex { padding: 0 15px; flex-direction: column-reverse; gap: 15px; justify-content: center; }
    .gulf-back-btn .text { display: none; }
    .gulf-back-btn { padding: 10px 20px; }
    .logo-text-aggresive { font-size: 22px; }
}

@keyframes slideUpFade { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   10. ЛОАДЕР
   ========================================= */
#loader-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 100; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: 0.3s; }
#loader-overlay.visible { opacity: 1; visibility: visible; }
.spinner { width: 50px; height: 50px; border: 3px solid rgba(255,255,255,0.1); border-radius: 50%; border-top-color: var(--accent-color); animation: spin 1s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }