/* ==========================================================================
   CHERNOGOROV HOME — Мобильный интерфейс (Стиль Apple / Glassmorphism)
   Полное соответствие стилю основного окна десктопного приложения
   ========================================================================== */

.mobile-body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(160deg, #f5f5f7 0%, #ffffff 100%);
    color: var(--gray-dark);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Оверлей цветовой вспышки при сканировании */
.scan-flash-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.15s ease-out;
}
.scan-flash-overlay.flash-success {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.3) 0%, rgba(16, 185, 129, 0.08) 70%, transparent 100%);
    opacity: 1;
}
.scan-flash-overlay.flash-error {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.35) 0%, rgba(239, 68, 68, 0.1) 70%, transparent 100%);
    opacity: 1;
}

/* --------------------------------------------------------------------------
   Мобильная шапка (в стиле Apple Glass)
   -------------------------------------------------------------------------- */
.mobile-nav {
    margin: 12px auto 0;
    width: calc(100% - 24px);
    max-width: 600px;
    padding: 12px 16px;
    border-radius: 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: sticky;
    top: 12px;
    z-index: 100;
}

.mobile-nav-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-nav-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Счётчик смены в шапке */
.mobile-counter-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    color: var(--gray-dark);
    font-weight: 600;
    transition: transform 0.2s ease, background-color 0.2s ease;
}
.mobile-counter-chip i {
    color: #eab308;
    font-size: 12px;
}
.mobile-counter-chip strong {
    color: var(--gray-dark);
    font-size: 15px;
    font-weight: 700;
}
.mobile-counter-chip.bump {
    animation: counterBump 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes counterBump {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); background: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.3); }
    100% { transform: scale(1); }
}
.counter-label {
    font-size: 12px;
    color: var(--gray);
}
.counter-unit {
    font-size: 11px;
    color: var(--gray);
}

/* Вторая строка шапки: селектор этапа и иконки */
.mobile-nav-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.mobile-stage-select-box {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 0 10px;
    height: 38px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}
.mobile-stage-select-box i {
    color: var(--gray);
    font-size: 13px;
    margin-right: 8px;
}
.mobile-stage-dropdown {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--gray-dark);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 18px;
}
.select-chevron {
    position: absolute;
    right: 10px;
    pointer-events: none;
    font-size: 10px;
    color: var(--gray);
}

.mobile-nav-btn-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* --------------------------------------------------------------------------
   Основная область мобильного терминала
   -------------------------------------------------------------------------- */
.mobile-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px;
    gap: 12px;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Панель камеры */
.mobile-camera-panel {
    position: relative;
    width: 100%;
    height: 270px;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111827;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.mobile-qr-viewport {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}
.mobile-qr-viewport video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 24px;
}

/* Прицельная рамка со сканирующим лучом */
.scanner-aim-box {
    position: absolute;
    width: 86%;
    max-width: 340px;
    height: 160px;
    pointer-events: none;
    z-index: 10;
}
.aim-corner {
    position: absolute;
    width: 24px;
    height: 24px;
    border-color: #ffffff;
    border-style: solid;
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.6));
}
.corner-tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-top-left-radius: 8px; }
.corner-tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-top-right-radius: 8px; }
.corner-bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-bottom-left-radius: 8px; }
.corner-br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-bottom-right-radius: 8px; }

.aim-laser {
    position: absolute;
    left: 6px;
    right: 6px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #38bdf8, #818cf8, #38bdf8, transparent);
    box-shadow: 0 0 10px 2px rgba(56, 189, 248, 0.8);
    animation: aimLaser 2s ease-in-out infinite alternate;
}
@keyframes aimLaser {
    0% { top: 6px; opacity: 0.85; }
    100% { top: 152px; opacity: 0.85; }
}

.scanner-status-chip {
    position: absolute;
    bottom: 12px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 15;
    pointer-events: none;
}
.scanner-status-chip i {
    color: #38bdf8;
}

.camera-actions-center {
    position: absolute;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.btn-camera-restart {
    padding: 10px 18px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --------------------------------------------------------------------------
   Строка ручного ввода
   -------------------------------------------------------------------------- */
.mobile-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --------------------------------------------------------------------------
   Карточка результата сканирования (в стиле Apple Glass)
   -------------------------------------------------------------------------- */
.mobile-result-card {
    padding: 16px;
    border-radius: 22px;
    border: 1px solid rgba(16, 185, 129, 0.35);
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.mobile-result-card.is-error {
    border-color: rgba(239, 68, 68, 0.35);
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}
.result-badge-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.mobile-result-card.is-error .result-badge-icon {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.3);
}

.result-title-block {
    flex: 1;
    min-width: 0;
}
.result-article-text {
    font-size: 18px;
    font-weight: 800;
    color: var(--gray-dark);
    letter-spacing: 0.02em;
    word-break: break-all;
}
.result-name-text {
    font-size: 13px;
    color: var(--gray);
    margin-top: 2px;
}

.result-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    margin-bottom: 12px;
}
.res-info-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.res-cell-label {
    color: var(--gray);
    font-size: 11px;
}

.result-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.result-status-msg {
    font-size: 12px;
    color: #059669;
    font-weight: 600;
}
.mobile-result-card.is-error .result-status-msg {
    color: #dc2626;
}

/* --------------------------------------------------------------------------
   История сканирований
   -------------------------------------------------------------------------- */
.mobile-history-panel {
    border-radius: 22px;
    overflow: hidden;
}

.history-panel-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}
.history-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}
.history-title i {
    color: var(--gray);
}

.history-list {
    max-height: 220px;
    overflow-y: auto;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.history-empty {
    padding: 20px;
    text-align: center;
    color: var(--gray);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.feed-item-row {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}
.feed-item-row:last-child {
    border-bottom: none;
}
.feed-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.feed-item-art {
    font-weight: 700;
    color: var(--gray-dark);
}
.feed-item-meta {
    color: var(--gray);
    font-size: 11.5px;
}
.feed-item-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.feed-qty-badge {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 11.5px;
    white-space: nowrap;
}
.feed-time-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    line-height: 1.2;
    text-align: right;
    min-width: 62px;
}
.feed-date {
    color: var(--gray);
    font-size: 10.5px;
    font-weight: 500;
    white-space: nowrap;
}
.feed-time {
    color: var(--gray-dark);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Мобильная авторизация (Apple Style)
   -------------------------------------------------------------------------- */
.mobile-login-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.mobile-login-card {
    width: 100%;
    max-width: 420px;
    padding: 32px 24px;
    border-radius: var(--radius-card);
}

.mobile-login-logo {
    text-align: center;
    margin-bottom: 16px;
}
.mobile-login-title {
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    color: var(--gray-dark);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}
.mobile-login-subtitle {
    font-size: 13px;
    text-align: center;
    color: var(--gray);
    margin-bottom: 24px;
}

.mobile-empty-state {
    padding: 36px 20px;
    text-align: center;
    border-radius: 24px;
    margin: 20px 0;
}

/* Степпер для выбора количества */
.stepper-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 4px;
}

.btn-stepper {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: none;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    color: #1f2937;
    font-size: 16px;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.1s ease, background 0.15s ease;
}

.btn-stepper:active {
    transform: scale(0.92);
    background: #f3f4f6;
}

.stepper-input {
    flex: 1;
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    border: none;
    background: transparent;
    color: #111827;
    outline: none;
    -moz-appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Автокомплит сотрудников для мобильной версии */
.mobile-login-card .worker-search-wrap {
    position: relative;
}
.mobile-login-card .worker-suggestions {
    max-height: 250px;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(0, 0, 0, 0.12);
}
.mobile-login-card .worker-suggestion-item {
    min-height: 46px;
    padding: 10px 14px;
}
.mobile-login-card .worker-dropdown-toggle {
    width: 38px;
    height: 38px;
    font-size: 15px;
}

