/*
 * Малые дополнения поверх lavish-admin-dashboard (main.min.css) — почти
 * всегда то, чего нет в самом шаблоне (структура/цвета/радиусы — из
 * main.min.css). Явные переопределения ниже (.profile-actions,
 * .app-header, .pw-sticky-thead) — по прямой просьбе пользователя, у
 * каждого правила — свой комментарий.
 */

/* .profile-actions (быстрые ссылки под лого в сайдбаре) — по просьбе
   пользователя без нижнего отступа (в теме margin: 0 1rem 1rem 1rem);
   justify-content не здесь — задаётся utility-классом justify-content-start
   прямо в разметке (menu.blade.php), эта копия правила его не трогает. */
ul.profile-actions {
    list-style-type: none;
    overflow: hidden;
    gap: 7px;
    padding: 0;
    margin: 0 1rem 0 1rem;
    margin-left: 1rem;
}

/* .app-header — по просьбе пользователя больше не "прилипает" при
   скролле (в теме position:sticky;top:0) — прилипать должен только
   заголовок таблицы цен, см. .pw-sticky-thead ниже. */
.app-header {
    position: static;
}

/* Заголовок таблицы цен (App\Livewire\Prices\Show и Search\Results,
   partials/price-table.blade.php) — прилипает к верху при скролле
   страницы вниз. Sticky на каждой <th>, не на самом <thead> — надёжнее
   кросс-браузерно (у sticky на <thead>/<tr> есть нюансы в некоторых
   браузерах); фон у <th> уже непрозрачный (#5387e4 из темы), поэтому
   строки под ним не просвечивают при скролле. */
.pw-sticky-thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/*
 * Строка узла дерева категорий: та же цветовая/скругление логика, что и у
 * .sidebar-menu>li>a / .treeview-menu>li>a в main.min.css (там она рассчитана
 * на голый <a>, а нам нужна ещё и группа иконок-действий в конце строки —
 * поэтому обёртка своя, а не переопределение их правил).
 */
.pw-tree-row {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: 6px 12px 6px 17px;
    border-radius: 0 30px 30px 0;
    color: #3f415e;
    text-decoration: none;
    position: relative;
}

.pw-tree-row:hover,
.pw-tree-row:hover .pw-tree-label {
    background: #e1e5ed;
    color: #3f415e;
}

li.active > .pw-tree-row {
    background: #dadfe9;
}

.pw-tree-label {
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.pw-tree-label.pw-tree-label--active {
    color: var(--bs-primary);
    font-weight: 600;
}

.pw-tree-caret {
    font-size: .65rem;
    color: #8a8da3;
    transition: transform .2s ease;
    flex-shrink: 0;
}

li.active > .pw-tree-row .pw-tree-caret {
    transform: rotate(-90deg);
}

.pw-tree-actions {
    display: flex;
    align-items: center;
    gap: .1rem;
    flex-shrink: 0;
}

.pw-tree-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #8a8da3;
    border-radius: .3rem;
    font-size: .75rem;
    line-height: 1;
}

.pw-tree-actions button:hover {
    background: rgba(0, 0, 0, .08);
    color: #3f415e;
}

.treeview-menu .pw-tree-row {
    padding-left: 25px;
    border-left: 1px dashed #c6ccd8;
    margin: 0 0 0 25px;
}

.pw-price-cell-error {
    background: rgba(246, 78, 96, 0.1);
    color: #c0392b;
    font-style: italic;
    border-radius: 4px;
    padding: 0.05rem 0.35rem;
}

.pw-price-cell-stale {
    background: rgba(253, 126, 20, 0.12);
    color: #a35400;
    border-radius: 4px;
    padding: 0.05rem 0.35rem;
}

.pw-price-marker {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pw-price-marker--expensive {
    background: var(--bs-red, #f64e60);
}

.pw-price-marker--best {
    background: var(--bs-green, #6dbb30);
}

.pw-price-marker--tied {
    background: var(--bs-orange, #fd7e14);
}

/* Ручка изменения ширины сайдбара мышью — узкая полоса у правого края #sidebar. */
.pw-sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    bottom: 0;
    width: 6px;
    cursor: col-resize;
    z-index: 5;
}

.pw-sidebar-resize-handle:hover,
.pw-sidebar-resize-handle.pw-resizing {
    background: var(--bs-primary, #5387e4);
    opacity: .5;
}

/* На время перетаскивания — без transition, иначе ширина «резинится». */
.pw-sidebar-no-transition {
    transition: none !important;
}

/* Выпадающая панель результатов поиска товаров — под .search-container (position:relative уже задан в main.min.css). */
.pw-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 360px;
    overflow-y: auto;
    /* Прокрутка колёсиком внутри списка не должна докручивать страницу
       под ним, когда список дошёл до своего края. */
    overscroll-behavior: contain;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .12);
    z-index: 20;
    padding: 6px;
}

.pw-search-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
    padding: 8px 12px;
    border-radius: 8px;
    color: #3f415e;
    text-decoration: none;
}

.pw-search-result:hover {
    background: #eff2f8;
}

.pw-search-result-name {
    font-size: .9rem;
}

.pw-search-result-category {
    font-size: .75rem;
    color: #8a8da3;
    white-space: nowrap;
}

.pw-search-empty {
    padding: 10px 12px;
    font-size: .85rem;
    color: #8a8da3;
}

/* Значок ручной проверки цены (↻) — вращается, пока идёт wire:target="retry(...)". */
@keyframes pw-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.pw-spin {
    animation: pw-spin .7s linear infinite;
}

/* Сортировка перетаскиванием — товары в таблице цен и категории в дереве сайдбара (layouts/admin.blade.php). */
.pw-drag-handle {
    cursor: grab;
    color: #8a8da3;
}

.pw-drag-handle:active {
    cursor: grabbing;
}

.pw-dragging {
    opacity: .4;
}
