/* Equipment verification — fullscreen sheet, PWA safe-area aware */

.eq-ver-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000001;
    background: rgba(15, 23, 42, 0.5);
    align-items: stretch;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
}

.eq-ver-overlay.is-open {
    display: flex;
    overscroll-behavior: none;
    touch-action: pan-y;
}

body.ptr-modal-open,
html.ptr-modal-open {
    overscroll-behavior-y: none !important;
    overscroll-behavior: none !important;
}

.eq-ver-modal {
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100%;
    max-height: 100dvh;
    background: var(--bg-card, #fff);
    color: var(--text-primary, #0f172a);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    overscroll-behavior: none;
    /* Не залезать под status bar / home indicator */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

@media (min-width: 720px) {
    .eq-ver-overlay {
        align-items: center;
        justify-content: center;
        padding: calc(16px + env(safe-area-inset-top, 0px)) 20px calc(16px + env(safe-area-inset-bottom, 0px));
        background: rgba(15, 23, 42, 0.55);
    }

    .eq-ver-modal {
        width: 100%;
        max-width: 560px;
        height: auto;
        max-height: min(92dvh, 880px);
        border-radius: 18px;
        padding-top: 0;
        padding-bottom: 0;
        padding-left: 0;
        padding-right: 0;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
    }
}

/* —— Header —— */
.eq-ver-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    flex-shrink: 0;
    background: var(--bg-card, #fff);
}

.eq-ver-modal__head-text {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.eq-ver-modal__icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.14);
    color: #d97706;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.eq-ver-modal__head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 750;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

.eq-ver-modal__close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-muted, #64748b);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.eq-ver-modal__close:active {
    background: rgba(148, 163, 184, 0.22);
    color: var(--text-primary, #0f172a);
}

/* —— Scroll body —— */
.eq-ver-modal__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px 16px 8px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
}

.eq-ver-section {
    margin-bottom: 18px;
}

.eq-ver-section__title {
    margin: 0 0 10px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted, #94a3b8);
}

.eq-ver-status {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
}

.eq-ver-status--pending {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.eq-ver-status--approved {
    background: rgba(34, 197, 94, 0.12);
    color: #15803d;
}

.eq-ver-status--rejected {
    background: rgba(239, 68, 68, 0.1);
    color: #b91c1c;
}

.eq-ver-status__reason {
    margin-top: 6px;
    font-weight: 500;
    white-space: pre-wrap;
}

.eq-ver-status__fix {
    margin-top: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    opacity: 0.9;
}

.eq-ver-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 36px 18px 28px;
    min-height: 220px;
}

.eq-ver-success[hidden] {
    display: none !important;
}

.eq-ver-success__icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(34, 197, 94, 0.14);
    color: #16a34a;
    font-size: 1.75rem;
    margin-bottom: 16px;
}

.eq-ver-success__title {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary, #0f172a);
}

.eq-ver-success__text {
    margin: 0;
    max-width: 28rem;
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--text-muted, #64748b);
    font-weight: 500;
}

.eq-ver-form[hidden] {
    display: none !important;
}

.eq-ver-field {
    margin-bottom: 0;
}

.eq-ver-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 650;
    margin-bottom: 8px;
    color: var(--text-primary, #0f172a);
}

.eq-ver-input {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--bg-input, #f8fafc);
    color: inherit;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.eq-ver-input:focus {
    border-color: rgba(245, 158, 11, 0.7);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.18);
    background: #fff;
}

.eq-ver-input:disabled {
    opacity: 0.5;
}

.eq-ver-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 12px;
    font-size: 0.9rem;
    line-height: 1.35;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

.eq-ver-check--block {
    margin: 14px 0 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(148, 163, 184, 0.08);
}

.eq-ver-check input {
    width: 18px;
    height: 18px;
    margin: 1px 0 0;
    flex-shrink: 0;
    accent-color: #f59e0b;
}

.eq-ver-hint {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    margin: 10px 0 0;
    line-height: 1.45;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.08);
    color: #92400e;
}

/* —— Slots —— */
.eq-ver-slots {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.eq-ver-slots--photos {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-items: stretch;
}

.eq-ver-slots--photos .eq-ver-slot {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.eq-ver-slots--photos .eq-ver-slot__head {
    /* одинаковая высота заголовка → блоки «Загрузить» на одном уровне */
    min-height: 2.6em;
    align-items: flex-start;
    margin-bottom: 8px;
}

.eq-ver-slots--photos .eq-ver-slot__drop {
    margin-top: auto;
    min-height: 112px;
    height: 112px;
}

.eq-ver-slots--docs .eq-ver-slot--owner-id {
    grid-column: 1 / -1;
}

.eq-ver-slot__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    min-height: 22px;
}

.eq-ver-slot__num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.16);
    color: #b45309;
    font-size: 11px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.eq-ver-slot__label {
    font-size: 0.82rem;
    font-weight: 700;
    flex: 1;
    line-height: 1.25;
    min-width: 0;
}

.eq-ver-slot__ok {
    color: #16a34a;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.eq-ver-slot__remove {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    touch-action: manipulation;
}

.eq-ver-slot__remove[hidden] {
    display: none !important;
}

.eq-ver-slot__drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 112px;
    border: 1.5px dashed rgba(148, 163, 184, 0.5);
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.06);
    transition: border-color 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.eq-ver-slots--docs .eq-ver-slot__drop {
    min-height: 96px;
}

/* Нативный file input поверх слота — iOS/PWA не открывает picker у input[hidden] */
.eq-ver-slot__file {
    position: absolute;
    inset: 0;
    z-index: 3;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    border: 0;
    font-size: 0;
    -webkit-tap-highlight-color: transparent;
}

.eq-ver-slot__file:disabled {
    cursor: default;
    pointer-events: none;
}

.eq-ver-slot--done .eq-ver-slot__file {
    z-index: 3;
}

.eq-ver-slot--pdf .eq-ver-slot__file {
    /* PDF-превью поверх input */
    z-index: 1;
}

.eq-ver-slot__drop:active {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.55);
}

.eq-ver-slot--done .eq-ver-slot__drop {
    border-style: solid;
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.06);
}

.eq-ver-slot--loading .eq-ver-slot__drop {
    opacity: 0.55;
    pointer-events: none;
}

.eq-ver-slot__placeholder {
    color: var(--text-muted, #64748b);
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    padding: 12px;
    pointer-events: none;
    line-height: 1.2;
    white-space: nowrap;
}

.eq-ver-slot__placeholder i {
    font-size: 1.35rem;
    color: #94a3b8;
    line-height: 1;
}

.eq-ver-slot__placeholder span {
    display: block;
}

.eq-ver-slot__preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.eq-ver-slot__pdf {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    box-sizing: border-box;
    overflow: hidden;
    color: #b91c1c;
    font-weight: 700;
    font-size: 0.82rem;
    pointer-events: none;
    cursor: default;
    background: rgba(254, 226, 226, 0.55);
    z-index: 2;
    text-align: center;
}

.eq-ver-slot__pdf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 28px;
    padding: 0 8px;
    border-radius: 8px;
    background: #dc2626;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.eq-ver-slot__pdf-line {
    display: block;
    width: 100%;
    max-width: 100%;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
    color: #7f1d1d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eq-ver-slot__pdf i,
.eq-ver-slot__pdf-name {
    display: none;
}

.eq-ver-slot__progress {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.8);
    color: #fff;
    box-sizing: border-box;
}

.eq-ver-slot__progress[hidden] {
    display: none !important;
}

.eq-ver-slot__spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fbbf24;
    border-radius: 50%;
    animation: eq-ver-spin 0.75s linear infinite;
}

.eq-ver-slot__progress-text {
    font-size: 0.8rem;
}

.eq-ver-slot__progress-track {
    width: min(120px, 82%);
    height: 4px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.22);
}

.eq-ver-slot__progress-track > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: #fbbf24;
    transition: width 0.12s linear;
}

@keyframes eq-ver-spin {
    to { transform: rotate(360deg); }
}

/* display:* выше перебивает HTML [hidden] — без этого слоты кривятся */
.eq-ver-slot__preview[hidden],
.eq-ver-slot__pdf[hidden],
.eq-ver-slot__placeholder[hidden],
.eq-ver-slot__ok[hidden] {
    display: none !important;
}

/* PDF preview inside the verification flow */
.eq-ver-pdf-viewer {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000003;
    background: rgba(15, 23, 42, 0.78);
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}

.eq-ver-pdf-viewer.is-open {
    display: flex;
}

.eq-ver-pdf-viewer__panel {
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.eq-ver-pdf-viewer__head {
    min-height: 54px;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-sizing: border-box;
}

.eq-ver-pdf-viewer__head > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eq-ver-pdf-viewer__external {
    color: #b45309;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
}

.eq-ver-pdf-viewer__close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: #f1f5f9;
    color: #334155;
}

.eq-ver-pdf-viewer__frame {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 0;
    background: #e2e8f0;
}

@media (min-width: 720px) {
    .eq-ver-pdf-viewer {
        align-items: center;
        justify-content: center;
        padding: 24px;
    }
    .eq-ver-pdf-viewer__panel {
        max-width: 900px;
        max-height: 92dvh;
        border-radius: 16px;
        overflow: hidden;
    }
}

/* —— Sticky footer —— */
.eq-ver-modal__footer {
    flex-shrink: 0;
    padding: 12px 16px 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    background: var(--bg-card, #fff);
}

.eq-ver-submit {
    width: 100%;
    border: 0;
    border-radius: 14px;
    padding: 15px 16px;
    font-size: 0.95rem;
    font-weight: 750;
    background: #f59e0b;
    color: #1c1917;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
    touch-action: manipulation;
}

.eq-ver-submit:not(:disabled):active {
    filter: brightness(0.96);
    transform: scale(0.99);
}

.eq-ver-submit:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.eq-ver-submit.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.eq-ver-submit.is-loading::before {
    content: '';
    display: inline-block;
    width: 15px;
    height: 15px;
    margin-right: 9px;
    border: 2px solid rgba(28, 25, 23, 0.3);
    border-top-color: #1c1917;
    border-radius: 50%;
    vertical-align: -3px;
    animation: eq-ver-spin 0.75s linear infinite;
}

.eq-ver-privacy {
    margin: 10px 0 0;
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--text-muted, #94a3b8);
    text-align: center;
}

.eq-ver-privacy a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Badges on cards / profile */
.eq-ver-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #16a34a;
    font-size: 0.95rem;
    margin-left: 4px;
    vertical-align: middle;
}

.eq-ver-badge--pending {
    color: #d97706;
}

.card-subtitle .eq-ver-badge,
.hero-eq-name .eq-ver-badge {
    margin-left: 6px;
}

.hero-eq-name {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

/* Dark theme */
[data-theme="dark"] .eq-ver-modal,
html.dark .eq-ver-modal {
    background: var(--bg-card, #1e293b);
}

[data-theme="dark"] .eq-ver-input,
html.dark .eq-ver-input {
    background: rgba(15, 23, 42, 0.45);
    border-color: rgba(148, 163, 184, 0.28);
}

[data-theme="dark"] .eq-ver-input:focus,
html.dark .eq-ver-input:focus {
    background: rgba(15, 23, 42, 0.7);
}

[data-theme="dark"] .eq-ver-hint,
html.dark .eq-ver-hint {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

[data-theme="dark"] .eq-ver-modal__close,
html.dark .eq-ver-modal__close {
    background: rgba(148, 163, 184, 0.14);
}
