/* static/main/css/template-base.css */

/* ============================================
   ОБЩИЕ СТИЛИ И СБРОС
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    overflow-x: hidden; /* Предотвращаем горизонтальную прокрутку при скрытом меню */
}

html, body {
    overflow-x: hidden;
    max-width: 100%;
    position: relative;
}

body.no-scroll {
    overflow: hidden; /* Запрещаем прокрутку, когда меню открыто */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: #007bff;
}

a:hover {
    color: #0056b3;
}

ul {
    list-style: none;
}

/* ============================================
   ШАПКА САЙТА (HEADER)
   ============================================ */
.header {
    background-color: #333; /* Основной темный фон, как в примере пользователя */
    color: #fff;
    padding: 0; /* Убираем padding, чтобы управлять им внутри строк */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px; /* Отступы для верхней строки */
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px; /* Пространство между элементами */
}

.logo {
    color: #fff;
    font-size: 1.8rem;
    font-weight: bold;
    flex-shrink: 0; /* Не сжимать логотип */
}

/* ========== КНОПКА "КАТАЛОГ" ========== */
.catalog-button {
    display: flex;
    align-items: center;
    background-color: #444; /* Темнее, чем основной фон, для контраста */
    color: #fff;
    border: none;
    border-radius: 8px; /* Скругленные углы */
    padding: 10px 15px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.catalog-button:hover {
    background-color: #555;
}

.catalog-button .catalog-icon {
    margin-right: 8px;
    width: 20px;
    height: 20px;
    color: #fff;
}

/* ========== ПОИСКОВАЯ СТРОКА ========== */
.search-bar-wrapper {
    flex-grow: 1; /* Занимает все доступное пространство */
    max-width: 600px; /* Ограничение ширины для больших экранов */
}

.search-form {
    display: flex;
    background-color: #555; /* Светлее, чем основной фон, для контраста */
    border-radius: 8px;
    overflow: hidden;
    height: 40px; /* Фиксированная высота */
}

.search-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Стили для кнопки сортировки */
/* Поисковая строка */
.search-bar-wrapper {
    flex-grow: 1;
    max-width: 600px;
    position: relative; /* Добавляем для правильного позиционирования */
}

.search-form {
    display: flex;
    background-color: #555;
    border-radius: 8px;
    height: 40px;
    position: relative; /* Добавляем для контекста */
    overflow: visible; /* Меняем с hidden на visible */
}

.search-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
    overflow: visible; /* Меняем с hidden на visible */
}

/* Стили для кнопки сортировки */
.sort-dropdown {
    position: relative;
    border-right: 1px solid #666;
    flex-shrink: 0;
    height: 100%;
}

.sort-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.2s;
    height: 100%;
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.sort-button:hover {
    background: #666;
}

.sort-button svg {
    flex-shrink: 0;
}

.sort-menu {
    position: absolute;
    top: calc(100% + 5px); /* Отступ сверху */
    left: 0;
    min-width: 200px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000; /* Очень большой z-index */
    overflow: visible;
    display: none;
}

.sort-menu.show {
    display: block;
}

.sort-option {
    display: block;
    width: 100%;
    padding: 10px 15px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    color: #333;
    font-size: 13px;
    transition: background 0.2s;
}

.sort-option:hover {
    background: #f5f5f5;
}

.sort-option.active {
    background: #007bff;
    color: white;
}

.search-bar-wrapper input[type="text"] {
    flex-grow: 1;
    border: none;
    background-color: transparent;
    color: #fff;
    padding: 0 10px;
    font-size: 1rem;
    outline: none;
}

.search-bar-wrapper input[type="text"]::placeholder {
    color: #aaa;
}

.search-button {
    background-color: #444;
    border: none;
    color: #fff;
    padding: 0 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
    height: 100%;
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.search-button:hover {
    background-color: #666;
}

.search-button svg {
    width: 20px;
    height: 20px;
}

/* ========== ПОЛЬЗОВАТЕЛЬСКИЕ ДЕЙСТВИЯ (ИКОНКИ + ТЕКСТ) ========== */
.user-actions {
    display: flex;
    gap: 15px; /* Пространство между иконками */
    flex-shrink: 0;
}

.user-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.user-action-item:hover {
    color: #007bff; /* Цвет при наведении */
}

.user-action-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
    color: inherit; /* Иконка наследует цвет от родителя */
}

.user-action-item.cart-link {
    /* Можно оставить зеленый акцент для корзины */
    color: #28a745;
}

.user-action-item.cart-link:hover {
    color: #218838;
}

/* ========== НИЖНЯЯ СТРОКА (ВТОРИЧНАЯ НАВИГАЦИЯ) ========== */
.header-bottom-row {
    background-color: #2a2a2a; /* Чуть светлее, чем основной хедер, для разделения */
    padding: 0.7rem 20px;
    border-top: 1px solid #444; /* Разделитель */
}

.secondary-nav ul {
    display: flex;
    justify-content: flex-start; /* Выравнивание по левому краю */
    max-width: 1200px;
    margin: 0 auto;
    gap: 25px; /* Пространство между пунктами */
}

.secondary-nav ul li a {
    color: #ccc;
    font-size: 0.9rem;
    padding: 5px 0;
    transition: color 0.3s ease;
}

.secondary-nav ul li a:hover {
    color: #fff;
}

/* ============================================
   ВЫДВИЖНОЙ КАТАЛОГ (CATALOG-MENU)
   ============================================ */
.catalog-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    background-color: #fff;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    visibility: hidden;
}

.catalog-menu.is-open {
    transform: translateX(0);
    visibility: visible;
}

.catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f8f8f8; /* Светлый фон для заголовка каталога */
    border-bottom: 1px solid #eee;
    flex-shrink: 0; /* Заголовок не сжимается */
}

.catalog-header h2 {
    font-size: 1.5rem;
    color: #333;
}

.close-catalog-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #666;
    transition: color 0.3s ease;
}

.close-catalog-btn:hover {
    color: #333;
}

.close-catalog-btn svg {
    width: 24px;
    height: 24px;
}

.catalog-nav {
    flex-grow: 1; /* Навигация занимает оставшееся пространство */
    padding: 10px 0;
}

.catalog-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.catalog-nav > ul > li {
    border-bottom: 1px solid #eee; /* Разделитель между основными категориями */
}

.catalog-nav > ul > li:last-child {
    border-bottom: none;
}

.catalog-nav a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    color: #333;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.catalog-nav a:hover {
    background-color: #f0f0f0;
    color: #007bff;
}

.catalog-nav .arrow {
    font-size: 1.2rem;
    color: #999;
    transition: transform 0.2s ease;
}

/* Стили для подменю */
.catalog-nav .submenu {
    max-height: 0; /* Изначально скрыто */
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #f8f8f8; /* Фон подменю */
}

.catalog-nav .has-submenu.submenu-open > a .arrow {
    transform: rotate(90deg); /* Поворот стрелки при открытом подменю */
}

.catalog-nav .has-submenu.submenu-open > .submenu {
    max-height: 500px; /* Достаточно большое значение для раскрытия (или используйте JS для точной высоты) */
}

.catalog-nav .submenu li a {
    padding: 10px 20px 10px 35px; /* Отступ для вложенных пунктов */
    font-size: 0.9rem;
    color: #555;
    border-bottom: 1px dotted #eee; /* Разделитель для подпунктов */
}

.catalog-nav .submenu li:last-child a {
    border-bottom: none;
}

.catalog-nav .submenu li a:hover {
    background-color: #e8e8e8;
    color: #007bff;
}

/* ============================================
   ОВЕРЛЕЙ
   ============================================ */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   ОСНОВНОЕ СОДЕРЖИМОЕ
   ============================================ */
.main-content {
    display: block; /* Убираем flex, если сайдбар вынесен */
    margin-top: 20px;
}

/* Секция товаров */
.products {
    flex-grow: 1; /* Занимает все оставшееся пространство */
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.products h2 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Адаптивная сетка */
    gap: 20px;
}

/* ============================================
   ФУТЕР (ПОДВАЛ САЙТА)
   ============================================ */
.footer-new {
    background-color: #2e313a; /* Темный фон из примера */
    color: #c0c0c0; /* Светлый текст */
    padding-top: 40px;
    margin-top: 40px;
    font-size: 14px;
}

.footer-wrapper {
    background-color: #2e313a; /* Для фона */
}

.footer-inner {
    display: flex;
    flex-wrap: wrap; /* Для адаптивности */
    justify-content: space-between;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Разделитель */
}

.footer-col {
    flex: 1; /* Распределение колонок */
    min-width: 200px; /* Минимальная ширина колонки */
    margin-bottom: 20px;
    padding-right: 20px; /* Отступ между колонками */
}

.footer-col:last-child {
    padding-right: 0;
}

.footer-col h3 {
    color: #fff; /* Белый заголовок */
    font-size: 1.1rem;
    margin-bottom: 20px;
    text-transform: uppercase;
    font-weight: bold;
}

/* Навигация в футере */
.footer-nav-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-nav-menu li {
    margin-bottom: 8px;
}

.footer-nav-menu a {
    color: #c0c0c0;
    font-size: 0.95rem;
    transition: color 0.2s ease;
}

.footer-nav-menu a:hover {
    color: #007bff; /* Цвет при наведении */
}

/* Контакты в футере */
.footer-contacts-col .title {
    color: #fff;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.footer-contacts-col p {
    margin-bottom: 5px;
}

.footer-contacts-col a {
    color: #c0c0c0;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.footer-contacts-col a:hover {
    color: #007bff;
}

.footer-address p {
    color: #c0c0c0;
    margin-top: 15px;
}

.footer-mail a {
    color: #c0c0c0;
    margin-top: 10px;
    display: inline-block;
}

/* Социальные сети */
.social-links {
    display: flex;
    gap: 15px;
    margin-top: 10px;
}

.social-icon {
    display: inline-block;
    width: 32px; /* Размер иконок */
    height: 32px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.social-icon:hover {
    background-color: #007bff; /* Пример цвета при наведении */
    transform: translateY(-3px);
}

.social-icon img {
    width: 18px; /* Размер SVG внутри круга */
    height: 18px;
}

.user-menu-trigger a {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    line-height: 0.5;
}



/* Нижняя полоса футера (копирайт) */
.footer-bottom-bar {
    padding: 20px 0;
    text-align: center;
    font-size: 0.85rem;
    color: #888;
}

.footer-copyright {
    margin: 0;
}

/* ============================================
   ВЫПАДАЮЩЕЕ МЕНЮ ПОЛЬЗОВАТЕЛЯ (ПО КЛИКУ) - ПОЛНАЯ ВЕРСИЯ
   ============================================ */

.user-menu-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    padding: 5px 10px 10px 10px;
    height: 100%;
    transition: background-color 0.3s ease;
    border-radius: 10px;
    cursor: pointer;
}
/* регулируем длину имени пользователя в меню */
.user-menu-trigger span{
    max-width:100px;
    font-size: 10px;
}


.user-menu-trigger:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.user-menu-trigger a {
    text-decoration: none;
    color: #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}


.header-user-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #4f9900;
}

/* Выпадающее меню */
.user-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    left: auto;
    min-width: 280px;
    background: #1c2127;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    padding: 8px 0;
    z-index: 1000;

    /* Скрыто по умолчанию */
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    pointer-events: none;
}

/* Показываем при клике */
.user-dropdown.show {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Шапка меню */
.dropdown-header {
    padding: 0 !important;
}

.dropdown-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.header-settings {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px !important;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transition: all 0.2s ease;
    color: #e0e0e0;
    text-decoration: none;
    font-size: 13px;
}

.header-settings:hover {
    background: #2d343b;
    color: #fff;
}

/* Колокольчик */
.notification-bell-wrapper {
    position: relative;
}

.notification-bell {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    color: #e0e0e0;
}

.notification-bell:hover {
    background: #2d343b;
    color: #fff;
}

.notification-bell svg {
    width: 18px;
    height: 18px;
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e44c2c;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Выпадающее окно уведомлений */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-height: 400px;
    background: #1c2127;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    display: none;
    overflow: hidden;
}

.notification-dropdown.show {
    display: block;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #333;
    color: #e0e0e0;
}

.mark-all-read {
    background: none;
    border: none;
    color: #4f9900;
    font-size: 12px;
    cursor: pointer;
}

.notification-list {
    overflow-y: auto;
    max-height: 350px;
}

.notification-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: #2d343b;
}

.notification-item.unread {
    background: rgba(79, 153, 0, 0.1);
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 13px;
    color: #e0e0e0;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 11px;
    color: #777;
}

.notification-empty {
    text-align: center;
    padding: 40px;
    color: #888;
    font-size: 13px;
}

/* Разделители */
.dropdown-divider {
    height: 1px;
    background: #333;
    margin: 6px 0;
}

/* Пункты меню */
.user-dropdown li {
    list-style: none;
}

.user-dropdown li a {
    padding: 10px 16px;
    color: #d0d0d0;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    transition: all 0.2s ease;
}

.user-dropdown li a:hover {
    background: #2d343b;
    color: #fff;
}

.user-dropdown li a svg {
    width: 16px;
    height: 16px;
    opacity: 0.7;
}

/* Кнопка выхода */
.logout-link {
    color: #ff6b6b !important;
}

.logout-link:hover {
    background: #2d343b !important;
    color: #ff6b6b !important;
}


