* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

#overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}


body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #0a0e1a 0%, #0f172a 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    /* min-width: 450px; */
}
.login{
    align-items: center;
}
.container {
    max-width: 800px;
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 40px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 32px 24px 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}
.login-container {
    max-width: 400px;
    width: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 40px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 32px 24px 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}
h1{
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
}
h1 a {
    
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.subtitle {
    text-align: center;
    color: #94a3b8;
    font-size: 0.8rem;
    margin-bottom: 32px;
}

.input-group {
    margin-bottom: 20px;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: #1e293b;
    border-radius: 60px;
    border: 2px solid #334155;
    transition: all 0.2s;
}

.input-wrapper:focus-within {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 20px;
    font-size: 1rem;
    color: #f1f5f9;
    outline: none;
    border-radius: 60px;
    width: 100%;
}

.input-wrapper input::placeholder {
    color: #64748b;
}




.login-input-wrapper {
    display: flex;
    align-items: center;
    background: #1e293b;
    border-radius: 60px;
    border: 2px solid #872323;
    transition: all 0.2s;
}

.login-input-wrapper:focus-within {
    border-color: #fc1a1a;
    box-shadow: 0 0 0 3px rgba(246, 59, 59, 0.2);
}

.login-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 20px;
    font-size: 1rem;
    color: #f1f5f9;
    outline: none;
    border-radius: 60px;
}

.login-input-wrapper input::placeholder {
    color: #64748b;
}







.clear-btn {
    background: #ad3b3b;
    border: none;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
}

.clear-btn:hover {
    background: #f01d1d;
    transform: scale(1.02);
    color: white;
}


.result-card {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 24px;
    padding: 16px;
    border: 1px solid #334155;
}
.result-card p{
    color: #aaa;
    margin-top: 5px;
}
.result-card a{
    /* margin: 0 auto; */
    text-decoration: none;
    background-color: #244dbd;
    font-size: 20px;
    padding: 6px;
    border-radius: 10px;
    display: flex;
    gap: 5px;
}
.result-card a{
    color: #ddd;
}
.result-card span{
    color: #eb7474;
}
.no-stock{
    margin-top: 10px;
    text-align: center;
    color: #eb7474;
}
.code-value {
    background: #0f172a;
    padding: 12px;
    border-radius: 40px;
    text-align: center;
    font-family: monospace;
    font-size: 1.2rem;
    color: #86efac;
    margin-bottom: 12px;
    word-break: break-word;
}
.code-errvalue{
    background: #0f172a;
    padding: 12px;
    border-radius: 40px;
    text-align: center;
    font-family: monospace;
    font-size: 1.2rem;
    color: #ef8686;
    margin-bottom: 12px;
    word-break: break-word;
}
.button-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.small-btn {
    padding: 8px 20px;
    border-radius: 40px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.small-btn.primary {
    background: #2563eb;
    color: white;
}

.small-btn.secondary {
    background: #334155;
    color: #e2e8f0;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: black;
    z-index: 1000;
}

.modal.active {
    display: flex;
    flex-direction: column;
}

.video-container {
    flex: 1;
    position: relative;
    background: #000;
}

/* video {
    width: 100%;
    height: 100%;
    object-fit: cover;
} */

video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 🔥 КЛЮЧЕВОЕ */
    background: black;
}

.scan-rect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    border: 2px solid #10b981;
    border-radius: 16px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.modal-footer {
    padding: 16px;
    background: #111;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.close-modal-btn {
    background: #ef4444;
    border: none;
    padding: 12px 30px;
    border-radius: 40px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
}

.success-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 0.9rem;
    z-index: 2000;
    animation: slideUp 0.3s ease;
}

.stock-block {
    margin-top: 10px;
    background: #0f172a;
    padding: 10px;
    border-radius: 12px;
    border: 1px solid #334155;
}

.stock-block p {
    margin: 4px 0;
    color: #cbd5f5;
    font-size: 0.95rem;
}

@keyframes slideUp {
    from {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    }
    to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    }
}

.suggest-item {
    padding: 10px;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.2s;
    color: #ddf;
    width: calc(100% - 30px);
    margin: 1px auto 0 auto;
}

.suggest-item:hover {
    background: #334155;
}



.stock-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
    font-size: 14px;
    color: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.stock-table th {
    background: #1e293b;
    padding: 8px;
}

.stock-table td {
    padding: 8px;
    border-bottom: 1px solid #334155;
    text-align: center;
    background: #0e141c;
}

.suggest-item {
    padding: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 56px;
}

.suggest-item:hover,
.suggest-item.active {
    background: #1b153b;
    color: #fff;
}

.result-info{
    display:flex;
    gap: 10px;
}
.btn-ico{
    height: 30px;
    width: 30px;
    border-radius: 5px;
    overflow: hidden;
}
.result-main{
    display: flex;
    justify-content: center;
    align-content: center;
    flex-direction: row;
    align-items: baseline;
    background: #0e141c;
    padding: 5px;
    border-radius: 10px;
    gap: 20px;
}
.result-img{
    max-height: 400px;
    max-width: 300px;
    width: 100%;
    border-radius: 10px;
    /* min-height: 256px;
    min-width: 256px; */
    object-fit: contain;
    cursor: pointer;
}
.result-texts{
    width: 100%;
}

.suggest-img{
    width: 50px;
    height: auto;
    border-radius: 5px;

}
@media (max-width: 650px) {
    .result-info{
        flex-direction: column;
        align-items: center;
    }
}


/* Стили для оверлея предпросмотра */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    overflow: hidden;
}

.image-preview-overlay.active {
    opacity: 1;
    visibility: visible;
}

.image-preview-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: grab;
}

.image-preview-container.panning {
    cursor: grabbing;
}

.image-preview-img {
    object-fit: contain;
    transition: none;
    cursor: grab;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
    max-width: 90%;
    max-height: 90%;
}

.image-preview-img.panning {
    cursor: grabbing;
}

/* Кнопка закрытия */
.image-preview-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 100000;
}

.image-preview-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.image-preview-close::before,
.image-preview-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 2px;
    background: white;
    border-radius: 2px;
}

.image-preview-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.image-preview-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* Информационная панель */
.image-preview-zoom-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-family: system-ui, -apple-system, sans-serif;
    pointer-events: none;
    z-index: 100000;
    backdrop-filter: blur(8px);
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    .image-preview-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
    .image-preview-zoom-info {
        font-size: 11px;
        bottom: 15px;
        white-space: nowrap;
    }
}



.pages-block{
    position: absolute;
    display: flex;
    color: #fff;
    left: 10px;
    flex-direction: column;
    top: 10px;
    background-color: #0f172a;
    padding: 10px;
    border-radius: 10px;
    width: 160px;

}
.pages-title{
    color: #fff;
    text-align: center;
}
.pages-block a{
    display: flex;
    text-decoration: none;
    color: #fff;
    cursor: pointer;
    margin-top: 5px;
    padding: 5px;
    background-color: #1b153b;
    width: auto;
    align-items: center;
    border: 1px solid #29215c;
    border-radius: 5px;
}
.pages-block a span{
    margin-right: 5px;
    color: #2563eb;
}
@media (max-width: 1160px) {
    body{
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 10px;
        gap: 5px;
    }
    .pages-block{
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        width: auto;
        position: inherit;
        align-items: center;
        width: 100%;
        gap: 5px;
    }
    .pages-block a {
        margin-top: 0;
        margin-left: 5px;
    }
}
.metering {
    color: #ddd;
    background: #1e293b;
    margin-top: 5px;
    border-radius: 10px;
    overflow: hidden;
}

.metering-text {
    white-space: pre-wrap;
    background: #163b37;
    padding: 15px;
    outline: 2px dotted #307f2d;
    outline-offset: -7px;
    cursor: pointer;
    transition: 0.2s;
}
.metering-text:hover{
    background: #0f2926;
    outline: 2px dotted #42af3e;
    outline-offset: -2px;
}
.metering-title {
    font-size: 21px;
    margin-left: 10px;
}