﻿/* LAF Barcode Scanner
   Vizör her temada koyu kalır (kamera görüntüsü için). Vurgu rengi LAF token'ından gelir;
   aşağıdaki fallback'leri kendi token adlarınızla eşleyin. */

.laf-bc-backdrop {
    --laf-bc-accent: var(--laf-color-primary, #3d8bfd);
    --laf-bc-ok: #3ccf8e;
    --laf-bc-panel: #181c22;
    --laf-bc-text: #eef1f5;
    --laf-bc-muted: #9aa4b2;
    --laf-bc-dim: rgba(0, 0, 0, .5);
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 10, 14, .62);
    animation: laf-bc-fade .14s ease-out;
}

.laf-bc-panel {
    display: flex;
    flex-direction: column;
    width: min(520px, 94vw);
    max-height: 92vh;
    background: var(--laf-bc-panel);
    color: var(--laf-bc-text);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    outline: none;
}

.laf-bc-head,
.laf-bc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px 10px 16px;
}

.laf-bc-title {
    font-size: 1rem;
    font-weight: 600;
}

.laf-bc-hint {
    font-size: .875rem;
    color: var(--laf-bc-muted);
}

.laf-bc-actions {
    display: flex;
    gap: 6px;
}

/* ---------------------------------------------------------------- viewport */

.laf-bc-viewport {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #000;
    overflow: hidden;
}

.laf-bc-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* laf_barcode.js ROI hesabı cover varsayar */
}

.laf-bc-frame {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 76%;
    aspect-ratio: 5 / 3;
    max-height: 62%;
    transform: translate(-50%, -50%);
    border-radius: 10px;
    box-shadow: 0 0 0 100vmax var(--laf-bc-dim); /* çerçeve dışını karart */
    pointer-events: none;
}

.laf-bc-corner {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 3px solid var(--laf-bc-accent);
}

    .laf-bc-corner.tl {
        top: 0;
        left: 0;
        border-right: 0;
        border-bottom: 0;
        border-top-left-radius: 10px;
    }

    .laf-bc-corner.tr {
        top: 0;
        right: 0;
        border-left: 0;
        border-bottom: 0;
        border-top-right-radius: 10px;
    }

    .laf-bc-corner.bl {
        bottom: 0;
        left: 0;
        border-right: 0;
        border-top: 0;
        border-bottom-left-radius: 10px;
    }

    .laf-bc-corner.br {
        bottom: 0;
        right: 0;
        border-left: 0;
        border-top: 0;
        border-bottom-right-radius: 10px;
    }

.laf-bc-line {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 50%;
    height: 2px;
    border-radius: 1px;
    background: var(--laf-bc-accent);
    box-shadow: 0 0 10px var(--laf-bc-accent);
    opacity: 0;
}

.laf-bc-frame.is-live .laf-bc-line {
    opacity: .85;
    animation: laf-bc-sweep 1.8s ease-in-out infinite alternate;
}

/* ---------------------------------------------------------------- states */

.laf-bc-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    text-align: center;
    font-size: .9375rem;
    background: rgba(0, 0, 0, .55);
}

    .laf-bc-state p {
        margin: 0;
        max-width: 34ch;
        line-height: 1.45;
    }

.laf-bc-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255, 255, 255, .22);
    border-top-color: var(--laf-bc-accent);
    border-radius: 50%;
    animation: laf-bc-spin .8s linear infinite;
}

/* ---------------------------------------------------------------- buttons */

.laf-bc-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--laf-bc-text);
    cursor: pointer;
}

    .laf-bc-icon-btn svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .laf-bc-icon-btn:hover:not(:disabled) {
        background: rgba(255, 255, 255, .08);
    }

    .laf-bc-icon-btn:disabled {
        opacity: .4;
        cursor: default;
    }

    .laf-bc-icon-btn.is-on {
        background: var(--laf-bc-accent);
        color: #fff;
    }

        .laf-bc-icon-btn.is-on svg {
            fill: currentColor;
        }

.laf-bc-btn {
    padding: 8px 18px;
    border: 0;
    border-radius: 8px;
    background: var(--laf-bc-accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

    .laf-bc-icon-btn:focus-visible,
    .laf-bc-btn:focus-visible {
        outline: 2px solid var(--laf-bc-accent);
        outline-offset: 2px;
    }

/* ---------------------------------------------------------------- mobile: tam ekran */

@media (max-width: 600px), (max-height: 520px) {
    .laf-bc-backdrop {
        background: #000;
    }

    .laf-bc-panel {
        width: 100vw;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
        background: #000;
    }

    .laf-bc-head {
        padding-top: calc(10px + env(safe-area-inset-top, 0px));
        background: var(--laf-bc-panel);
    }

    .laf-bc-viewport {
        flex: 1;
        aspect-ratio: auto;
    }

    .laf-bc-frame {
        width: 82%;
    }

    .laf-bc-foot {
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        background: var(--laf-bc-panel);
    }
}

/* ---------------------------------------------------------------- motion */

@keyframes laf-bc-sweep {
    from {
        top: 18%;
    }

    to {
        top: 82%;
    }
}

@keyframes laf-bc-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes laf-bc-fade {
    from {
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .laf-bc-backdrop {
        animation: none;
    }

    .laf-bc-frame.is-live .laf-bc-line {
        animation: none;
        top: 50%;
    }

    .laf-bc-spinner {
        animation-duration: 2.4s;
    }
}
