/* ============================================
   AGENT DOSSIER
   ============================================ */

/* ── 1. AVATAR CONTAINER — Magnetic Attraction ── */

.agent-avatar-container {
    cursor: pointer;
    position: relative;
    z-index: 50;
}

/* Orbiting ring — subtle, precise */
.agent-avatar-container::after {
    content: '';
    position: absolute;
    inset: -10px;
    border: 1.5px dashed rgba(0, 217, 255, 0.2);
    border-radius: 50%;
    animation: orbitSpin 12s linear infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.agent-avatar-container:hover::after {
    opacity: 1;
    border-color: rgba(0, 217, 255, 0.5);
    animation: orbitSpin 3s linear infinite;
    filter: drop-shadow(0 0 6px rgba(0, 217, 255, 0.3));
}

@keyframes orbitSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ── 2. CHAT BUBBLE — The Hook ── */

.avatar-chat-bubble {
    position: fixed;
    left: var(--bubble-left, 24px);
    top: var(--bubble-top, 24px);
    transform: translateY(6px) scale(0.96);
    width: max-content;
    max-width: min(280px, calc(100vw - 32px));
    padding: 10px 18px;
    background: rgba(6, 14, 30, 0.92);
    border: 1px solid rgba(0, 217, 255, 0.18);
    border-radius: 16px 16px 16px 4px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    letter-spacing: 0.3px;
    color: rgba(180, 210, 255, 0.95);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 51;
    backdrop-filter: blur(12px) saturate(1.6);
    -webkit-backdrop-filter: blur(12px) saturate(1.6);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(0, 217, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Top accent line */
.avatar-chat-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.4), transparent);
    border-radius: 1px;
}

.avatar-chat-bubble.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: gentleFloat 3s ease-in-out infinite;
}

/* Tail / Pointer */
.chat-tail {
    position: absolute;
    left: 50%;
    top: calc(100% - 1px);
    transform: translateX(-50%) rotate(135deg);
    width: 8px;
    height: 8px;
    background: rgba(6, 14, 30, 0.92);
    border-top: 1px solid rgba(0, 217, 255, 0.18);
    border-right: 1px solid rgba(0, 217, 255, 0.18);
    z-index: 1;
}

.avatar-chat-bubble.place-left .chat-tail {
    left: auto;
    right: -5px;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.avatar-chat-bubble.place-right .chat-tail {
    left: -5px;
    right: auto;
    top: 50%;
    transform: translateY(-50%) rotate(225deg);
}

.avatar-chat-bubble.place-left.visible,
.avatar-chat-bubble.place-right.visible {
    animation: none;
}

@keyframes gentleFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-3px) scale(1);
    }
}

.chat-text {
    position: relative;
    z-index: 2;
}

/* ── 3. DOSSIER PANEL — The Card ── */

.agent-dossier-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    width: clamp(540px, 92vw, 680px);
    height: 440px;
    background: linear-gradient(145deg,
            rgba(8, 14, 30, 0.97) 0%,
            rgba(4, 10, 22, 0.98) 100%);
    backdrop-filter: blur(40px) saturate(1.4);
    -webkit-backdrop-filter: blur(40px) saturate(1.4);
    border: 1px solid rgba(0, 217, 255, 0.12);
    border-radius: 20px;
    box-shadow:
        0 40px 80px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(255, 255, 255, 0.03),
        0 0 60px rgba(0, 217, 255, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    padding: 0;
    overflow: hidden;
}

.agent-dossier-panel.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: all;
}

/* Backdrop */
.dossier-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.dossier-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

/* Inner container */
.id-card-container {
    display: flex;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 15% 30%, rgba(0, 217, 255, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 70%, rgba(0, 140, 255, 0.02) 0%, transparent 50%);
}

/* ── 4. LEFT COLUMN — Photo Side ── */

.id-card-left {
    width: 210px;
    min-width: 210px;
    background: rgba(0, 8, 18, 0.5);
    border-right: 1px solid rgba(0, 217, 255, 0.08);
    padding: 28px 20px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    position: relative;
}

/* Photo Frame */
.photo-frame-tech {
    width: 150px;
    height: 170px;
    position: relative;
    border: 1px solid rgba(0, 217, 255, 0.2);
    border-radius: 12px;
    margin-bottom: 16px;
    background: #000;
    overflow: hidden;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.5),
        inset 0 0 0 1px rgba(0, 217, 255, 0.05);
}

.photo-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center 30%;
}

.real-photo {
    opacity: 1;
    z-index: 2;
    filter: contrast(1.05) brightness(0.92);
}

.pixel-avatar {
    opacity: 0;
    z-index: 3;
    image-rendering: pixelated;
    object-position: top center;
    transform: scale(0.9);
    filter: blur(3px);
}

/* Pixel Mode Transitions */
.photo-frame-tech.pixel-mode .real-photo {
    opacity: 0;
    transform: scale(1.08);
    filter: blur(6px) brightness(0.6);
}

.photo-frame-tech.pixel-mode .pixel-avatar {
    opacity: 1;
    transform: scale(1.35) translateY(8px);
    filter: blur(0);
}

/* Hologram sweep */
.hologram-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
            transparent 30%,
            rgba(0, 217, 255, 0.08) 50%,
            transparent 70%);
    background-size: 300% 300%;
    animation: holoSweep 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 4;
}

@keyframes holoSweep {
    0% {
        background-position: 100% 100%;
    }

    50% {
        background-position: 0% 0%;
    }

    100% {
        background-position: 100% 100%;
    }
}

/* ── Filler Stats ── */

.tech-stats-mini {
    width: 100%;
    padding: 0 4px;
    margin-bottom: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.6rem;
    color: rgba(0, 217, 255, 0.45);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.stat-bar {
    width: 65px;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d9ff, #0090ff);
    border-radius: 3px;
    animation: fillPulse 2.5s ease-in-out infinite;
}

.stat-val {
    font-weight: 600;
    color: rgba(0, 217, 255, 0.7);
}

.stat-val.blinking {
    animation: softBlink 2s ease-in-out infinite;
}

@keyframes fillPulse {

    0%,
    100% {
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }
}

@keyframes softBlink {

    0%,
    100% {
        opacity: 0.7;
    }

    50% {
        opacity: 0.3;
    }
}

/* ── Transform Button ── */

.transform-toggle {
    width: 140px;
    padding: 9px 14px;
    margin-bottom: 36px;
    background: rgba(0, 217, 255, 0.04);
    border: 1px solid rgba(0, 217, 255, 0.15);
    border-radius: 8px;
    color: rgba(0, 217, 255, 0.7);
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.transform-toggle:hover {
    background: rgba(0, 217, 255, 0.1);
    border-color: rgba(0, 217, 255, 0.4);
    color: #00d9ff;
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.1);
}

.transform-toggle:active {
    transform: scale(0.97);
}

.btn-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.btn-shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
    transform: translateX(-100%) skewX(-15deg);
    transition: transform 0.6s ease;
    z-index: 1;
}

.transform-toggle:hover .btn-shine {
    transform: translateX(100%) skewX(-15deg);
}

/* Barcode */
.id-barcode {
    position: absolute;
    bottom: 16px;
    left: 24px;
    right: 24px;
    height: 10px;
    background: repeating-linear-gradient(90deg,
            rgba(255, 255, 255, 0.15) 0px, rgba(255, 255, 255, 0.15) 1px,
            transparent 1px, transparent 3px);
    opacity: 0.3;
    border-radius: 1px;
}

/* ── 5. RIGHT COLUMN — Info & Story ── */

.id-card-right {
    flex: 1;
    padding: 28px 30px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.id-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    padding-bottom: 12px;
    padding-right: 32px;
    /* Clear close button */
    border-bottom: 1px solid rgba(0, 217, 255, 0.08);
}

.corp-name {
    font-family: 'Share Tech Mono', monospace;
    color: rgba(0, 217, 255, 0.6);
    font-size: 0.8rem;
    letter-spacing: 2.5px;
    font-weight: 600;
}

.clearance-badge {
    padding: 3px 10px;
    border: 1px solid rgba(0, 217, 255, 0.15);
    border-radius: 4px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 1.5px;
    color: rgba(0, 217, 255, 0.5);
    background: rgba(0, 217, 255, 0.03);
}

/* ID Details Grid */
.id-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 22px;
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-row .label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.55rem;
    color: rgba(0, 217, 255, 0.35);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.detail-row .value {
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* ── Story Log ── */

.dossier-content {
    flex: 1;
    overflow-y: auto;
    padding-right: 6px;
    display: flex;
    flex-direction: column;
}

.dossier-content::-webkit-scrollbar {
    width: 2px;
}

.dossier-content::-webkit-scrollbar-track {
    background: transparent;
}

.dossier-content::-webkit-scrollbar-thumb {
    background: rgba(0, 217, 255, 0.15);
    border-radius: 2px;
}

.dossier-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.55;
    color: rgba(190, 210, 240, 0.8);
}

.dossier-text .dossier-line {
    opacity: 0;
    margin-bottom: 5px;
    position: relative;
    display: block;
    animation: lineReveal 0.35s ease-out forwards;
    padding-left: 14px;
}

.dossier-text .dossier-line.paragraph-break {
    margin-bottom: 10px;
    height: 0;
    padding-left: 0;
}

.dossier-text .dossier-line:not(.paragraph-break)::before {
    content: '›';
    position: absolute;
    left: 0;
    color: rgba(0, 217, 255, 0.4);
    font-weight: 700;
}

@keyframes lineReveal {
    from {
        opacity: 0;
        transform: translateX(4px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── 6. CLOSE BUTTON — Elegant ── */

.dossier-close.square-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
}

.dossier-close.square-close:hover {
    background: rgba(255, 80, 80, 0.1);
    border-color: rgba(255, 80, 80, 0.25);
    color: rgba(255, 100, 100, 0.9);
    transform: scale(1.05);
}

.dossier-close.square-close:active {
    transform: scale(0.95);
}

.close-icon {
    font-size: 16px;
    line-height: 1;
    font-family: -apple-system, system-ui, sans-serif;
    font-weight: 300;
}

/* ── 7. RESPONSIVE ── */

@media (max-width: 700px) {
    .agent-dossier-panel {
        width: 94vw;
        height: auto;
        max-height: 85vh;
        border-radius: 16px;
    }

    .id-card-container {
        flex-direction: column;
    }

    .id-card-left {
        width: 100%;
        min-width: unset;
        flex-direction: row;
        padding: 20px;
        gap: 16px;
        border-right: none;
        border-bottom: 1px solid rgba(0, 217, 255, 0.08);
    }

    .photo-frame-tech {
        width: 80px;
        height: 90px;
        margin-bottom: 0;
    }

    .tech-stats-mini {
        display: none;
    }

    .id-barcode {
        display: none;
    }

    .transform-toggle {
        margin-bottom: 0;
        width: auto;
        padding: 7px 16px;
    }

    .id-card-right {
        padding: 20px;
        max-height: 320px;
    }

    .dossier-close.square-close {
        top: 12px;
        right: 12px;
    }
}

@media (max-width: 980px) {
    .avatar-chat-bubble {
        min-width: 180px;
        max-width: min(260px, calc(100vw - 24px));
    }

    .avatar-chat-bubble.visible {
        animation: none;
    }

    .chat-tail,
    .avatar-chat-bubble.place-left .chat-tail,
    .avatar-chat-bubble.place-right .chat-tail {
        left: 50%;
        right: auto;
        top: calc(100% - 1px);
        transform: translateX(-50%) rotate(135deg);
    }
}

@media (max-width: 650px) {
    .avatar-chat-bubble {
        display: none;
    }
}