/* ocr-interface/css/style-modern.css */

/* ====== Theme tokens ====== */
:root {
    --ui-card-bg: #ffffff;
    --ui-card-border: rgba(15, 23, 42, 0.2);
    --ui-card-shadow: 0 2px 4px rgba(16, 24, 40, 0.08),0 10px 28px rgba(16, 24, 40, 0.10);
    --ui-radius: 12px;
    --ui-primary: #0d6efd;
    --ui-primary-08: rgba(13, 110, 253, 0.08);
    --ui-primary-10: rgba(13, 110, 253, 0.10);
    --ui-primary-15: rgba(13, 110, 253, 0.15);
    --ui-primary-25: rgba(13, 110, 253, 0.25);
    --ui-muted: #667085;
}


/* ====== Elevated “card” panels for each block ====== */
.panel-elevated {
    background: var(--ui-card-bg);
    border: 1px solid var(--ui-card-border);
    border-radius: var(--ui-radius);
    box-shadow: var(--ui-card-shadow);
    overflow: hidden;
}

[data-collapse-block="1"]{
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

[data-collapse-block="2"]{
    border-radius: 0;
}

[data-collapse-block="3"]{
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.panel-elevated .top-panel {
    height: 48px;
    /* a bit taller for breathing room */
    background: linear-gradient(180deg, var(--ui-primary-08), transparent 60%);
    border-bottom: 1px solid var(--ui-primary-10);
    backdrop-filter: saturate(140%) blur(2px);
}

.panel-elevated .bottom-panel {
    background: linear-gradient(0deg, rgba(2, 6, 23, 0.02), rgba(2, 6, 23, 0.02));
}

/* Tighter, consistent headings */
.panel-header {
    font-size: 0.95rem;
    font-weight: 700;
}

.panel-subheader {
    font-size: 0.8rem;
    color: var(--ui-muted);
}

/* Better collapsed label */
.collapsed-label {
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.02), rgba(2, 6, 23, 0));
    color: inherit;
    letter-spacing: .08em;
}

/* ===== Overlay v2: split into scan vs segment ===== */
.scan-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

/* ---- Corners (reuse your favorite style) ---- */
.scan-corners .corner {
    position: absolute;
    width: 26px;
    height: 26px;
    border: 2px solid rgba(13, 110, 253, .95);
    filter: drop-shadow(0 0 6px rgba(13, 110, 253, .45));
}

.scan-corners .tl {
    top: 10px;
    left: 10px;
    border-right: 0;
    border-bottom: 0;
    border-radius: 10px 0 0 0;
}

.scan-corners .tr {
    top: 10px;
    right: 10px;
    border-left: 0;
    border-bottom: 0;
    border-radius: 0 10px 0 0;
}

.scan-corners .bl {
    bottom: 10px;
    left: 10px;
    border-right: 0;
    border-top: 0;
    border-radius: 0 0 0 10px;
}

.scan-corners .br {
    bottom: 10px;
    right: 10px;
    border-left: 0;
    border-top: 0;
    border-radius: 0 0 10px 0;
}

/* ---- Shared HUD chip ---- */
.scan-overlay .status-chip {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .2px;
    color: #0b1220;
    background: #e7f1ff;
    border: 1px solid rgba(13, 110, 253, .25);
    padding: 6px 10px;
    border-radius: 999px;
    box-shadow: 0 2px 12px rgba(13, 110, 253, .25);
}

/* ===========================================================
     A) OCR SCANNING LOOK
     =========================================================== */
.scan-overlay--scan {
    /* very light vignette to increase contrast everywhere */
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, .15), inset 0 0 0 9999px rgba(0, 0, 0, .18);
}

/* Vertical scan bar */
.scan-overlay--scan .scan-bar {
    position: absolute;
    width: 100%;
    height: 50px;
    background: linear-gradient(to bottom,
            transparent 0%,
            rgba(13, 110, 253, .35) 10%,
            rgba(13, 110, 253, .75) 50%,
            rgba(13, 110, 253, .35) 90%,
            transparent 100%);
    border-radius: 10px;
    box-shadow: 0 0 24px rgba(13, 110, 253, .35), inset 0 0 24px rgba(13, 110, 253, .20);
    animation: scan-y 6s ease-in-out infinite;
}

@keyframes scan-y {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(50cqh);
    }

    100% {
        transform: translateY(0);
    }
}

/* Subtle moving scanlines (scientific) */
.scan-overlay--scan .scanlines {
    position: absolute;
    inset: 10px;
    background:
        repeating-linear-gradient(to bottom,
            rgba(13, 110, 253, .08) 0px,
            rgba(13, 110, 253, .08) 2px,
            transparent 2px,
            transparent 10px),
        repeating-linear-gradient(to right,
            rgba(13, 110, 253, .05) 0px,
            rgba(13, 110, 253, .05) 2px,
            transparent 2px,
            transparent 12px);
    border-radius: 12px;
    mix-blend-mode: screen;
    /* stays visible on dark images */
    animation: scanlines-move 3s linear infinite;
}

@keyframes scanlines-move {
    0% {
        background-position: 0 0, 0 0;
    }

    100% {
        background-position: 0 18px, 16px 0;
    }
}

/* Rotating reticle in the center */
.scan-overlay--scan .reticle {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.scan-overlay--scan .reticle .ring {
    position: absolute;
    left: -45px;
    top: -45px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 1.5px dashed rgba(13, 110, 253, .9);
    box-shadow: 0 0 10px rgba(13, 110, 253, .35);
    animation: reticle-rot 7s linear infinite;
}

.scan-overlay--scan .reticle .ring--inner {
    left: -26px;
    top: -26px;
    width: 52px;
    height: 52px;
    border: 1px solid rgba(13, 110, 253, .75);
    animation-duration: 9s;
    animation-direction: reverse;
}

@keyframes reticle-rot {
    to {
        transform: rotate(360deg);
    }
}

/* ===========================================================
     B) SEGMENTATION LOOK — SAM-like dotted grid
     =========================================================== */
.scan-overlay--segment {
    /* lighter vignette than scanning: focus on dots */
    box-shadow: inset 0 0 0 1px rgba(13, 110, 253, .20), inset 0 0 0 9999px rgba(0, 0, 0, .12);
}

/* High-contrast dotted grid using layered radial-gradients */
.scan-overlay--segment .dot-grid {
    position: absolute;
    inset: 10px;
    border-radius: 12px;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .9) 1.1px, transparent 1.2px),
        radial-gradient(circle at 1px 1px, rgba(13, 110, 253, .85) 1.1px, transparent 1.2px);
    /* white dots overlaid with primary dots for visibility on any background */
    background-blend-mode: screen;
    background-size: 22px 22px, 22px 22px;
    background-position: 0 0, 11px 11px;
    /* offset layers to feel richer */
    animation: dot-grid-float 6s ease-in-out infinite, glow 0.7s ease-in-out infinite;
    /* opacity:.95; */
}

@keyframes glow {
    0% {
        opacity: .6
    }

    50% {
        opacity: 1
    }

    100% {
        opacity: .6
    }
}

@keyframes dot-grid-float {
    0% {
        transform: translateY(0) translateX(0)
    }

    50% {
        transform: translateY(3px) translateX(3px)
    }

    100% {
        transform: translateY(0) translateX(0)
    }
}

/* ===== Reduced motion: tone animations down ===== */
@media (prefers-reduced-motion: reduce) {

    .scan-overlay--scan .scan-bar,
    .scan-overlay--scan .scanlines,
    .scan-overlay--scan .reticle .ring,
    .scan-overlay--segment .dot-grid {
        animation: none !important;
    }
}

/* ====== Nice little touches ====== */
[data-collapse-block] {
    transition: flex .35s ease, max-width .35s ease;
}

.data-collapse-button {
    display:flex;
    align-items: center;
    justify-content: center;
    padding-left: 3px;
    padding-right: 3px;
    padding-top: 0px;
    padding-bottom:0px;
    border-radius: 10px !important;
    background: rgba(13, 110, 253, .06);
    border: 1px solid var(--ui-primary-10) !important;
}

.block-collapsed .data-collapse-button {
    border-radius: 0px !important;
}

.data-collapse-button:hover {
    background: rgba(13, 110, 253, .12);
}

/* Improve polygon/line highlight contrast slightly */
.result-polygons polygon {
    fill: rgba(0, 0, 0, .08);
}

.result-highlight {
    background-color: rgba(13, 110, 253, .12) !important;
    fill: rgba(13, 110, 253, .12) !important;
}

/* Keep canvas interactions crisp */
#canvas-container {
    background-color: rgba(2, 6, 23, .06) !important;
}

/* Chip for credits (optional, if you want to style it) */
#ocr-interface .credits-chip {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #f1f4ff;
    border: 1px solid var(--ui-primary-10);
}