/* =====================================================================
   Lab officer panel (#labOfficerPanel) — premium skin.
   Loaded after building-measure.css. Scoped to the ID so the other
   panels sharing .lab-officer-panel (notifications, removals) are untouched.
   ===================================================================== */

.measure-app.is-lab-officer #labOfficerPanel {
    --lop-navy: #0b2545;
    --lop-teal: #0d9488;
    --lop-blue: #2563eb;
    --lop-ink: #0f1f33;
    --lop-muted: #64748b;
    --lop-line: #e3e9f0;
    --lop-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --lop-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    top: 14px;
    left: 14px;
    width: min(410px, calc(100% - 28px));
    max-height: calc(100% - 28px);
    padding: 0;
    overflow: hidden auto;
    border: 0;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(248, 251, 253, 0.96), rgba(239, 244, 249, 0.98));
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    backdrop-filter: blur(16px) saturate(1.3);
    box-shadow: 0 30px 70px -24px rgba(11, 37, 69, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.7), 0 0 0 1px rgba(11, 37, 69, 0.07);
    font-family: var(--font-display, "Cairo", system-ui, sans-serif);
    scrollbar-width: thin;
    scrollbar-color: rgba(11, 37, 69, 0.25) transparent;
    animation: lopIn 0.7s var(--lop-ease) both;
}

@keyframes lopIn {
    from { opacity: 0; transform: translateX(-24px) scale(0.97); }
    to { opacity: 1; transform: none; }
}

/* ---------- Hero ---------- */
#labOfficerPanel .lop-hero {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.05rem 1.1rem 1.15rem;
    color: #fff;
    background: linear-gradient(140deg, var(--lop-navy) 0%, #0f3b5f 55%, #0f5f63 100%);
}

    #labOfficerPanel .lop-hero::after {
        content: "";
        position: absolute;
        inset: 0;
        background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
        background-size: 20px 20px;
        -webkit-mask-image: linear-gradient(200deg, #000, transparent 80%);
        mask-image: linear-gradient(200deg, #000, transparent 80%);
        pointer-events: none;
    }

#labOfficerPanel .lop-aurora {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

    #labOfficerPanel .lop-aurora i {
        position: absolute;
        width: 190px;
        height: 190px;
        border-radius: 50%;
        filter: blur(48px);
        opacity: 0.5;
        animation: lopFloat 12s ease-in-out infinite alternate;
    }

        #labOfficerPanel .lop-aurora i:nth-child(1) { background: #14b8a6; top: -110px; left: -40px; }
        #labOfficerPanel .lop-aurora i:nth-child(2) { background: #3b82f6; bottom: -130px; right: -30px; animation-delay: -6s; }

@keyframes lopFloat {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(30px, 18px) scale(1.15); }
}

#labOfficerPanel .lop-hero-ico {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 17px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(255, 255, 255, 0.26);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 12px 24px -10px rgba(0, 0, 0, 0.5);
    animation: lopPop 0.8s var(--lop-spring) 0.2s both, lopTilt 4s ease-in-out 1.2s infinite;
}

    #labOfficerPanel .lop-hero-ico svg { width: 28px; height: 28px; }

@keyframes lopPop {
    from { opacity: 0; transform: scale(0.3) rotate(-18deg); }
    to { opacity: 1; transform: none; }
}

@keyframes lopTilt {
    0%, 100% { transform: rotate(0); }
    50% { transform: rotate(-7deg); }
}

#labOfficerPanel .lab-visit-head {
    position: relative;
    z-index: 1;
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    margin: 0;
}

#labOfficerPanel .lop-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    color: #99f6e4;
    letter-spacing: 0.03em;
}

#labOfficerPanel .lab-visit-head h3 {
    margin: 0;
    font-size: 1.22rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.3;
}

#labOfficerPanel .lab-status {
    margin-top: 0.3rem;
    gap: 0.4rem;
    min-height: 26px;
    padding: 0.15rem 0.7rem;
    border-radius: 999px;
    font-size: 0.74rem;
    color: #fde68a;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(253, 211, 77, 0.55);
}

    #labOfficerPanel .lab-status::before {
        content: "";
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: currentColor;
        animation: lopPulse 1.8s ease-out infinite;
    }

    #labOfficerPanel .lab-status.is-progress {
        color: #bae6fd;
        background: rgba(59, 130, 246, 0.24);
        border-color: rgba(147, 197, 253, 0.6);
    }

    #labOfficerPanel .lab-status.is-uploaded {
        color: #bbf7d0;
        background: rgba(16, 185, 129, 0.22);
        border-color: rgba(110, 231, 183, 0.6);
    }

@keyframes lopPulse {
    0% { box-shadow: 0 0 0 0 currentColor; }
    100% { box-shadow: 0 0 0 8px transparent; }
}

/* ---------- Stepper ---------- */
#labOfficerPanel .lop-steps {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: -0.7rem 0.85rem 0;
    padding: 0.65rem 0.4rem 0.55rem;
    list-style: none;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 26px -16px rgba(11, 37, 69, 0.45), 0 0 0 1px var(--lop-line);
    animation: lopRise 0.6s var(--lop-ease) 0.25s both;
}

    #labOfficerPanel .lop-steps li {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
        text-align: center;
    }

        /* connector line between steps (RTL: towards the next step on the left) */
        #labOfficerPanel .lop-steps li + li::before {
            content: "";
            position: absolute;
            top: 13px;
            left: calc(50% + 17px);
            right: calc(-50% + 17px);
            height: 3px;
            border-radius: 3px;
            background: #e6edf4;
            transition: background 0.5s ease;
        }

        #labOfficerPanel .lop-steps i {
            width: 28px;
            height: 28px;
            display: grid;
            place-items: center;
            border-radius: 50%;
            font-style: normal;
            font-size: 0.78rem;
            font-weight: 800;
            color: #94a3b8;
            background: #f1f5f9;
            border: 2px solid #e2e8f0;
            transition: all 0.45s var(--lop-spring);
        }

        #labOfficerPanel .lop-steps span {
            font-size: 0.68rem;
            font-weight: 700;
            color: #94a3b8;
            transition: color 0.3s ease;
        }

/* done steps */
#labOfficerPanel[data-status="in_progress"] .lop-steps li[data-step="required"] i,
#labOfficerPanel[data-status="report_uploaded"] .lop-steps li[data-step="required"] i,
#labOfficerPanel[data-status="report_uploaded"] .lop-steps li[data-step="in_progress"] i {
    color: #fff;
    background: var(--lop-teal);
    border-color: var(--lop-teal);
}

#labOfficerPanel[data-status="in_progress"] .lop-steps li[data-step="in_progress"]::before,
#labOfficerPanel[data-status="report_uploaded"] .lop-steps li[data-step="in_progress"]::before,
#labOfficerPanel[data-status="report_uploaded"] .lop-steps li[data-step="report_uploaded"]::before {
    background: linear-gradient(270deg, var(--lop-teal), var(--lop-blue));
}

/* current step */
#labOfficerPanel[data-status="required"] .lop-steps li[data-step="required"] i,
#labOfficerPanel[data-status="in_progress"] .lop-steps li[data-step="in_progress"] i,
#labOfficerPanel[data-status="report_uploaded"] .lop-steps li[data-step="report_uploaded"] i {
    color: #fff;
    background: linear-gradient(145deg, var(--lop-teal), var(--lop-blue));
    border-color: #fff;
    transform: scale(1.12);
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.18), 0 8px 16px -6px rgba(37, 99, 235, 0.7);
}

#labOfficerPanel[data-status="required"] .lop-steps li[data-step="required"] span,
#labOfficerPanel[data-status="in_progress"] .lop-steps li[data-step="in_progress"] span,
#labOfficerPanel[data-status="report_uploaded"] .lop-steps li[data-step="report_uploaded"] span {
    color: var(--lop-ink);
    font-weight: 800;
}

/* ---------- Body ---------- */
#labOfficerPanel .lop-body {
    padding: 0.85rem 0.95rem 0.2rem;
}

#labOfficerPanel .lab-officer-hint {
    margin: 0 0 0.6rem;
    min-height: 0;
    padding: 0;
    border-radius: 12px;
    font-size: 0.8rem;
    transition: padding 0.25s ease, background 0.25s ease;
}

    #labOfficerPanel .lab-officer-hint:not(:empty) {
        padding: 0.55rem 0.75rem;
        background: #f1f5f9;
        border-inline-start: 3px solid #94a3b8;
        animation: lopRise 0.35s var(--lop-ease) both;
    }

        #labOfficerPanel .lab-officer-hint.is-ok:not(:empty) {
            background: #ecfdf5;
            border-color: #10b981;
        }

        #labOfficerPanel .lab-officer-hint.is-err:not(:empty) {
            background: #fef2f2;
            border-color: #ef4444;
        }

#labOfficerPanel .lab-visit-grid {
    gap: 0.6rem;
}

#labOfficerPanel .lab-visit-grid > *,
#labOfficerPanel .lab-photos > * {
    animation: lopRise 0.55s var(--lop-ease) both;
}

    #labOfficerPanel .lab-visit-grid > :nth-child(1) { animation-delay: 0.32s; }
    #labOfficerPanel .lab-visit-grid > :nth-child(2) { animation-delay: 0.38s; }
    #labOfficerPanel .lop-meta { animation-delay: 0.44s !important; }
    #labOfficerPanel .lab-visit-notes { animation-delay: 0.5s !important; }
    #labOfficerPanel .lab-photos > :nth-child(1) { animation-delay: 0.56s; }
    #labOfficerPanel .lab-photos > :nth-child(2) { animation-delay: 0.62s; }

@keyframes lopRise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* Code tiles */
#labOfficerPanel .lop-tile {
    gap: 0.2rem;
    padding: 0.6rem 0.75rem;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 18px -14px rgba(11, 37, 69, 0.45), 0 0 0 1px var(--lop-line);
    transition: transform 0.3s var(--lop-ease), box-shadow 0.3s ease;
}

    #labOfficerPanel .lop-tile:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 24px -14px rgba(11, 37, 69, 0.5), 0 0 0 1px rgba(13, 148, 136, 0.3);
    }

    #labOfficerPanel .lop-tile > span {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.7rem;
        font-weight: 700;
        color: var(--lop-muted);
    }

        #labOfficerPanel .lop-tile > span svg {
            width: 14px;
            height: 14px;
            color: var(--lop-teal);
        }

    #labOfficerPanel .lop-tile input,
    #labOfficerPanel .lop-tile input[readonly] {
        min-height: 0;
        padding: 0;
        border: 0;
        background: transparent;
        font-size: 1.02rem;
        font-weight: 800;
        color: var(--lop-ink);
        letter-spacing: 0.02em;
        outline: none;
        cursor: default;
    }

/* Auto-recorded chips */
#labOfficerPanel .lop-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

#labOfficerPanel .lop-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    color: #334155;
    background: #fff;
    box-shadow: 0 0 0 1px var(--lop-line);
}

    #labOfficerPanel .lop-chip svg {
        flex: 0 0 auto;
        width: 14px;
        height: 14px;
        color: var(--lop-teal);
    }

    #labOfficerPanel .lop-chip b {
        font-weight: 700;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

#labOfficerPanel .lop-chip-geo .lab-auto-meta {
    margin: 0;
    font-size: inherit;
    color: inherit;
}

#labOfficerPanel .lop-chip-geo:has(.is-ok) {
    color: #047857;
    background: #ecfdf5;
    box-shadow: 0 0 0 1px #a7f3d0;
}

    #labOfficerPanel .lop-chip-geo:has(.is-ok) svg { color: #059669; }

#labOfficerPanel .lop-chip-geo:has(.is-err) {
    color: #b91c1c;
    background: #fef2f2;
    box-shadow: 0 0 0 1px #fecaca;
}

    #labOfficerPanel .lop-chip-geo:has(.is-err) svg { color: #dc2626; }

#labOfficerPanel .lop-chip-geo:not(:has(.is-ok)):not(:has(.is-err)) svg {
    animation: lopBounce 1.2s ease-in-out infinite;
}

@keyframes lopBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Notes */
#labOfficerPanel .lab-visit-notes > span {
    font-size: 0.74rem;
    color: #1e3a52;
}

#labOfficerPanel .lab-visit-notes textarea {
    min-height: 78px;
    border: 1px solid #dde5ee;
    border-radius: 14px;
    padding: 0.6rem 0.75rem;
    background: #fff;
    transition: border-color 0.25s ease, box-shadow 0.3s ease;
}

    #labOfficerPanel .lab-visit-notes textarea:focus {
        outline: none;
        border-color: var(--lop-teal);
        box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.14);
    }

    #labOfficerPanel .lab-visit-notes textarea[readonly] {
        background: #f3f6f9;
        box-shadow: none;
    }

/* ---------- Photo cards ---------- */
#labOfficerPanel .lab-photos {
    gap: 0.6rem;
    margin-top: 0.75rem;
}

#labOfficerPanel .lab-photo-card {
    min-height: 132px;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    border: 2px dashed #c7d6e4;
    border-radius: 18px;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(13, 148, 136, 0.07), transparent 60%),
        #fbfdff;
    transition: border-color 0.25s ease, transform 0.3s var(--lop-ease), box-shadow 0.3s ease, background 0.3s ease;
}

    #labOfficerPanel .lab-photo-card:hover {
        border-color: var(--lop-teal);
        transform: translateY(-2px);
        box-shadow: 0 14px 26px -18px rgba(13, 148, 136, 0.9);
        background:
            radial-gradient(120% 90% at 50% 0%, rgba(13, 148, 136, 0.14), transparent 60%),
            #fff;
    }

    #labOfficerPanel .lab-photo-card > span:not(.lop-photo-ico):not(.lop-photo-ok) {
        padding: 0;
        font-size: 0.74rem;
        color: #1e3a52;
    }

    #labOfficerPanel .lab-photo-card em {
        padding: 0 0.5rem;
        font-size: 0.66rem;
        font-weight: 600;
        color: var(--lop-muted);
    }

#labOfficerPanel .lop-photo-num {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-style: normal;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
    background: var(--lop-navy);
    box-shadow: 0 0 0 2px #fff;
}

#labOfficerPanel .lop-photo-ico {
    padding: 0;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, var(--lop-teal), var(--lop-blue));
    box-shadow: 0 10px 18px -8px rgba(37, 99, 235, 0.65);
    transition: transform 0.4s var(--lop-spring);
}

    #labOfficerPanel .lop-photo-ico svg { width: 22px; height: 22px; }

#labOfficerPanel .lab-photo-card:hover .lop-photo-ico {
    transform: scale(1.1) rotate(-8deg);
}

#labOfficerPanel .lop-photo-ok {
    padding: 0;
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 6px 14px -4px rgba(16, 185, 129, 0.8);
    transform: scale(0);
    transition: transform 0.45s var(--lop-spring);
}

    #labOfficerPanel .lop-photo-ok svg { width: 15px; height: 15px; }

#labOfficerPanel .lab-photo-card img {
    z-index: 1;
    border-radius: 16px;
    animation: lopImg 0.5s var(--lop-ease) both;
}

@keyframes lopImg {
    from { opacity: 0; transform: scale(1.08); }
    to { opacity: 1; transform: none; }
}

#labOfficerPanel .lab-photo-card.has-image {
    border-style: solid;
    border-color: #10b981;
}

    #labOfficerPanel .lab-photo-card.has-image .lop-photo-ok { transform: scale(1); }

    #labOfficerPanel .lab-photo-card.has-image .lop-photo-ico,
    #labOfficerPanel .lab-photo-card.has-image em { opacity: 0; }

    #labOfficerPanel .lab-photo-card.has-image > span:not(.lop-photo-ico):not(.lop-photo-ok) {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 2;
        padding: 1.2rem 0.6rem 0.45rem;
        color: #fff;
        text-shadow: none;
        background: linear-gradient(180deg, transparent, rgba(11, 37, 69, 0.75));
        border-radius: 0 0 16px 16px;
    }

/* ---------- Save ---------- */
#labOfficerPanel .lab-visit-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin: 0.6rem 0 0;
    padding: 0.75rem 0.95rem 0.95rem;
    background: linear-gradient(180deg, rgba(239, 244, 249, 0), rgba(239, 244, 249, 0.96) 35%);
}

/* Keeps the system-wide amber save colour (site.css .amana-save-btn); only size/motion change here. */
#labOfficerPanel #labVisitSave {
    position: relative;
    overflow: hidden;
    width: 100% !important;
    max-width: none !important;
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 15px;
    font-size: 0.95rem;
    box-shadow: 0 14px 26px -14px rgba(180, 83, 9, 0.85);
    transition: transform 0.3s var(--lop-spring), box-shadow 0.3s ease, filter 0.2s ease;
}

    #labOfficerPanel #labVisitSave svg {
        width: 20px;
        height: 20px;
        transition: transform 0.4s var(--lop-spring);
    }

    #labOfficerPanel #labVisitSave:hover:not(:disabled) {
        transform: translateY(-2px);
        filter: brightness(1.05);
        box-shadow: 0 18px 30px -14px rgba(180, 83, 9, 0.95);
    }

        #labOfficerPanel #labVisitSave:hover:not(:disabled) svg { transform: rotate(90deg) scale(1.1); }

    #labOfficerPanel #labVisitSave:active:not(:disabled) { transform: scale(0.97); }

    #labOfficerPanel #labVisitSave::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 40%;
        left: -60%;
        background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
        transform: skewX(-20deg);
        animation: lopShine 3.4s ease-in-out infinite;
        pointer-events: none;
    }

@keyframes lopShine {
    0%, 60% { left: -60%; }
    100% { left: 130%; }
}

#labOfficerPanel #labVisitSave:disabled::after { display: none; }

/* View-only: keep a little breathing room at the bottom */
#labOfficerPanel #labVisitForm.is-view-only .lop-body { padding-bottom: 1rem; }

/* ---------- Phone ---------- */
@media (max-width: 720px) {
    .measure-app.is-lab-officer #labOfficerPanel {
        top: auto;
        bottom: max(8px, env(safe-area-inset-bottom, 0px));
        left: max(8px, env(safe-area-inset-left, 0px));
        right: max(8px, env(safe-area-inset-right, 0px));
        width: auto;
        max-height: min(70dvh, 620px);
        border-radius: 22px;
        animation-name: lopUp;
    }

    #labOfficerPanel .lop-hero { padding: 0.85rem 0.95rem 1rem; }
    #labOfficerPanel .lop-hero-ico { width: 44px; height: 44px; border-radius: 14px; }
    #labOfficerPanel .lab-visit-head h3 { font-size: 1.05rem; }
    #labOfficerPanel .lab-visit-grid { grid-template-columns: 1fr 1fr; }
    #labOfficerPanel .lab-photos { grid-template-columns: 1fr 1fr; }
    #labOfficerPanel .lop-tile input { font-size: 0.95rem; }
}

@keyframes lopUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    #labOfficerPanel,
    #labOfficerPanel * {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }
}
