:root {
    --primary: #1a3a5f; 
    --accent: #ce1212;  
    --light: #f4f7f6;
    --dark: #222;
    --white: #ffffff;
}

body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; color: #333; line-height: 1.6; overflow-x: hidden; }

/* ШАПКА */
header { 
    background: var(--primary); 
    padding: 0 5%; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: sticky; 
    top: 0; 
    z-index: 1000; 
    height: 80px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.logo img { height: 50px; width: auto; display: block; }

/* НАВІГАЦІЯ ТА МОВИ */
.nav-container { display: flex; align-items: center; height: 100%; }
nav { height: 100%; }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; height: 100%; }
nav li { position: relative; height: 100%; }
nav > ul > li > a { 
    color: white; text-decoration: none; padding: 0 15px; font-weight: 500; font-size: 0.85rem;
    display: flex; align-items: center; height: 100%; transition: 0.3s; text-transform: uppercase;
    white-space: nowrap;
}
nav > ul > li > a:hover { background: rgba(255,255,255,0.1); }

/* ПЕРЕМИКАЧ МОВ */
.lang-switcher { margin-left: 20px; color: white; font-size: 0.8rem; font-weight: bold; white-space: nowrap;}
.lang-switcher a { color: rgba(255,255,255,0.6); text-decoration: none; transition: 0.3s; }
.lang-switcher a.active { color: white; border-bottom: 2px solid var(--accent); }
.lang-switcher a:hover { color: white; }

/* DROPDOWN */
.dropdown { 
    display: none; position: absolute; background: white; box-shadow: 0 5px 15px rgba(0,0,0,0.2); 
    min-width: 280px; top: 100%; left: 0; border-top: 3px solid var(--accent); padding: 10px 0;
}
nav li:hover .dropdown { display: block; }
.dropdown a { 
    display: block; color: var(--primary); padding: 12px 20px; text-decoration: none; 
    font-size: 0.85rem; border-bottom: 1px solid #f0f0f0; line-height: 1.4;
}
.dropdown a:hover { background: #f8f8f8; color: var(--accent); }

/* БУРГЕР */
.menu-toggle { display: none; flex-direction: column; cursor: pointer; gap: 5px; margin-left: 15px; }
.menu-toggle span { display: block; width: 25px; height: 3px; background: white; }

/* ГЕРОЙ-БЛОК */
.hero { 
    background: linear-gradient(rgba(26,58,95,0.75), rgba(26,58,95,0.75)), url('bg.jpg'); 
    background-size: cover; background-position: center; height: 65vh; 
    display: flex; flex-direction: column; justify-content: center; align-items: center; 
    color: white; text-align: center; padding: 0 20px; 
}
.hero h1 { font-size: 3rem; margin-bottom: 15px; font-weight: 800; }
.hero p { font-size: 1.1rem; max-width: 700px; margin-bottom: 30px; }
.cta-group { display: flex; gap: 15px; }
.btn { padding: 14px 25px; text-decoration: none; border-radius: 4px; font-weight: bold; text-transform: uppercase; transition: 0.3s; font-size: 0.8rem; }
.btn-red { background: var(--accent); color: white; }
.btn-outline { border: 2px solid white; color: white; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.3); }

/* СЕКЦІЇ КОНТЕНТУ */
section { padding: 80px 10%; }
.section-title { text-align: center; color: var(--primary); margin-bottom: 40px; font-size: 2rem; }

.about-text { max-width: 900px; margin: 0 auto; text-align: center; font-size: 1.1rem; color: #555; }

.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-top: 20px; }
.service-card { background: var(--light); padding: 40px 30px; border-radius: 8px; border-bottom: 4px solid var(--primary); transition: 0.3s; }
.service-card:hover { transform: translateY(-10px); background: white; box-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.service-card h3 { color: var(--primary); margin-bottom: 15px; }

.features { background: #fff; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; text-align: center; }
.feature-box i { font-size: 3rem; color: var(--accent); margin-bottom: 20px; display: block; font-style: normal; }
.feature-box h4 { margin-bottom: 10px; color: var(--primary); }

/* ФУТЕР */
footer { background: var(--dark); color: #aaa; padding: 40px 10% 20px; text-align: center; border-top: 4px solid var(--accent); }
.footer-copy { font-size: 0.85rem; margin-top: 20px; border-top: 1px solid #333; padding-top: 20px; }

/* МОБІЛЬНА ВЕРСІЯ */
@media (max-width: 1280px) and (min-width: 1025px) {
    nav > ul > li > a { padding: 0 9px; font-size: 0.78rem; }
    .lang-switcher { margin-left: 10px; }
}

@media (max-width: 1024px) {
    .menu-toggle { display: flex; }
    
    /* ЗМІНА: Замість 'nav' використовуємо '#nav-menu' для головного меню */
    #nav-menu {
        display: none; position: absolute; top: 80px; left: 0; width: 100%;
        background: var(--primary); height: auto; max-height: 80vh; overflow-y: auto;
    }
    #nav-menu.active { display: block; }
    #nav-menu ul { flex-direction: column; height: auto; padding: 20px 0; }
    #nav-menu li { height: auto; }
    #nav-menu > ul > li > a { padding: 15px 5%; border-bottom: 1px solid rgba(255,255,255,0.05); }
    
    .dropdown { position: static; display: block; background: rgba(0,0,0,0.2); box-shadow: none; border: none; padding: 0; }
    .dropdown a { color: white; padding-left: 10%; }
    .hero h1 { font-size: 2rem; }
    .cta-group { flex-direction: column; width: 100%; }
}

/* ВНУТРІШНЯ НАВІГАЦІЯ (laboratory, certification, rd, documents) */
@media (max-width: 1024px) {
    .inner-nav {
        position: sticky;
        top: 80px;
        z-index: 900;
        overflow: hidden;
        background: #f4f7f6; /* Додано для стабільного фону */
    }
    .inner-nav ul {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: safe center;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 0;
        max-width: none;
    }
    .inner-nav ul::-webkit-scrollbar { display: none; }
    .inner-nav ul li { flex-shrink: 0; }
    .inner-nav ul li a {
        white-space: nowrap;
        padding: 12px 16px;
        font-size: 0.78rem;
    }
    .inner-nav::before,
    .inner-nav::after {
        content: '';
        position: absolute;
        top: 0; bottom: 0;
        width: 28px;
        z-index: 2;
        pointer-events: none;
    }
    .inner-nav::before {
        left: 0;
        background: linear-gradient(to right, #f4f7f6, transparent);
    }
    .inner-nav::after {
        right: 0;
        background: linear-gradient(to left, #f4f7f6, transparent);
    }
}