/* ==========================================================================
   БАЗОВЫЕ И СИСТЕМНЫЕ СТИЛИ (ОБЩИЕ ДЛЯ ВСЕХ УСТРОЙСТВ)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Roboto, sans-serif;
}
body {
    background-color: #0f172a;
    color: #f8fafc;
    padding-bottom: 0px; 
    line-height: 1.6;
    overflow-x: hidden; 
}

/* ==========================================================================
   ВЕРХНЯЯ НАВИГАЦИОННАЯ ПАНЕЛЬ (КОМПАКТНАЯ ВЕРСИЯ)
   ========================================================================== */
.top-nav {
    background-color: #1e293b;
    border-bottom: 1px solid #334155;
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0px 20px;
    height: 60px; 
}
.nav-logo-box {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}
.nav-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}
.nav-menu {
    display: flex;
    gap: 6px; 
    list-style: none;
    align-items: center;
    margin: 0;
    padding: 0;
    flex: 1;
    justify-content: center; 
}
.nav-link { 
    color: #cbd5e1; 
    text-decoration: none; 
    font-size: 0.88rem; 
    font-weight: 600; 
    padding: 6px 10px; 
    border-radius: 6px;
    transition: all 0.2s ease; 
    cursor: pointer;
    white-space: nowrap; 
}
.nav-link.active {
    color: #fff;
    background-color: #3b82f6;
}
.nav-link:hover:not(.active) {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}
.nav-btn {
    background-color: transparent;
    border: 1px solid #3b82f6;
    color: #3b82f6;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.2s ease;
    flex-shrink: 0;
    white-space: nowrap;
}
.nav-btn:hover {
    background-color: #3b82f6;
    color: #fff;
}

/* ==========================================================================
   КОНТЕЙНЕРЫ И ЛОГИКА ВКЛАДОК (TABS)
   ========================================================================== */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
.container {
    max-width: 1200px;
    margin: 30px auto 0 auto;
    padding: 0 20px;
}
.section-title {
    margin-bottom: 25px;
    font-size: 1.5rem;
    border-left: 4px solid #3b82f6;
    padding-left: 15px;
    color: #fff;
    font-weight: 700;
    text-align: left;
}

/* ==========================================================================
   СЕТКА КАРТОЧЕК (ПОРТФОЛИО, ГОТОВЫЕ ПРОЕКТЫ, ОБОРУДОВАНИЕ)
   ========================================================================== */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 25px;
    margin-bottom: 50px;
    align-items: stretch;
}
.card {
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: pointer; 
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    contain: paint;
}
.card:hover {
    transform: translateY(-4px); 
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    border-color: #3b82f6; 
}
.slider-container {
    position: relative;
    width: 100%;
    height: 220px;
    background-color: #0f172a;
    overflow: hidden !important; 
    flex-shrink: 0;
}
.slider-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block; 
}
.card-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden !important;
    max-height: 160px;
}
.card-title {
    font-size: 1.15rem;
    color: #3b82f6;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    
    /* Новые свойства для аккуратного обрезания текста (максимум 2 строки) */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;
    
    /* Защищаем отступ !important, так как ниже есть правило, которое его сбрасывает */
    margin-bottom: 12px !important; 
}
.card-description {
    color: #cbd5e1;
    font-size: 0.9rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3; 
    -webkit-box-orient: vertical;
    overflow: hidden !important; 
    text-overflow: ellipsis;
    max-height: 4.8em; 
    flex-grow: 1;
    text-align: left;
}

/* Максимальное подавление внутренних скроллбаров на плитках-карточках */
.grid, .grid *, .card, .card *, .card-content, .card-description {
    overflow: hidden !important;
    overflow-y: hidden !important;
    overflow-x: hidden !important;
    -ms-overflow-style: none !important;  
    scrollbar-width: none !important;  
    margin-bottom: 0;
    padding-bottom: 0;
}
.grid *::-webkit-scrollbar, .card *::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

/* ==========================================================================
   КОММЕРЧЕСКИЕ СПЕЦИФИКАЦИИ И КАЛЬКУЛЯТОР СМЕТ
   ========================================================================== */
.price-section-card {
    background-color: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-bottom: 25px;
}
.calc-separator {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.95rem;
    margin: 20px 0 10px 0;
    border-left: 3px solid #3b82f6;
    text-align: left;
}
.calc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f172a;
    padding: 14px 20px;
    border-radius: 6px;
    border: 1px solid #23315a;
    margin-bottom: 8px;
    gap: 20px;
}
.qty-input {
    width: 70px;
    padding: 8px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #fff;
    border-radius: 4px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}
.total-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #334155;
    gap: 15px;
}

/* ==========================================
   ФОРМЫ ОБРАТНОЙ СВЯЗИ И ИНПУТЫ
   ========================================== */
.form-section, .order-form {
    background-color: #1e293b;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #334155;
}
.form-group { margin-bottom: 18px; }
label { display: block; margin-bottom: 6px; color: #cbd5e1; font-size: 0.9rem; }
input[type="text"], input[type="number"], textarea {
    width: 100%; padding: 11px; background-color: #0f172a; border: 1px solid #334155;
    color: #fff; border-radius: 6px; font-size: 0.95rem;
}
input:focus, textarea:focus { border-color: #3b82f6; outline: none; }
.captcha-box {
    background-color: #0f172a; padding: 15px; border-radius: 6px; margin-bottom: 15px;
    border-left: 4px solid #3b82f6;
}
.btn {
    background-color: #3b82f6; color: white; padding: 12px 20px;
    border: none; border-radius: 6px; cursor: pointer; font-size: 1rem; font-weight: 600;
    transition: background 0.2s;
}
.btn:hover { background-color: #2563eb; }
.btn-pdf {
    background: #10b981;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}
.btn-pdf:hover { background: #059669; }
.alert { padding: 12px; margin-bottom: 20px; border-radius: 6px; font-weight: 500; font-size: 0.95rem; text-align: center; }

/* ==========================================================================
   МЕДИА-ЗАПРОСЫ ДЛЯ СМАРТФОНОВ И ПЛАНШЕТОВ (МОБИЛЬНАЯ АДАПТАЦИЯ)
   ========================================================================= */
@media (max-width: 1024px) {
    .nav-menu {
        gap: 2px;
    }
    .nav-link {
        padding: 6px 8px;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .nav-container { 
        height: auto; 
        padding: 15px 20px; 
        flex-direction: column; 
        gap: 15px; 
    }
    .nav-logo-box {
        width: 100%;
        justify-content: center;
    }
    .nav-menu { 
        flex-wrap: wrap; 
        justify-content: center; 
        gap: 6px; 
        width: 100%;
    }
    .nav-link { 
        padding: 8px 12px; 
        font-size: 0.85rem; 
        background-color: rgba(255, 255, 255, 0.02);
        border: 1px solid rgba(255, 255, 255, 0.05);
    }
    .nav-btn {
        width: 100%;
        text-align: center;
        padding: 10px;
    }
    .container { 
        padding: 0 12px;
    }
    .section-title {
        font-size: 1.3rem;
        margin-bottom: 20px;
    }
    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .slider-container {
        height: 180px; 
    }
    .card-content {
        padding: 15px;
    }
    .calc-row {
        flex-direction: column; 
        align-items: stretch;
        gap: 12px;
        padding: 15px;
    }
    .calc-row > div:first-child {
        text-align: left;
    }
    .calc-row > div:last-child {
        display: flex;
        justify-content: flex-end; 
    }
    .qty-input {
        width: 100%; 
        max-width: 100px;
        padding: 10px;
    }
    .total-box {
        flex-direction: column; 
        align-items: stretch;
        text-align: center;
        gap: 15px;
    }
    .total-box > div {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
    }
    .btn-pdf {
        width: 100%;
        padding: 12px;
        text-align: center;
    }
    .form-section, .order-form {
        padding: 20px 15px;
    }
    #projectModal {
        padding: 10px;
    }
    #projectModal > div {
        max-height: 95vh;
        display: flex;
        flex-direction: column;
    }
    #projectModal div[style*="height: 380px"] {
        height: 240px !important; 
    }
    #projectModal button[id*="Btn"] {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

@media (max-width: 360px) {
    .nav-link {
        font-size: 0.8rem;
        padding: 6px 8px;
    }
    .calc-separator {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
}