/* ======= Базовые настройки ======= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    background-color: #111827; /* тёмно-серый */
    color: #e5e7eb;
    padding-top: 20px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    transition: width 0.3s ease;
}

/* Удаляем маркеры */
.menu, .submenu {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Обнуляем li */
.menu > li, .submenu > li {
    margin: 0;
    padding: 0;
}

/* ======= Ссылки ======= */
.menu a {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 15px;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
    position: relative;
}

/* Иконка + текст */
.menu-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    flex-shrink: 0;
}

/* Hover */
.menu a:hover {
    background-color: #1e293b;
    color: #ffffff;
}

/* ======= Подменю ======= */
.menu a.has-children {
    font-weight: 600;
    background-color: transparent;
}

.menu a.has-children:hover {
    background-color: #1e293b;
}

/* Стрелки */
.menu a.has-children::after {
    content: '▸';
    font-size: 14px;
    margin-left: auto;
    color: #9ca3af;
    transition: transform 0.2s ease;
}

.menu a.has-children.expanded::after {
    transform: rotate(90deg);
}

/* Подменю */
.submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 16px;
}

.submenu.open {
    max-height: 1000px; /* достаточно большое значение для плавного раскрытия */
}

/* Подпункты */
.submenu li a {
    font-size: 14px;
    padding: 8px 16px;
}

/* ======= Активный пункт ======= */
.menu a.active {
    background-color: #2563eb;
    color: #ffffff;
    font-weight: 600;
    box-shadow: inset 3px 0 0 #1d4ed8;
}

/* ======= Адаптивные улучшения ======= */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .menu a {
        padding: 10px;
    }

    .submenu {
        padding-left: 10px;
    }
}


/* ============= Стили для поля поиска ============ */
.menu-search-form {
    position: relative;
    display: flex;
    align-items: center;
    padding: 10px 18px;
}

.search-wrapper {
    position: relative;
    flex: 1;               /* занимает доступное место */
    min-width: 0;          /* важно для flex-children */
}

.menu-search-input {
    width: 100%;
    box-sizing: border-box;    /* учитывать padding в ширине */
    padding-right: 28px;       /* место для крестика */
    background: none;
    border: none;
    outline: none;
    color: inherit;
    font-size: inherit;
}

/* Для Chrome / Edge */
.menu-search-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px #111827 inset; /* вставляем "свой" фон поверх autofill */
    -webkit-text-fill-color: #e5e7eb;                 /* цвет текста */
    transition: background-color 5000s ease-in-out 0s; /* глушим мерцание */
}

/* Для Firefox */
.menu-search-input:-moz-autofill {
    box-shadow: 0 0 0 1000px #111827 inset;
    -moz-text-fill-color: #e5e7eb;
}

.clear-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 14px;
    opacity: 1;                 /* делаем полностью видимым */
    color: #f87171;             /* красный для заметности */
    display: none;
    user-select: none;
}
.clear-btn:hover {
    color: #ef4444;             /* более яркий при наведении */
}


/* ============= Пункт "Выйти" ============ */
.menu-logout-form {
    margin-top: 10px;
    padding: 0 18px;
}

.menu-logout-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 10px 0;
    background: none;
    border: none;
    color: #f87171;             /* спокойный красный, в духе Tailwind Red-400 */
    font-size: 15px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

/* Иконка в кнопке */
.menu-logout-btn .menu-icon {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    filter: brightness(0.9);
}

/* Наведение */
.menu-logout-btn:hover {
    background-color: #1e293b;  /* в твоей гамме hover */
    color: #ef4444;             /* ярко-красный Red-500 */
}

/* Акцент на иконке при hover */
.menu-logout-btn:hover .menu-icon {
    filter: brightness(1.2);
}

/* Если хочется отделить визуально пункт выхода от остального меню */
.menu-logout-form::before {
    content: '';
    display: block;
    height: 1px;
    margin: 8px 0 12px;
    background-color: rgba(255, 255, 255, 0.08);
}
