/* Базовый сброс стилей и темный фон */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background-color: #0b0f19; color: #d1d5db; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
.terminal-text { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

/* Сетка и контейнеры */
.container { max-width: 1152px; width: 100%; margin: 0 auto; padding: 48px 16px; }
.flex-row-custom { display: flex; flex-direction: column; gap: 24px; }
@media (min-width: 768px) { .flex-row-custom { flex-direction: row; justify-content: space-between; align-items: flex-start; } }

/* Стили текста */
h1 { font-size: 2.25rem; font-weight: 700; color: #ffffff; letter-spacing: -0.025em; margin-bottom: 8px; }
.subtitle { font-size: 1.125rem; font-weight: 500; color: #10b981; margin-bottom: 16px; }
.desc { color: #9ca3af; line-height: 1.625; max-width: 42rem; }

/* Кнопки */
.btn-group { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.btn-sec { padding: 8px 16px; border-radius: 4px; background-color: #1f2937; border: 1px solid #374151; color: #e5e7eb; font-size: 0.875rem; font-weight: 500; text-decoration: none; transition: background-color 0.2s; }
.btn-sec:hover { background-color: #374151; color: #ffffff; }
.btn-prim { padding: 8px 16px; border-radius: 4px; background-color: #059669; color: #ffffff; font-size: 0.875rem; font-weight: 500; text-decoration: none; transition: background-color 0.2s; }
.btn-prim:hover { background-color: #10b981; }

/* Виджет пульса */
.pulse-widget { background-color: rgba(17, 24, 39, 0.5); border: 1px solid #1f2937; border-radius: 8px; padding: 20px; width: 100%; }
@media (min-width: 768px) { .pulse-widget { width: 288px; } }
.pulse-header { display: flex; justify-content: space-between; align-items: center; color: #6b7280; font-size: 0.75rem; margin-bottom: 12px; }
.pulse-dot { width: 8px; height: 8px; background-color: #10b981; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px #10b981; }
.pulse-metrics p { font-size: 0.75rem; color: #9ca3af; margin-bottom: 4px; }
.pulse-val { color: #10b981; }

/* Сетка проектов */
.main-grid { display: grid; grid-template-columns: 1fr; gap: 24px; margin-top: 24px; }
@media (min-width: 1024px) { .main-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); } }

/* Вкладки */
.tabs-nav { display: flex; overflow-x: auto; gap: 8px; padding-bottom: 16px; -webkit-overflow-scrolling: touch; }
@media (min-width: 1024px) { .tabs-nav { grid-column: span 4 / span 4; flex-direction: column; overflow-x: visible; padding-bottom: 0; } }

/* ИСПРАВЛЕНО: Безопасный перенос длинных b2b названий проектов и гибкая мобильная адаптация */
.tab-btn { 
    width: 100%; 
    text-align: left; 
    padding: 12px 16px; 
    border-radius: 8px; 
    font-size: 0.875rem; 
    font-weight: 500; 
    background-color: rgba(31, 41, 55, 0.2); 
    border: 1px solid rgba(55, 65, 81, 0.5); 
    color: #9ca3af; 
    cursor: pointer; 
    transition: all 0.2s; 
    
    /* Главный фикс: разрешаем перенос слов и убираем жесткий nowrap */
    white-space: normal !important; 
    line-height: 1.35 !important;
    word-wrap: break-word;
    display: flex;
    align-items: center;
}
.tab-btn:hover { background-color: rgba(55, 65, 81, 0.5); color: #f3f4f6; }
.active-tab { background-color: rgba(16, 185, 129, 0.1) !important; border-color: rgba(16, 185, 129, 0.4) !important; color: #10b981 !important; }

/* Дополнительный фикс табов для экранов мобильных телефонов и планшетов */
/* ТАБЛИЦА СТИЛЕЙ ДЛЯ МОБИЛЬНЫХ И УЗКИХ ЭКРАНОВ (ПЛАНШЕТЫ/СМАРТФОНЫ) */
@media (max-width: 1023px) {
    .tabs-nav {
        display: flex !important; /* Явно включаем flex-контекст на мобильных */
        flex-direction: column !important; /* Выстраиваем b2b-табы ровной вертикальной стопкой */
        width: 100% !important;
        overflow-x: visible !important;
        gap: 8px !important; /* Добавляем аккуратный зазор между кнопками */
    }
    .tab-btn {
        width: 100% !important;
        padding: 14px 16px !important; /* Увеличиваем зону нажатия под палец */
        font-size: 0.9rem !important; /* Опрятный читаемый размер */
        position: relative !important;
        display: flex !important;
        justify-content: space-between !important; /* Разносим текст проекта и стрелочку по краям */
        align-items: center !important;
    }
    /* Безопасное отображение стрелочки "вправо" через валидный экранированный Unicode-код (\2192) */
    .tab-btn::after {
        content: "\2192" !important;
        font-size: 1rem !important;
        color: #4b5563 !important;
        font-weight: bold !important;
        transition: transform 0.2s ease;
        display: inline-block !important;
    }
    /* На активной кнопке (проверяем оба класса) стрелочка меняется на "вниз" (\2193) и подсвечивается зеленым */
    .active-tab::after, .tab-btn.active-tab::after {
        content: "\2193" !important;
        color: #10b981 !important;
        transform: scale(1.2) !important;
    }
}

/* Окно терминала */
.terminal-window { background-color: #020617; border: 1px solid #1f2937; border-radius: 12px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5); }
@media (min-width: 1024px) { .terminal-window { grid-column: span 8 / span 8; } }
.terminal-header { background-color: #111827; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #1f2937; user-select: none; }
.dots { display: flex; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; }
.t-title { font-size: 0.75rem; color: #6b7280; }
.terminal-body { padding: 24px; min-height: 400px; font-size: 0.875rem; overflow-x: hidden; }

/* Внутренние блоки интерактива */
.interactive-box { margin-top: 24px; background-color: rgba(17, 24, 39, 0.5); border: 1px solid #1f2937; border-radius: 4px; padding: 16px; }
.int-title { font-size: 0.75rem; color: #10b981; font-weight: 600; margin-bottom: 12px; }
.interactive-box button { background-color: #059669; color: white; padding: 6px 12px; border-radius: 4px; font-size: 0.75rem; border: none; cursor: pointer; font-weight: 500; transition: background 0.2s; margin-top: 12px;}
.interactive-box button:hover { background-color: #10b981; }
.slider-container { display: flex; align-items: center; gap: 16px; font-size: 0.75rem; color: #9ca3af; }
.slider-container input { width: 100%; accent-color: #10b981; }

/* Адаптивная сетка для песочниц (1 колонка на мобильных, 2 на десктопе) */
.sandbox-grid { grid-template-columns: 1fr; }
@media (min-width: 1024px) { 
    .sandbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } 
}

/* Единый горизонтальный ряд для кнопок проекта */
.project-actions-cluster {
    display: flex;
    flex-direction: row;
    gap: 16px;          /* Зазор между кнопками */
    align-items: center;
    justify-content: flex-start;
    width: auto;
}

/* ШАССИ-СТИЛЬ НЕОНОВОЙ КНОПКИ (Подогнан под высоту твоей кнопки 34px) */
.chassis-btn-neon-gate {
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    height: 34px;       /* Идеальная высота встык с твоей кнопкой */
    box-sizing: border-box;
    background: rgba(16, 24, 40, 0.75); 
    border: 1px solid var(--neon-border, rgba(59, 130, 246, 0.4)); 
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem; /* Размер шрифта один в один с твоей кнопкой */
    font-weight: bold;
    color: #e2e8f0;
    text-decoration: none;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(6px);
    box-shadow: 0 0 12px var(--neon-glow, rgba(59, 130, 246, 0.1));
    animation: chassisGateGlow 4s infinite ease-in-out;
    white-space: nowrap;
}

.chassis-gate-icon {
    margin-right: 8px;
    font-size: 14px;
    display: inline-block;
    vertical-align: middle;
}

/* Пульсирующий статус-индикатор активности */
.chassis-gate-pulse {
    width: 5px;
    height: 5px;
    background-color: var(--pulse-color, #3b82f6);
    border-radius: 50%;
    margin-left: 10px;
    box-shadow: 0 0 6px var(--pulse-color, #3b82f6), 0 0 12px var(--pulse-color, #3b82f6);
    animation: chassisGateBlink 1.4s infinite ease-in-out;
}

/* ХОВЕР-ЭФФЕКТ: Мягкое наливание неоном */
.chassis-btn-neon-gate:hover {
    border-color: var(--neon-border-hover, rgba(59, 130, 246, 1));
    color: #fff;
    box-shadow: 0 0 20px var(--neon-glow-hover, rgba(59, 130, 246, 0.4)), inset 0 0 8px var(--neon-glow-hover, rgba(59, 130, 246, 0.2));
    transform: translateY(-1px);
    cursor: pointer;
}

/* 🔵 ПЕРЕОПРЕДЕЛЕНИЕ ЦВЕТА: ЛАЗУРНО-СИНИЙ НЕОН (В цвет кнопки песочницы #3b82f6!) */
.webrtc-btn-glow {
    --neon-border: rgba(59, 130, 246, 0.35);
    --neon-border-hover: rgba(59, 130, 246, 1);
    --neon-glow: rgba(59, 130, 246, 0.1);
    --neon-glow-hover: rgba(59, 130, 246, 0.35);
    --pulse-color: #3b82f6;
}

/* Анимации дыхания */
@keyframes chassisGateGlow {
    0%, 100% { opacity: 0.9; }
    50% { border-color: var(--neon-border-hover); }
}
@keyframes chassisGateBlink {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Мобильный стек */
@media (max-width: 768px) {
    .project-actions-cluster {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .chassis-btn-neon-gate {
        justify-content: center;
        width: 100%;
    }
}
