/* --- ГЛОБАЛЬНЫЕ ПЕРЕМЕННЫЕ --- */
:root {
    --check-purple: #673AB7;
    --check-purple-bg: rgba(103, 58, 183, 0.15);
    --check-purple-border: rgba(103, 58, 183, 0.4);
    --seller-appbar-height: 64px;
    --seller-sticky-top: 64px;
}

/* =========================================================
   SELLER-WEB SHELL — ограничение ширины на планшете/десктопе
   ========================================================= */

/* Обёртка контента KioskLayout: мобильные пропорции на широких экранах */
.seller-web-content {
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Внутренняя обёртка app-bar: actions держатся в той же мобильной колонке,
   а не уезжают к самому правому краю окна на десктопе/планшете */
.seller-appbar-inner {
    max-width: 540px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: flex;
    align-items: center;
}

/* Нижнее пустое пространство: минимальная высота 50vh, содержимое по центру */
.seller-bottom-space {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

/* =========================================================
   LOADING OVERLAY
   ========================================================= */

.seller-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.seller-loading-overlay-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--mud-palette-primary);
    letter-spacing: 2px;
}

.seller-loading-overlay-text {
    font-size: 1rem;
    color: #555;
}

/* =========================================================
   STICKY PANELS
   ========================================================= */

.seller-sticky-panel {
    position: sticky;
    top: var(--seller-sticky-top);
    z-index: 200;
    background: #fff;
}

/* =========================================================
   FLOATING BUTTONS
   ========================================================= */

.seller-fab-scroll-top {
    position: fixed;
    bottom: 24px;
    left: max(16px, calc(50% - 254px));
    z-index: 1100;
}

.seller-fab-next-checked {
    position: fixed;
    bottom: 24px;
    right: max(16px, calc(50% - 254px));
    z-index: 1100;
}

/* =========================================================
   INVENTORY LIST CARD BACKGROUNDS
   ========================================================= */

.inv-card-submitted {
    background-color: #E3F2FD !important;
}

.inv-card-processed {
    background-color: #FFFFFF !important;
}

.inv-card-draft {
    background-color: #F5F5F5 !important;
}

/* =========================================================
   USER-SELECT SUPPRESSION ON INFORMATIONAL CARDS
   ========================================================= */

.seller-no-select {
    user-select: none;
    -webkit-user-select: none;
}

/* =========================================================
   ADAPTIVE QUANTITY / TOTAL TYPOGRAPHY
   Крупный размер по умолчанию; уменьшается через sellerFitText
   только когда значение не помещается в свою зону (prompt п.16).
   ========================================================= */

/* Большой инпут количества (обычный вид) — крупный по умолчанию */
.inventory-doc-page .input-center input {
    font-size: 3.5rem !important;
}

/* Компактный инпут количества — крупный по умолчанию */
.inventory-doc-page .compact-input-manual input {
    font-size: 2.2rem !important;
}

/* Итог в компактной/обычной карточке — крупный по умолчанию, измеримый */
.compact-total-value {
    display: block;
    width: 100%;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    font-size: 2.125rem;
    font-weight: 950;
    line-height: 1.1;
}

/* Цена в карточке — крупная по умолчанию, измеримая */
.compact-price-value {
    display: block;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
}

/* --- ОБЩИЕ ЭЛЕМЕНТЫ --- */
.inventory-doc-page .note-button {
    border: 1px solid #e0e0e0 !important;
    background: white !important;
    border-radius: 50% !important;
    width: 42px;
    height: 42px;
    padding: 4px;
    justify-self: end;
    align-self: start;
    position: static;
    z-index: 1;
}

.inventory-doc-page .verification-checkbox .mud-checkbox-icons {
    color: #9E9E9E;
}

.inventory-doc-page .clickable-price {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
}

.inventory-doc-page .clickable-price:active {
    background: rgba(0, 0, 0, 0.1);
    transform: scale(0.96);
}

/* --- КОМПАКТНАЯ КАРТОЧКА --- */
.inventory-doc-page .compact-card-refined {
    border-left: 8px solid var(--stripe-color);
    transition: all 0.25s ease;
    position: relative;
}

.inventory-doc-page .compact-card-refined.card-zero {
    --card-bg: #F5F5F5;
    --stripe-color: #A9A9A9;
}

.inventory-doc-page .compact-card-refined.card-active {
    --card-bg: #FFFFFF;
    --stripe-color: #455A64;
    border-left-width: 12px !important;
}

.inventory-doc-page .compact-card-refined.is-custom {
    --stripe-color: #FFA000;
}

.inventory-doc-page .compact-card-refined {
    background-color: var(--card-bg) !important;
}

.inventory-doc-page .compact-card-refined.card-verified {
    background-color: var(--check-purple-bg) !important;
    border: 1px solid var(--check-purple-border) !important;
    border-left: 12px solid var(--check-purple) !important;
}

.inventory-doc-page .compact-card-refined.card-verified .mud-checkbox-icons {
    color: var(--check-purple) !important;
}

/* Заголовок карточки (grid layout) */
.inventory-doc-page .inventory-card-header,
.inventory-doc-page .compact-card-header {
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    column-gap: 8px;
    align-items: start;
    width: 100%;
}

.inventory-doc-page .inventory-card-title,
.inventory-doc-page .compact-card-title {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 6px;
    overflow: hidden;
}

.inventory-doc-page .inventory-card-title-line,
.inventory-doc-page .compact-card-title-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex: 0 0 auto;
    white-space: nowrap;
}

.inventory-doc-page .inventory-card-title-name,
.inventory-doc-page .compact-card-title-name {
    min-width: 0;
    flex: 0 0 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Центрирование цифры в большом инпуте */
.inventory-doc-page .input-center input {
    text-align: center !important;
    font-weight: 900;
    color: var(--mud-palette-primary);
    padding: 8px 0 !important;
    height: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
}

/* Кнопки +/- (большие) */
.inventory-doc-page .big-btn {
    height: 70px;
    font-weight: 700;
    flex: 1;
}

/* Кнопки быстрого добавления */
.inventory-doc-page .quick-btn {
    height: 56px;
    font-weight: 900;
    font-size: 1.25rem;
    flex: 1;
}

/* Компактная карточка: зона управления количеством */
.inventory-doc-page .qty-control-area {
    width: 48%;
    background: rgba(0, 0, 0, 0.05);
    height: 50px;
    display: flex;
    align-items: center;
}

/* Поле количества внутри зоны должно сжиматься, чтобы sellerFitText мог
   уменьшить шрифт вместо упора числа в границы на узких экранах */
.inventory-doc-page .qty-control-area .flex-grow-1 {
    min-width: 0;
    overflow: hidden;
}

/* Ограничиваем всю цепочку обёрток MudNumericField шириной зоны, иначе input
   растягивается под содержимое и число «вылезает» за границы (а clientWidth у
   input перестаёт быть ограниченным, и sellerFitText не видит переполнения). */
.inventory-doc-page .compact-input-manual.mud-input-control,
.inventory-doc-page .compact-input-manual .mud-input-control-input-container,
.inventory-doc-page .compact-input-manual .mud-input,
.inventory-doc-page .input-center.mud-input-control,
.inventory-doc-page .input-center .mud-input-control-input-container,
.inventory-doc-page .input-center .mud-input {
    width: 100% !important;
    min-width: 0 !important;
    overflow: hidden;
}

.inventory-doc-page .price-area { width: 28%; }
.inventory-doc-page .total-area { width: 38%; }

.inventory-doc-page .dashed-divider {
    border-top: 1px dashed #e0e0e0;
    padding-top: 4px;
    margin-top: 4px;
}

/* Компактный инпут количества */
.inventory-doc-page .compact-input-manual.mud-input-control {
    margin-top: 0 !important;
}

.inventory-doc-page .compact-input-manual .mud-input-control-input-container {
    padding-top: 0 !important;
}

.inventory-doc-page .compact-input-manual input {
    text-align: center !important;
    font-weight: 900;
    color: var(--mud-palette-primary);
    height: 1.2em !important;
    line-height: 1.2em !important;
    padding: 0 !important;
    margin-top: 5px !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
}

.inventory-doc-page .compact-input-manual .mud-input-slot {
    height: auto !important;
    min-height: 50px !important;
}

/* Expansion panels */
.inventory-doc-page .mud-expansion-panel-content {
    padding: 0 !important;
}

.inventory-doc-page .mud-expansion-panel-header {
    padding: 8px 16px !important;
}

.inventory-doc-page .mud-expansion-panels {
    background-color: transparent !important;
}

/* Липкий заголовок группы (компактный вид) */
.inventory-doc-page .category-divider {
    background-color: var(--mud-palette-primary-darken);
    padding: 4px 12px;
    margin: 8px 0;
}

/* Нулевые позиции */
.inventory-doc-page .card-zero .mud-text-primary {
    color: #9E9E9E !important;
}

/* Строки заголовочной карточки инвентаризации/черновика.
   Label оборачивается на узких экранах, value прижат вправо и не сжимается. */
.inv-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    min-height: 28px;
}
.inv-header-row .inv-label {
    flex: 0 1 auto;   /* wraps on narrow screens */
    min-width: 0;
}
.inv-header-row .inv-value {
    text-align: right;
    flex-shrink: 0;
    word-break: break-word;
}
/* Right-align the typed text inside the inline date picker.
   MudDatePicker (Variant.Text) renders input with class mud-input-slot. */
.inv-date-picker .mud-input-slot,
.inv-date-picker input {
    text-align: right !important;
}
/* Stable width so the picker never squishes on narrow screens */
.inv-date-picker {
    min-width: 150px;
    max-width: 170px;
}

/* Значок-глаз: часть позиций скрыта фильтром.
   Поднят над кнопкой перехода по отмеченным позициям (seller-fab-next-checked,
   bottom:24px right:16px), чтобы не перекрывать её при активных фильтрах. */
.filter-warning-badge {
    position: fixed;
    bottom: 88px;
    right: max(16px, calc(50% - 254px));
    z-index: 1000;
}

/* quantity-center: центрирование текста в поле количества */
.quantity-center .mud-input-slot {
    text-align: center !important;
}

/* Поле цены в диалоге кастомной позиции — крупный центрированный шрифт */
.custom-price-input input {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    text-align: center !important;
}

/* Кнопка «Удалить позицию» пульсирует когда количество = 0.
   Используем outline (как guide-highlight) — box-shadow MudButton перебивает анимацию. */
@keyframes delete-pulse {
    0%, 100% {
        outline-color: rgba(244, 67, 54, 0.95);
    }
    50% {
        outline-color: rgba(244, 67, 54, 0.15);
    }
}

.delete-zero-pulse {
    outline: 3px solid rgba(244, 67, 54, 0.95) !important;
    outline-offset: 3px !important;
    border-radius: 4px !important;
    animation: delete-pulse 1.0s ease-in-out infinite;
}

.expected-total-input input,
.expected-total-input .mud-input-slot,
.expected-total-input .mud-input-root {
    text-align: right !important;
    font-size: 1.5rem !important;
    font-weight: 700 !important;
}

/* Адаптивный шрифт кнопок: нормальный размер при достаточном пространстве, уменьшается при нехватке */
.mud-button-label {
    font-size: clamp(0.65rem, 3.5vw, 0.875rem);
}


/* =========================================================
   GUIDE TOUR STYLES
   ========================================================= */

/* Pulsing highlight applied to the currently active guide target */
@keyframes guide-pulse {
    0%, 100% {
        outline-color: rgba(255, 152, 0, 0.9);
        box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.35);
    }
    50% {
        outline-color: rgba(230, 81, 0, 0.7);
        box-shadow: 0 0 0 7px rgba(255, 152, 0, 0.0);
    }
}

.guide-highlight {
    outline: 2px solid rgba(255, 152, 0, 0.9) !important;
    outline-offset: 3px !important;
    border-radius: 4px !important;
    animation: guide-pulse 2s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

/* Block-level highlight (wraps notices panel or full sections) */
.guide-highlight-block {
    border-radius: 6px !important;
    padding: 4px !important;
}

/* App-bar icon highlight — no outline-offset clash with fixed header */
.guide-highlight-appbar {
    border-radius: 50% !important;
    outline-offset: 2px !important;
}

/* Guide toggle button — active state visual */
.guide-toggle-active {
    background-color: rgba(255, 193, 7, 0.25) !important;
    border-radius: 50% !important;
}

/* Floating popup — shown while guide is active; JS positions it near active target */
.guide-popover {
    position: fixed;
    z-index: 9999;
    min-width: 260px;
    max-width: 340px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.22);
    padding: 12px 14px 10px;
    /* Default position before JS positions it */
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
}

.guide-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.guide-popover-counter {
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.45);
    font-weight: 600;
}

.guide-popover-close {
    margin: -4px -4px -4px 0;
}

.guide-popover-text {
    font-size: 1rem;
    line-height: 1.55;
    color: #212121;
    margin-bottom: 10px;
    min-height: 1.4em;
}

.guide-popover-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.guide-popover-btn {
    flex: 1;
}

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

h1:focus {
    outline: none;
}
