/* === RE:USE ECO STYLE (FINAL MOBILE FIX) === */

:root {
    --reuse-green: #27ae60;
    --reuse-green-dark: #1e8449;
    --reuse-bg: #f8fdf9;
}

body {
    background-color: var(--reuse-bg);
    color: #333;
    font-family: 'Open Sans', sans-serif;
}

/* --- ВЕРХНЯ СМУГА --- */
#top {
    background-color: #fff;
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    min-height: 60px;
}
#logo img {
    max-height: 50px;
}

/* --- ГОЛОВНА ПАНЕЛЬ --- */
#main-header {
    background-color: var(--reuse-green);
    padding: 15px 0;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
    z-index: 100;
}

/* Flexbox контейнер */
.header-panel {
    display: flex;
    align-items: center;
    justify-content: center;     /* центруємо весь ряд */
    gap: 20px;
    flex-wrap: nowrap;
}

/* --- 1. МЕНЮ (КНОПКА) --- */
.header-menu {
    flex: 0 0 auto;
}

#menu {
    margin: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
    background: transparent !important;
    border: none !important;
}

/* Стиль кнопки */
#menu .navbar-header {
    background-color: #fff !important;
    color: var(--reuse-green) !important;
    padding: 0 20px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    height: 42px !important; /* Жорстка висота */
    border: 1px solid transparent;
}

/* Фікс тексту всередині кнопки */
#menu .navbar-header span,
#menu .navbar-header i {
    color: var(--reuse-green) !important; /* Завжди зелений */
}

#menu .navbar-toggle {
    display: none !important;
}

/* --- ВИПАДАЮЧЕ МЕНЮ (MEGA MENU) --- */
#menu .navbar-collapse {
    padding: 0;
    background: #fff !important;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 9999;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 900px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.2);
    display: none !important;
    margin-top: 5px;
    border-top: 3px solid var(--reuse-green) !important;
}

/* Показувати при наведенні (тільки на ПК) */
@media (min-width: 768px) {
    #menu:hover .navbar-collapse {
        display: block !important;
    }
}

/* Сітка меню */
.reuse-megamenu {
    display: table;
    width: 100%;
    table-layout: fixed;
    padding: 0;
}

.reuse-mega-col {
    display: table-cell;
    vertical-align: top;
    width: 25%;
    padding: 20px;
    border-right: 1px solid #eee;
}
.reuse-mega-col:last-child {
    border-right: none;
}

/* Іконки */
.reuse-menu-icon,
.reuse-mega-col-title img {
    width: 24px !important;
    height: 24px !important;
    margin-right: 10px !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

/* Заголовки */
.reuse-mega-col-title {
    font-weight: 800;
    color: #333;
    font-size: 13px;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--reuse-green);
    padding-bottom: 8px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
}
.reuse-mega-col-title .title-link {
    color: #333 !important;
    text-decoration: none !important;
}

.reuse-mega-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.reuse-mega-col ul li {
    margin-bottom: 8px;
}
.reuse-mega-col ul li a {
    color: #555;
    display: block;
    font-size: 13px;
    text-decoration: none;
}
.reuse-mega-col ul li a:hover {
    color: var(--reuse-green);
    padding-left: 5px;
    transition: 0.2s;
}

/* --- 2. ПОШУК --- */
.header-search {
    flex: 0 1 500px;    /* центр – керована ширина */
    max-width: 600px;
    min-width: 260px;
}

#search {
    display: flex;
    width: 100%;
    align-items: center !important;
    height: 42px;
}

#search .form-control {
    height: 42px !important;
    border: none;
    border-radius: 4px 0 0 4px;
    padding-left: 15px;
    margin: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
}

#search .btn-lg {
    height: 42px !important;
    background-color: #fff !important;
    color: var(--reuse-green) !important;
    border: none;
    border-left: 1px solid #eee;
    border-radius: 0 4px 4px 0;
    padding: 0 20px;
    margin: 0 !important;
    line-height: 42px !important;
}
#search .btn-lg:hover {
    background-color: #f9f9f9 !important;
}

/* --- 3. КОШИК --- */
.header-cart {
    flex: 0 0 auto;
}

#cart > .btn {
    height: 42px !important;
    background-color: #fff !important;
    color: var(--reuse-green) !important;
    border: none;
    border-radius: 4px;
    font-weight: 700;
    display: flex;
    align-items: center;
    padding: 0 15px;
    white-space: nowrap;
}
#cart.open > .btn {
    color: #333;
    background: #f0f0f0 !important;
}

/* === АДАПТИВНІСТЬ (ПЛАНШЕТ) === */
@media (max-width: 991px) {
    #menu .navbar-header,
    #cart > .btn {
        font-size: 12px;
        padding: 0 10px !important;
    }
    .header-panel {
        gap: 8px;
    }

    /* ширина меню */
    #menu .navbar-collapse {
        width: 100vw;
        max-width: 750px;
        left: 0;
        right: 0;
        margin-left: auto;
        margin-right: auto;
    }
}

/* === АДАПТИВНІСТЬ (МОБІЛЬНА ВЕРСІЯ) === */
@media (max-width: 767px) {
    /* Перебудова в стовпчик */
    .header-panel {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Пошук переносимо вниз на всю ширину */
    .header-search {
        order: 3;
        width: 100%;
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Кнопка Каталог і Кошик в один ряд зверху */
    .header-menu {
        order: 1;
        flex: 1;
    }
    .header-cart {
        order: 2;
        flex: 0 0 auto;
    }

    /* Кнопка Каталог розтягується */
    #menu .navbar-header {
        width: 100% !important;
        justify-content: center;
    }

    /* Випадаюче меню – на всю ширину */
    #menu .navbar-collapse {
        width: 100vw;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 0;
        padding: 0;
        margin-top: 0;
        box-shadow: none;
    }

    /* Вертикальне меню (1 колонка) */
    .reuse-megamenu {
        display: block;
        padding: 0;
    }
    .reuse-mega-col {
        display: block;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
        padding: 15px 10px;
    }

    /* Відкриття каталогу по класу is-open (скрипт у header.twig) */
    #menu.is-open .navbar-collapse {
        display: block !important;
    }
}
