/* ═══════════════════════════════════════════════════════════════════
   layout.css — шапка, сайдбар, футер, cookie-баннер, логотип.
   ═══════════════════════════════════════════════════════════════════ */

/* ═══════════════ HEADER ═══════════════ */
header {
    padding: 12px 24px;
    position: sticky;
    top: 0;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    z-index: 100;
    border-bottom: 1px solid var(--border);
    height: 70px;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    max-width: 1600px;
    margin: 0 auto;
    height: 100%;
    position: relative;
}
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--accent);
    color: var(--white-on-accent);
    border: none;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.mobile-menu-btn:hover { background: var(--accent-hover); }

/* ═══════════════ LOGO ═══════════════ */
.logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
    gap: 10px;
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
    transition: var(--transition);
    min-width: 0;
}
.logo-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.logo-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: none;
}
.logo-img.is-visible { display: block; }
.logo--compact .logo-img { width: 32px; height: 32px; }

.logo-main {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: 0.01em;
    line-height: 1.1;
    transition: color 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-slogan {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-top: 3px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}
.logo-slogan:empty { display: none; }

.logo:hover .logo-main { color: var(--accent); }
.logo:hover .logo-slogan { color: var(--text-main); }

/* ═══════════════ HEADER SEARCH ═══════════════ */
.header-search {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    min-width: 0;
}
.header-search svg {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    fill: none;
}
.search-input-header {
    width: 100%;
    padding: 12px 16px 12px 48px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    outline: none;
    transition: var(--transition);
}
.search-input-header:focus { border-color: var(--text-main); }

/* ═══════════════ HEADER ACTIONS ═══════════════ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Кнопка поиска на мобилке — по умолчанию скрыта */
.mobile-search-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    background: var(--accent);
    color: var(--white-on-accent);
    border: none;
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.mobile-search-btn:hover { background: var(--accent-hover); }

.header-admin-btn { padding: 10px 20px; font-size: 15px; }

.cart-btn {
    background: var(--accent);
    color: var(--white-on-accent);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.cart-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.cart-icon { display: none; }

/* Бейдж корзины: по умолчанию белый (тёмная тема), скрыт при 0 */
.cart-count {
    background: var(--white-on-accent);
    color: var(--accent);
    font-size: var(--text-xs);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: var(--fw-semibold);
}
.cart-count.is-visible {
    display: flex;
}

/* ═══════════════ MOBILE SEARCH DROPDOWN ═══════════════ */
.mobile-search-dropdown {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 999;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
.mobile-search-dropdown.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}
.mobile-search-dropdown-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
.mobile-search-dropdown-inner svg {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    fill: none;
    pointer-events: none;
}
.mobile-search-dropdown-inner .search-input-header {
    flex: 1;
    padding: 10px 16px 10px 44px;
}
.mobile-search-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    padding: 4px 8px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}
.mobile-search-close:hover { color: var(--text-main); }

/* ═══════════════ ADMIN QUICK ADD BUTTON ═══════════════ */
.admin-add-wrapper {
    position: relative;
    display: none;
}
.admin-add-wrapper.is-visible {
    display: block;
}

.admin-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 18px;
    background: var(--accent);
    color: var(--white-on-accent);
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.3);
}

.admin-add-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(var(--accent-rgb), 0.4);
}

.admin-add-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    min-width: 250px;
    box-shadow: 0 12px 40px var(--shadow-strong);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.25s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1000;
    padding: 8px;
    backdrop-filter: blur(10px);
}

.admin-add-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.admin-add-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.admin-add-item:hover {
    background: var(--bg-input);
    color: var(--accent);
    padding-left: 18px;
}

.admin-add-item svg {
    color: var(--text-muted);
    transition: color 0.15s ease;
    flex-shrink: 0;
}

.admin-add-item:hover svg {
    color: var(--accent);
}

/* ═══════════════ MOBILE MENU ═══════════════ */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay-menu-bg);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
.mobile-menu-overlay.active { opacity: 1; visibility: visible; }

.mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100%;
    background: var(--bg-surface);
    z-index: 1001;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}
.mobile-menu.active { left: 0; }

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

/* ═══════════════ APP LAYOUT & SIDEBAR ═══════════════ */
.app-layout {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    min-height: calc(100vh - 70px);
}

.sidebar {
    width: 260px;
    flex-shrink: 0;
    padding: 24px 20px;
    border-right: 1px solid var(--border);
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: var(--fw-medium);
    font-size: var(--text-sm);
    transition: var(--transition);
}

.sidebar-nav a:hover {
    background: var(--bg-body);
    color: var(--text-main);
}
.sidebar-nav a.active {
    background: var(--accent);
    color: var(--white-on-accent);
    box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.25);
}
.sidebar-nav a svg { opacity: 0.7; }
.sidebar-nav a:hover svg { opacity: 1; }
.sidebar-nav a.active svg { opacity: 1; color: var(--white-on-accent); }

.sidebar-divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ─── Категории в сайдбаре ─── */
.sidebar-categories { display: flex; flex-direction: column; gap: 8px; }
.sidebar-title {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    padding-left: 16px;
    font-weight: var(--fw-medium);
}
.sidebar-categories a {
    padding: 8px 16px;
    font-size: var(--text-sm);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.sidebar-categories a span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-categories a:hover {
    color: var(--text-main);
    background: var(--bg-body);
}
.sidebar-categories a.active {
    background: var(--accent);
    color: var(--white-on-accent);
    box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.25);
}
.sidebar-categories a.active:hover {
    background: var(--accent);
    color: var(--white-on-accent);
}

.main-content { flex: 1; padding: 32px 40px; min-width: 0; }

/* ═══════════════ FOOTER ═══════════════ */
.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 60px 24px 40px;
    color: var(--text-main);
    margin-top: 60px;
}
.footer-container {
    max-width: 1400px;
    margin: 0 auto;
}
.footer-top {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}
.footer-col-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
}
.footer-desc {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
}
.footer-rating {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-main);
    transition: var(--transition);
}
.footer-rating:hover {
    border-color: var(--accent);
}
.rating-icon {
    color: var(--rating-gold);
    font-size: 16px;
    line-height: 1;
}
.footer-support {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}
.support-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}
.support-phone {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
}
.support-phone:hover {
    color: var(--accent);
}
.support-hours {
    font-size: 12px;
    color: var(--text-muted);
}
.footer-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}
.footer-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.footer-btn:hover {
    border-color: var(--text-muted);
    background: var(--bg-body);
}
.footer-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.footer-col-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-main);
}
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.footer-links a {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.footer-links a:hover {
    color: var(--accent);
}
.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 20px;
}
.footer-legal {
    line-height: 1.6;
}
.footer-legal-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}
.footer-legal-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.footer-legal-links a:hover {
    color: var(--text-main);
}

/* ═══════════════ COOKIE BANNER ═══════════════ */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 1100px;
    margin: 0 auto;
    background: var(--cookie-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px 28px;
    display: flex;
    gap: 24px;
    align-items: center;
    box-shadow: 0 20px 60px var(--shadow-strong);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px);
    transition: opacity 0.4s, transform 0.4s, visibility 0.4s;
}
.cookie-banner.active { opacity: 1; visibility: visible; transform: translateY(0); }
.cookie-banner-text { flex: 1; }
.cookie-banner-text h4 { font-family: var(--font-heading); font-size: 21px; margin-bottom: 6px; }
.cookie-banner-text p { font-size: var(--text-sm); color: var(--text-muted); }
.cookie-banner-text a { color: var(--accent); text-decoration: underline; }
.cookie-banner-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn-accept,
.cookie-btn-necessary {
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border: none;
}
.cookie-btn-accept { background: var(--accent); color: var(--white-on-accent); }
.cookie-btn-necessary { background: transparent; color: var(--text-main); border: 1px solid var(--border); }

#catalog-block { scroll-margin-top: 140px; }
.nav-label:empty::before { content: attr(data-fallback); }

/* ═══════════════ MEDIA ═══════════════ */
@media (max-width: 1200px) {
    .footer-top {
        grid-template-columns: 1.2fr 1fr 1fr;
        gap: 32px;
    }
}

@media (max-width: 992px) {
    .app-layout { flex-direction: column; }
    .sidebar { display: none; }
    .main-content { padding: 24px 20px; }
}

@media (max-width: 768px) {
    header { padding: 10px 16px; height: 60px; }
    .header-inner {
        gap: 8px;
        justify-content: space-between;
    }
    .mobile-menu-btn {
        display: flex;
        width: 38px;
        height: 38px;
    }
    .mobile-search-btn {
        display: flex;
        width: 38px;
        height: 38px;
    }
    .logo {
        flex: 1;
        min-width: 0;
    }
    .logo-main {
        font-size: 18px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.2;
    }
    .logo-img { width: 32px; height: 32px; }
    .logo--compact .logo-img { width: 28px; height: 28px; }
    .header-search { display: none; }
    .header-admin-btn { display: none; }
    .header-actions { gap: 6px; }

    .cart-btn {
        padding: 8px;
        width: 38px;
        height: 38px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        gap: 0;
    }
    .cart-btn .cart-icon { display: block; }
    .cart-btn .cart-btn-text { display: none; }
    .cart-btn .cart-count {
        position: absolute;
        top: -6px;
        right: -6px;
        width: 20px;
        height: 20px;
        font-size: 11px;
        margin: 0;
    }

    .main-content { padding: 16px; }
    .logo-slogan {
        font-size: 10px;
        letter-spacing: 0.14em;
        margin-top: 2px;
    }

    .mobile-menu .logo,
    .mobile-menu .logo--compact {
        flex: initial;
    }

    .site-footer {
        padding: 40px 20px 30px;
        margin-top: 40px;
    }
    .footer-top {
        grid-template-columns: 1fr 1fr;
        gap: 24px 16px;
        margin-bottom: 32px;
    }
    .footer-col-brand {
        grid-column: 1 / -1;
    }
    .footer-links {
        gap: 12px;
    }
    .footer-col-title {
        margin-bottom: 12px;
    }
    .footer-bottom {
        flex-direction: column;
        gap: 16px;
        padding-top: 24px;
    }
    .footer-legal-links {
        gap: 16px;
    }

    .cookie-banner {
        flex-direction: column;
        align-items: stretch;
        bottom: 12px;
        left: 12px;
        right: 12px;
        padding: 16px;
        gap: 12px;
    }
    .cookie-banner-actions { flex-direction: column-reverse; }
    .cookie-btn-accept,
    .cookie-btn-necessary { width: 100%; padding: 12px; }

    .admin-add-btn {
        width: 38px;
        height: 38px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
    }
    .admin-add-btn span { display: none; }
    .admin-add-btn svg { width: 18px; height: 18px; }
    .admin-add-dropdown { min-width: 250px; }
}

@media (max-width: 480px) {
    .footer-top {
        gap: 20px 12px;
    }
    .support-phone {
        font-size: 18px;
    }
}