/**
 * header-styles.css - Стили для Header + Nav + Catalog
 * Версия: 2.6 | 09.02.2026
 *
 * ИЗМЕНЕНИЯ v2.6:
 * - Активная категория: border заменён на box-shadow inset !important
 * - Кнопка Каталог: margin-right для зазора с пилюлями
 * - Мобильная/планшетная адаптация пилюль
 *
 * ИЗМЕНЕНИЯ v2.5:
 * - Мобильные счётчики с наложением (как на десктопе)
 *
 * ИЗМЕНЕНИЯ v2.4:
 * - Мобильное меню каталога позиционируется под header+nav-bar (top: 112px)
 * - Высота меню учитывает отступ сверху
 *
 * ИЗМЕНЕНИЯ v2.3:
 * - Кнопка "Написать": убрана обводка
 * - Nav-bar: sticky позиционирование
 * - Убран зазор между header и nav-bar
 */

/* ===== HEADER BADGE (счётчики с наложением) — DESKTOP ===== */
.header-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #c2410c;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 50%;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ===== MOBILE BOTTOM NAV BADGE (счётчики с наложением) ===== */
.mobile-bottom-nav .nav-item {
    position: relative;
}

.mobile-bottom-nav .nav-badge,
.mobile-bottom-nav .mobile-nav-badge {
    position: absolute;
    top: 2px;
    right: 50%;
    transform: translateX(calc(50% + 10px));
    background: #c2410c;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    border-radius: 50%;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    z-index: 10;
}

/* Для корзины — оранжевый */
.mobile-bottom-nav .nav-item[data-type="cart"] .nav-badge,
.mobile-bottom-nav .nav-item[data-type="cart"] .mobile-nav-badge,
.mobile-bottom-nav a[href*="cart"] .nav-badge,
.mobile-bottom-nav a[href*="cart"] .mobile-nav-badge {
    background: #ea580c;
}

/* Для избранного — красный/розовый */
.mobile-bottom-nav .nav-item[data-type="favorites"] .nav-badge,
.mobile-bottom-nav .nav-item[data-type="favorites"] .mobile-nav-badge,
.mobile-bottom-nav a[href*="favorite"] .nav-badge,
.mobile-bottom-nav a[href*="favorite"] .mobile-nav-badge {
    background: #dc2626;
}

/* ===== HEADER ACTION BUTTONS ===== */
.header-action-btn:hover {
    background: #f5f5f4;
    color: #292524;
}

/* ===== TEXT NAVIGATION ===== */
.nav-link {
    position: relative;
}
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #c2410c, #ea580c);
    border-radius: 2px;
    transition: width .3s ease;
}
.nav-link:hover {
    color: #c2410c !important;
}
.nav-link:hover::after {
    width: 100%;
}

/* ===== CONTACT BUTTON "НАПИСАТЬ" — без обводки ===== */
.contact-btn-write {
    border: none !important;
    outline: none;
}

.contact-btn-write:hover {
    background: #e7e5e4;
    color: #292524;
}

/* ===== CONTACT PHONE ===== */
.contact-phone:hover {
    color: #c2410c;
}

/* ===== USER MENU ===== */
.user-menu-container {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: .2s;
    background: 0;
    border: 0;
    color: #57534e;
    font-size: 20px;
}

.user-menu-trigger:hover {
    background: #f5f5f4;
    color: #292524;
}

/* Зелёный цвет для авторизованного пользователя */
.user-menu-trigger.logged-in {
    color: #22c55e;
}

.user-menu-trigger.logged-in:hover {
    color: #16a34a;
    background: #f0fdf4;
}

.user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 240px;
    z-index: 1000;
    border: 1px solid #e7e5e4;
    overflow: hidden;
}

.user-dropdown.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.user-dropdown-header {
    padding: 16px;
    background: linear-gradient(135deg, #fafaf9, #f5f5f4);
    border-bottom: 1px solid #e7e5e4;
}

.user-name {
    font-weight: 600;
    color: #292524;
    font-size: 15px;
    margin-bottom: 4px;
}

.user-role {
    font-size: 12px;
    color: #78716c;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Цвета ролей */
.user-role.role-admin {
    color: #7c3aed;
}

.user-role.role-manager {
    color: #2563eb;
}

.user-role.role-content,
.user-role.role-content_manager,
.user-role.role-contentmanager {
    color: #7c3aed;
}

.user-dropdown-menu {
    padding: 8px 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    color: #57534e;
    text-decoration: none;
    transition: .15s;
    border: 0;
    background: 0;
    cursor: pointer;
    text-align: left;
}

.user-dropdown-item:hover {
    background: #f5f5f4;
    color: #292524;
}

.user-dropdown-item i {
    width: 16px;
    text-align: center;
    color: #a8a29e;
}

.user-dropdown-item:hover i {
    color: #57534e;
}

/* Админ-панель фиолетовая */
.user-dropdown-item.admin {
    color: #7c3aed;
    font-weight: 500;
}

.user-dropdown-item.admin i {
    color: #7c3aed;
}

.user-dropdown-item.admin:hover {
    background: #f5f3ff;
}

.user-dropdown-item.logout {
    color: #dc2626;
}

.user-dropdown-item.logout i {
    color: #dc2626;
}

.user-dropdown-item.logout:hover {
    background: #fef2f2;
}

.user-dropdown-divider {
    height: 1px;
    background: #e7e5e4;
    margin: 4px 0;
}

/* ===== CATALOG BUTTON ===== */
.catalog-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    transition: all .2s;
    background: #c2410c;
    color: #fff;
    border: 0;
    cursor: pointer;
    margin-right: 4px; /* v2.6: зазор с пилюлями */
}

.catalog-btn:hover {
    background: #9a3412;
}

.catalog-btn i {
    font-size: 14px;
}

/* ===== CATEGORY PILLS ===== */
.category-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    transition: all .2s;
}

/* v2.6: Активная пилюля — перебиваем Tailwind border-2 */
.category-pill.border-2,
.category-pill[class*="border-orange"],
.category-pill.active-category {
    border-width: 0 !important;
    border-style: none !important;
    border-color: transparent !important;
    box-shadow: inset 0 0 0 2px #ea580c !important;
    padding: 8px 16px !important;
}

.categories-scroll {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

/* ===== DESKTOP CATALOG DROPDOWN ===== */
.catalog-dropdown-container {
    position: relative;
    display: none;
}

.catalog-dropdown {
    display: none;
    position: fixed;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 280px;
    max-width: 320px;
    z-index: 99999;
    border: 1px solid #e7e5e4;
    overflow: hidden;
}

.catalog-dropdown.active {
    display: block;
    animation: fadeInDown 0.2s ease;
}

.catalog-dropdown-all-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    color: #292524;                /* чёрный текст */
    text-decoration: none;
    background: #fff7ed;
    border-bottom: 1px solid #e7e5e4;
    transition: all .15s;
}
.catalog-dropdown-all-top:hover {
    background: #ffedd5;
    color: #c2410c;               /* при hover текст оранжевый */
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.catalog-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e7e5e4;
    background: #fafaf9;
}

.catalog-dropdown-header span {
    font-weight: 600;
    color: #292524;
    font-size: 14px;
}

.catalog-dropdown-close {
    width: 28px;
    height: 28px;
    border: 0;
    background: 0;
    font-size: 14px;
    color: #78716c;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.catalog-dropdown-close:hover {
    background: #f5f5f4;
    color: #292524;
}

.catalog-dropdown-nav {
    max-height: 400px;
    overflow-y: auto;
}

.catalog-dropdown-back {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #c2410c;
    background: #fff7ed;
    border: 0;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.catalog-dropdown-back:hover {
    background: #ffedd5;
}

.catalog-dropdown-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    color: #292524;
    text-decoration: none;
    border: 0;
    background: 0;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    border-bottom: 1px solid #f5f5f4;
}

.catalog-dropdown-item:hover {
    background: #fafaf9;
}

.catalog-dropdown-item:last-child {
    border-bottom: 0;
}

.catalog-dropdown-item-icon {
    width: 28px;
    height: 28px;
    background: #f5f5f4;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #78716c;
    font-size: 12px;
    margin-right: 10px;
    flex-shrink: 0;
}

.catalog-dropdown-item-name {
    flex: 1;
    font-weight: 500;
}

.catalog-dropdown-item-arrow {
    color: #a8a29e;
    font-size: 11px;
    margin-left: auto;
    transition: all 0.2s;
}

.catalog-dropdown-item:hover .catalog-dropdown-item-arrow {
    color: #c2410c;
    transform: translateX(3px);
}

.catalog-dropdown-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #c2410c;
    text-decoration: none;
    background: #fff7ed;
    border-top: 1px solid #e7e5e4;
    transition: all 0.15s;
}

.catalog-dropdown-all:hover {
    background: #ffedd5;
}

/* ===== MOBILE CATALOG MODAL — ИСПРАВЛЕНО v2.4 ===== */
.catalog-modal {
    display: none;
    position: fixed;
    top: 112px;
    left: 0;
    width: 100%;
    height: calc(100% - 112px);
    background: rgba(0, 0, 0, 0.5);
    z-index: 100001;
    justify-content: flex-start;
}

.catalog-modal.active {
    display: flex;
}

.catalog-panel {
    width: 100%;
    max-width: 360px;
    height: 100%;
    background: #fff;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding-top: 0;              /* ← УБРАЛИ */
    animation: slideIn 0.25s ease;
    border-radius: 0 12px 0 0;
}


@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.catalog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #e7e5e4;
    background: #fafaf9;
}

.catalog-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #292524;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.catalog-header h2 i {
    color: #c2410c;
}

.catalog-close {
    width: 40px;
    height: 40px;
    border: 0;
    background: 0;
    font-size: 20px;
    color: #78716c;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.catalog-close:hover {
    background: #f5f5f4;
    color: #292524;
}

.catalog-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.catalog-back {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #c2410c;
    background: #fff7ed;
    border: 0;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
}

.catalog-back:hover {
    background: #ffedd5;
}

.catalog-back i {
    font-size: 12px;
}

.catalog-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    color: #292524;
    text-decoration: none;
    border: 0;
    background: 0;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    border-bottom: 1px solid #f5f5f4;
}

.catalog-item:hover {
    background: #fafaf9;
}

.catalog-item:last-child {
    border-bottom: 0;
}

.catalog-item-icon {
    width: 32px;
    height: 32px;
    background: #f5f5f4;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #78716c;
    font-size: 14px;
    margin-right: 12px;
    flex-shrink: 0;
}

.catalog-item-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.catalog-item-name {
    font-weight: 500;
}

.catalog-item-arrow {
    color: #a8a29e;
    font-size: 12px;
    margin-left: auto;
    transition: all 0.2s;
}

.catalog-item:hover .catalog-item-arrow {
    color: #c2410c;
    transform: translateX(3px);
}

.catalog-all {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #c2410c;
    text-decoration: none;
    background: #fff7ed;
    border: 0;
    cursor: pointer;
    margin-top: auto;
}

.catalog-all:hover {
    background: #ffedd5;
}

/* ===== RESPONSIVE ===== */
.catalog-btn-mobile {
    display: inline-flex;
}

.catalog-dropdown-container {
    display: none;
}

/* Mobile < 768px */
@media (max-width: 767px) {
    .header-nav {
        display: none !important;
    }

    .header-contacts {
        display: none !important;
    }

    /* v2.6: Компактнее на телефоне */
    .catalog-btn {
        padding: 6px 12px;
        font-size: 13px;
        gap: 6px;
        margin-right: 2px;
    }

    .category-pill {
        padding: 6px 12px;
        font-size: 13px;
    }

    .category-pill.border-2,
    .category-pill[class*="border-orange"],
    .category-pill.active-category {
        padding: 6px 12px !important;
        box-shadow: inset 0 0 0 2px #ea580c !important;
    }

    .categories-scroll {
        gap: 6px;
        padding: 10px 0;
    }
}

/* Tablet 768px - 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
    .header-nav {
        display: none !important;
    }

    .header-contacts {
        display: flex !important;
    }

    /* v2.6: Планшет */
    .catalog-btn {
        padding: 7px 14px;
        margin-right: 3px;
    }

    .category-pill {
        padding: 7px 14px;
    }

    .category-pill.border-2,
    .category-pill[class*="border-orange"],
    .category-pill.active-category {
        padding: 7px 14px !important;
        box-shadow: inset 0 0 0 2px #ea580c !important;
    }
}

/* Desktop >= 1024px */
@media (min-width: 1024px) {
    .header-nav {
        display: flex !important;
    }

    .header-contacts {
        display: flex !important;
    }

    .catalog-btn-mobile {
        display: none !important;
    }

    .catalog-dropdown-container {
        display: block !important;
    }
}

/* Large desktop >= 1280px */
@media (min-width: 1280px) {
    .header-nav {
        gap: 40px;
    }
}
