.afo-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.afo-header {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
    z-index: 10;
}

.afo-back {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(0,0,0,0.4);
    border: none;
    color: white;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}

.afo-header-title {
    color: white;
    font-size: 15px;
    font-weight: 500;
}

/* Permission screens */
.afo-permission-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: white;
    text-align: center;
}

.afo-perm-icon {
    font-size: 56px;
    color: #1a73e8;
    margin-bottom: 8px;
}

.afo-perm-denied { color: #ea4335; }

.afo-perm-title {
    font-size: 20px;
    font-weight: 500;
}

.afo-perm-sub {
    font-size: 14px;
    opacity: 0.6;
    max-width: 260px;
}

.afo-perm-btn {
    margin-top: 16px;
    padding: 12px 32px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

/* Camera */
.afo-camera-wrap {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#afoVideo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Barcode reticle */
.afo-reticle {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 2;
}

.afo-reticle-box {
    position: relative;
    width: 280px;
    height: 140px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.5);
    border-radius: 8px;
    overflow: hidden;
}

.afo-corner {
    position: absolute;
    width: 22px; height: 22px;
    border-color: #1a73e8;
    border-style: solid;
}
.afo-corner-tl { top: 0; left: 0;  border-width: 3px 0 0 3px; border-radius: 4px 0 0 0; }
.afo-corner-tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 4px 0 0; }
.afo-corner-bl { bottom: 0; left: 0;  border-width: 0 0 3px 3px; border-radius: 0 0 0 4px; }
.afo-corner-br { bottom: 0; right: 0; border-width: 0 3px 3px 0; border-radius: 0 0 4px 0; }

.afo-scan-line {
    position: absolute;
    left: 0; right: 0;
    height: 2px;
    background: #1a73e8;
    animation: afo-scan 1.8s ease-in-out infinite;
    box-shadow: 0 0 6px #1a73e8;
}

@keyframes afo-scan {
    0%   { top: 0;   }
    100% { top: 100%; }
}

.afo-reticle-label {
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    background: rgba(0,0,0,0.4);
    padding: 4px 14px;
    border-radius: 20px;
}

.afo-found {
    color: #4caf50;
    font-size: 15px;
}

/* Photo hint */
.afo-photo-hint {
    position: absolute;
    top: 72px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    background: rgba(0,0,0,0.45);
    padding: 6px 18px;
    border-radius: 20px;
    z-index: 2;
    white-space: nowrap;
}

/* Mode pills */
.afo-mode-pills {
    position: absolute;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 3;
}

.afo-pill {
    padding: 7px 18px;
    border-radius: 20px;
    border: 1.5px solid rgba(255,255,255,0.4);
    background: rgba(0,0,0,0.4);
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.afo-pill-active {
    background: #1a73e8;
    border-color: #1a73e8;
    color: white;
}

/* Bottom bar */
.afo-bottom-bar {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 130px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.afo-barcode-bar,
.afo-photo-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.afo-scanning-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-size: 13px;
}

.afo-pulse-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #1a73e8;
    animation: afo-pulse 1.2s ease-in-out infinite;
    display: inline-block;
}

@keyframes afo-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.7); }
}

.afo-hint-text {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
}

/* Shutter buttons */
.afo-shutter {
    width: 68px; height: 68px;
    border-radius: 50%;
    border: 3px solid white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

.afo-shutter:active { transform: scale(0.93); }

.afo-shutter-barcode {
    background: #1a73e8;
    color: white;
    font-size: 22px;
}

.afo-shutter-barcode:disabled {
    opacity: 0.4;
    cursor: default;
}

.afo-shutter-photo {
    background: transparent;
}

.afo-shutter-inner {
    width: 54px; height: 54px;
    border-radius: 50%;
    background: white;
}