/* ========================================================
   1. БАЗОВІ ЗМІННІ ТА СТИЛІ ОФОРМЛЕННЯ (ХАКІ / ПРИРОДА)
   ======================================================== */
:root {
    --bg-dark: #1b1e19;       /* Глибокий темно-оливковий */
    --bg-panel: #262b23;      /* Темний хакі під панелі */
    --accent-khaki: #6b7a58;  /* Натуральний хакі */
    --accent-light: #9fb380;  /* Світлий мох / лайт-хакі */
    --text-main: #e2e5db;     /* М'який світло-сірий пісок */
    --text-muted: #9ba393;    /* Приглушений колір полину */
    --border-color: #3b4236;  /* Бордери кольору кори */
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Segoe UI', sans-serif; 
}

/* Захист від будь-яких горизонтальних зміщень екрана */
html, body { 
    background: var(--bg-dark); 
    color: var(--text-main); 
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ========================================================
   2. ВЕРХНЯ ПАНЕЛЬ (HEADER / TOPBAR)
   ======================================================== */
.topbar {
    height: 52px;
    background: var(--bg-panel);
    border-bottom: 2px solid var(--accent-khaki);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo a { 
    font-weight: bold; 
    color: var(--accent-light); 
    text-decoration: none; 
    font-size: 1.2rem; 
}

/* За замовчуванням (ПК): показуємо повну назву, ховаємо іконку */
.logo-short { display: none; }
.logo-full { display: inline; }


.top-nav { 
    display: flex; 
    gap: 0.5rem; 
}

/* Кнопки та посилання у верхній панелі */
.top-nav .nav-btn, 
.top-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1.2;
    transition: 0.2s;
}

.top-nav .nav-btn.active, 
.top-nav .nav-btn:hover, 
.top-actions button:hover {
    background: var(--accent-khaki);
    color: #fff;
    text-decoration: none;
}

.top-actions { 
    margin-left: auto; 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
}

.lang-switch a { 
    color: var(--text-muted); 
    text-decoration: none; 
    font-weight: bold; 
    font-size: 0.85rem; 
}
.lang-switch a.active { color: var(--accent-light); }

/* ========================================================
   3. КАРКАС СТОРІНКИ ТА САЙДБАР (БАЗА ДЛЯ ПК)
   ======================================================== */
.layout-container { 
    display: flex; 
    min-height: calc(100vh - 52px); 
    width: 100%;
}

.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    position: sticky;
    top: 52px;
    height: calc(100vh - 52px);
    overflow-y: auto;
}

.sidebar-panel { display: none; }
.sidebar-panel.active { display: block; }
.sidebar h3 { color: var(--accent-light); margin-bottom: 1rem; font-size: 1.1rem; }

.sidebar-menu { list-style: none; }
.sidebar-menu li { margin-bottom: 0.5rem; }
.sidebar-menu a {
    color: var(--text-main);
    text-decoration: none;
    display: block;
    padding: 6px 8px;
    border-radius: 3px;
    transition: 0.15s;
}
.sidebar-menu a:hover { 
    background: rgba(107, 122, 88, 0.25); 
    color: var(--accent-light); 
}

/* Кнопки фільтрів у сайдбарі */
.filter-menu button {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: 0.15s;
}
.filter-menu button:hover, 
.filter-menu button.active {
    background: rgba(107, 122, 88, 0.3);
    color: var(--accent-light);
    font-weight: bold;
}

/* ========================================================
   4. КОНТЕНТНА ЗОНА ТА ХЛІБНІ КРИХТИ
   ======================================================== */
.main-content { 
    flex: 1; 
    padding: 2rem; 
    min-width: 0; /* Захист від розпирання сітки */
}

.breadcrumbs {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.breadcrumbs a {
    color: var(--accent-light);
    text-decoration: none;
}
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span { margin: 0 4px; color: var(--border-color); }
.breadcrumbs .current { color: var(--text-main); font-weight: 600; }

/* ========================================================
   5. ЗАГАЛЬНІ КАРТКИ, ПЛИТКИ ТА ТЕГИ
   ======================================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.card img.thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 0.8rem;
}

.card h4 { color: var(--accent-light); margin-bottom: 0.5rem; }
.card p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1rem; flex-grow: 1; }

.thumb-container { position: relative; }
.video-date {
    position: absolute;
    bottom: 12px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: var(--accent-light);
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 3px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 12px;
}

.tag-badge {
    background: #171a15;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
}

/* ========================================================
   6. КНОПКИ
   ======================================================== */
.btn {
    display: inline-block;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-size: 0.9rem;
}
.btn-success { background: #4a6838; color: #fff; }
.btn-danger { background: #7c3a30; color: #fff; }
.btn-google { background: #3b5068; color: #fff; width: 100%; }

.btn-yt {
    background: #2a3324;
    border: 1px solid var(--accent-khaki);
    color: #e2e5db;
    margin-top: auto;
}
.btn-yt:hover {
    background: var(--accent-khaki);
    color: #fff;
}

/* ========================================================
   7. РЯДОК ЗБРОЇ (ДОВІДНИК ДЛЯ ПК)
   ======================================================== */
.weapon-row {
    display: grid;
    grid-template-columns: 280px 1fr auto;
    gap: 1.5rem;
    align-items: center;
    padding: 1.2rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.weapon-row-photo img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.weapon-row-info { text-align: left; }
.weapon-row-action { display: flex; justify-content: flex-end; }

/* ========================================================
   8. МОДАЛЬНІ ВІКНА (ФОТО ТА АВТОРИЗАЦІЯ)
   ======================================================== */
.img-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    justify-content: center;
    align-items: center;
    z-index: 2000;
    cursor: pointer;
}
.img-modal img {
    max-width: 90%;
    max-height: 90%;
    border: 2px solid var(--accent-khaki);
    border-radius: 4px;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(3px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-box {
    background: var(--bg-panel);
    border: 1px solid var(--accent-khaki);
    border-radius: 8px;
    width: 90%;
    max-width: 380px;
    padding: 2rem;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.modal-close {
    position: absolute;
    top: 10px; right: 15px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: #fff; }

.modal-divider {
    text-align: center;
    margin: 1.2rem 0;
    position: relative;
}
.modal-divider::before {
    content: "";
    position: absolute;
    top: 50%; left: 0; width: 100%; height: 1px;
    background: var(--border-color);
}
.modal-divider span {
    background: var(--bg-panel);
    padding: 0 10px;
    color: var(--text-muted);
    font-size: 0.8rem;
    position: relative;
}

.btn-google-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: #333;
    font-weight: 500;
    width: 100%;
    padding: 10px;
    border-radius: 4px;
    text-decoration: none;
}
.btn-google-auth:hover { background: #eee; }

.form-group { margin-bottom: 0.8rem; text-align: left; }
.form-group label { display: block; font-size: 0.8rem; margin-bottom: 4px; color: var(--text-muted); }
.form-group input, .auth-form input {
    width: 100%;
    padding: 8px 12px;
    background: #171a15;
    border: 1px solid var(--border-color);
    color: #fff;
    border-radius: 4px;
}

/* ========================================================
   9. АДАПТАЦІЯ ДЛЯ СМАРТФОНІВ ТА ПЛАНШЕТІВ (<= 850px)
   ======================================================== */
@media (max-width: 992px) {

    /* Залізобетонний стовпчик: звичайний block-потік */
    .layout-container {
        display: block !important;
        width: 100% !important;
    }

    /* Сайдбар лягає ЗВЕРХУ на 100% ширини */
    .sidebar {
        display: block !important;
        width: 100% !important;
        min-width: 100% !important;
        position: static !important;
        height: auto !important;
        border-right: none !important;
        border-bottom: 2px solid var(--border-color) !important;
        padding: 1rem !important;
        box-sizing: border-box !important;
    }

    /* Кнопки сайдбару стають акуратними плитками */
    .sidebar-menu {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 0 !important;
    }

    .sidebar-menu li {
        margin-bottom: 0 !important;
        list-style: none !important;
    }

    .sidebar-menu a, 
    .filter-menu button {
        display: inline-block !important;
        width: auto !important;
        padding: 6px 12px !important;
        background: #171a15 !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 4px !important;
        font-size: 0.85rem !important;
    }

    /* Контентна частина лягає СТРОГО ЗНИЗУ під сайдбар */
    .main-content {
        display: block !important;
        width: 100% !important;
        min-width: 100% !important;
        padding: 1.2rem 1rem !important;
        box-sizing: border-box !important;
    }

    /* Картки зброї у стовпчик */
    .weapon-row {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .weapon-row-photo img {
        width: 100% !important;
        height: 190px !important;
    }

    .weapon-row-action {
        justify-content: flex-start !important;
    }
	
	/* На вузькому екрані: ховаємо довгий напис, показуємо іконку */
    .logo-full { display: none !important; }
    .logo-short { 
        display: inline-block !important; 
        font-size: 1.25rem !important; 
        line-height: 1;
    }

    /* Трохи ущільнюємо шапку на мобілці, щоб усе сіло в один рядок */
    .topbar {
        padding: 0 0.6rem !important;
        gap: 0.4rem !important;
    }

    .top-nav {
        gap: 0.3rem !important;
    }

    .top-actions {
        gap: 0.4rem !important;
    }

    /* Робимо самі кнопки трохи компактнішими */
    .top-nav .nav-btn, 
    .top-actions button {
        padding: 5px 8px !important;
        font-size: 0.8rem !important;
    }
}