@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Orbitron:wght@400;700;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-red: #cc0000;
    --dark-red: #990000;
    --bright-red: #ff0000;
    --bg-black: #000000;
    --bg-panel: #0a0a0a;
    --bg-deep: #050505;
    --text-white: #ffffff;
    --text-light: rgba(255, 255, 255, 0.75);
    --text-gray: rgba(255, 255, 255, 0.45);
    --text-dim: rgba(255, 255, 255, 0.2);
    --border-gray: rgba(255, 255, 255, 0.08);
    --border-light: rgba(255, 255, 255, 0.15);
}

body {
    background: var(--bg-black);
    font-family: 'Space Mono', monospace;
    height: 100vh;
    overflow: hidden;
    color: var(--text-white);
}

/* Subtle scanline overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.08) 0px,
        rgba(0, 0, 0, 0.08) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1000;
    opacity: 0.4;
}

.logo {
    position: absolute;
    top: 30px;
    left: 30px;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-dim);
    z-index: 100;
}

.main-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 0 30px;
}

/* ==================== CHAT SIDEBAR ==================== */

.chat-sidebar {
    width: 350px;
    height: 600px;
    background: var(--bg-panel);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.chat-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-gray);
}

.clear-chat {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.clear-chat:hover {
    opacity: 1;
    color: var(--primary-red);
    transform: rotate(90deg);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 2px; }

.message {
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-time {
    font-family: 'Orbitron', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-gray);
}

/* All message labels in grey — no blue, no green */
.message.system .message-time { color: var(--text-dim); }
.message.user .message-time    { color: var(--text-gray); }
.message.assistant .message-time { color: rgba(180, 180, 180, 0.7); }

.message-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-white);
}

.message.system .message-text {
    color: var(--text-gray);
    font-style: italic;
}

.message.user .message-text {
    color: var(--text-light);
}

.message.assistant .message-text {
    color: var(--text-white);
}

.message-attachment {
    margin-top: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-gray);
    border-radius: 2px;
    font-size: 12px;
}

.message-attachment img {
    max-width: 100%;
    border-radius: 2px;
    margin-top: 8px;
}

/* Upload + Intel Report buttons */
.upload-documents button,
.upload-documents a {
    border-radius: 2px !important;
    font-family: 'Space Mono', monospace !important;
    letter-spacing: 1px !important;
    transition: all 0.2s ease !important;
}

.upload-documents button:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
}

.upload-documents a:hover {
    background: rgba(204, 0, 0, 0.15) !important;
    border-color: var(--primary-red) !important;
}

.chat-input-container {
    padding: 16px 20px;
    border-top: 1px solid var(--border-gray);
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.4);
    align-items: flex-end;
}

.input-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.attach-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-gray);
    background: transparent;
    color: var(--text-gray);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.attach-button:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-light);
    color: var(--text-light);
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 0 16px;
    color: var(--text-white);
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.chat-input:focus {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.2);
}

.chat-input::placeholder { color: var(--text-dim); }

.send-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--primary-red);
    background: rgba(204, 0, 0, 0.12);
    color: var(--primary-red);
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.send-button:hover {
    background: var(--primary-red);
    color: var(--text-white);
    transform: translateX(2px);
}

/* ==================== VIDEO CIRCLES ==================== */

.video-container {
    display: flex;
    gap: 35px;
    align-items: center;
    justify-content: center;
}

.circle-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

#userCircle video {
    filter: grayscale(0.3) contrast(1.1) brightness(1.05);
}

#userCircle {
    width: 240px;
    height: 240px;
}

.circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: #080808;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 60px rgba(0, 0, 0, 0.9),
        inset 0 0 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.default-avatar {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    background: radial-gradient(circle, #141414, #000000);
}

.agent-circle .default-avatar {
    font-size: 60px;
}

/* ALL agent images */
#tyrellImage,
#rachaelImage,
#royImage,
#sebastianImage {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    filter: grayscale(0.15) contrast(1.05);
}

#tyrellImage.visible,
#rachaelImage.visible,
#royImage.visible,
#sebastianImage.visible {
    display: block !important;
}

#tyrellImage.visible ~ .default-avatar,
#rachaelImage.visible ~ .default-avatar,
#royImage.visible ~ .default-avatar,
#sebastianImage.visible ~ .default-avatar {
    display: none !important;
}

/* ==================== PULSE RINGS ==================== */

.pulse-rings {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.pulse-rings.active { opacity: 1; }

.pulse-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 2px solid var(--primary-red);
    animation: pulse-wave 2s ease-out infinite;
}

.pulse-ring:nth-child(2) { animation-delay: 0.4s; }
.pulse-ring:nth-child(3) { animation-delay: 0.8s; }

@keyframes pulse-wave {
    0%   { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(1.25); opacity: 0; }
}

.circle-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 5px;
    color: var(--text-dim);
}

.agent-circle {
    cursor: pointer;
    transition: all 0.3s ease;
}

.agent-circle:hover {
    border-color: rgba(255, 255, 255, 0.12) !important;
}

.agent-circle.active {
    border: 2px solid rgba(204, 0, 0, 0.6);
    box-shadow:
        0 0 30px rgba(204, 0, 0, 0.15),
        0 0 60px rgba(0, 0, 0, 0.9);
}

/* ==================== PUSH TO TALK ==================== */

.controls {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.talk-button {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    position: relative;
    background: transparent;
    transition: all 0.3s ease;
}

.button-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, #e8e8e8, #b0b0b0);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.6),
        inset 0 1px 3px rgba(255, 255, 255, 0.3),
        inset 0 -2px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.button-rings {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.talk-button:hover .button-rings,
.talk-button.active .button-rings { opacity: 1; }

.button-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.talk-button.active .button-ring {
    animation: button-pulse 1.5s ease-out infinite;
    border-color: var(--primary-red);
}

.button-ring:nth-child(2) { animation-delay: 0.3s; }
.button-ring:nth-child(3) { animation-delay: 0.6s; }

@keyframes button-pulse {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

.button-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    z-index: 10;
    pointer-events: none;
}

.button-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 7px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #1a1a1a;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

/* Active/speaking state — button goes red */
.talk-button:active .button-core,
.talk-button.active .button-core {
    background: radial-gradient(circle, var(--bright-red), var(--dark-red));
    box-shadow:
        0 0 40px rgba(204, 0, 0, 0.5),
        0 0 80px rgba(204, 0, 0, 0.2),
        inset 0 -2px 8px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -50%) scale(0.95);
}

.talk-button:active .button-text,
.talk-button.active .button-text { color: #ffffff; }

.talk-button:hover .button-core {
    background: radial-gradient(circle, #ffffff, #cccccc);
    box-shadow:
        0 10px 28px rgba(0, 0, 0, 0.7),
        inset 0 1px 3px rgba(255, 255, 255, 0.4);
    transform: translate(-50%, -50%) scale(1.05);
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 1600px) {
    .circle { width: 185px; height: 185px; }
    #userCircle { width: 220px; height: 220px; }
    .chat-sidebar { width: 300px; height: 550px; }
    .video-container { gap: 25px; }
}

@media (max-width: 1400px) {
    .circle { width: 165px; height: 165px; }
    #userCircle { width: 200px; height: 200px; }
    .video-container { gap: 20px; }
    .default-avatar { font-size: 60px; }
    .agent-circle .default-avatar { font-size: 50px; }
}

@media (max-width: 1200px) {
    .circle { width: 145px; height: 145px; }
    #userCircle { width: 180px; height: 180px; }
    .video-container { gap: 15px; }
    .chat-sidebar { width: 280px; }
}
