﻿/* LAF Barcode View — LAFDialog içinde kamera görüntüsü.
   Vizör her temada koyu kalır (kamera görüntüsü); vurgu LAF birincil renginden gelir. */

.laf-bc-viewport {
    --laf-bc-accent: var(--LAF-palette-primary);
    --laf-bc-dim: rgba(0, 0, 0, .5);
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: 62vh;
    background: #000;
    color: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.laf-bc-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* laf_barcode.js ROI hesabı cover varsayar */
}

/* ---------------------------------------------------------------- frame */

.laf-bc-frame {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 78%;
    aspect-ratio: 5 / 3;
    max-height: 64%;
    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: 24px;
    height: 24px;
    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;
}

/* ---------------------------------------------------------------- overlays */

.laf-bc-tools {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
}

.laf-bc-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    cursor: pointer;
}

    .laf-bc-tool svg {
        width: 22px;
        height: 22px;
        fill: none;
        stroke: currentColor;
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
    }

    .laf-bc-tool:hover {
        background: rgba(0, 0, 0, .75);
    }

    .laf-bc-tool.is-on {
        background: var(--laf-bc-accent);
    }

        .laf-bc-tool.is-on svg {
            fill: currentColor;
        }

.laf-bc-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10px;
    padding: 0 16px;
    text-align: center;
    font-size: .875rem;
    color: rgba(255, 255, 255, .9);
    text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
    pointer-events: none;
}

.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, .6);
}

    .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;
}

.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-tool:focus-visible,
    .laf-bc-btn:focus-visible {
        outline: 2px solid #fff;
        outline-offset: 2px;
    }

/* ---------------------------------------------------------------- motion */

@keyframes laf-bc-sweep {
    from {
        top: 18%;
    }

    to {
        top: 82%;
    }
}

@keyframes laf-bc-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .laf-bc-frame.is-live .laf-bc-line {
        animation: none;
        top: 50%;
    }

    .laf-bc-spinner {
        animation-duration: 2.4s;
    }
}
