/* ========================================
   CHAT PAGE — PAGE-SPECIFIC STYLES
   Industrial Vintage Futuristic Theme
   ======================================== */

:root {
    --chat-bg: var(--bg-base, #050505);
    --chat-overlay: linear-gradient(
        180deg,
        rgba(10, 10, 15, 0.85) 0%,
        rgba(10, 10, 15, 0.5) 30%,
        rgba(10, 10, 15, 0.5) 70%,
        rgba(10, 10, 15, 0.9) 100%
    );
    --chat-glow: radial-gradient(
        ellipse at 50% 30%,
        rgba(255, 0, 90, 0.08) 0%,
        transparent 50%
    );
    --chat-module-bg: linear-gradient(135deg, #0b0b10 0%, #0f0f14 100%);
    --chat-module-border: #333;
    --chat-module-shadow: 0 0 0 1px #222, 0 8px 24px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.03);
    --chat-screw: #1a1a1a;
    --chat-screw-shadow: inset 0 1px 1px rgba(0,0,0,0.8);
    --chat-display-bg: #0a100a;
    --chat-display-border: #222;
    --chat-display-shadow: inset 0 0 15px rgba(0,0,0,0.8);
    --chat-ink: #33ff33;
    --chat-ink-muted: #4a6a4a;
    --chat-ink-glow: rgba(51, 255, 51, 0.5);
    --chat-ink-glow-strong: rgba(51, 255, 51, 0.8);
    --chat-divider: rgba(0, 255, 100, 0.1);
    --chat-ink-ring: rgba(51, 255, 51, 0.6);
    --chat-scanline: rgba(0, 255, 100, 0.05);
    --chat-scanline-overlay: rgba(0, 0, 0, 0.03);
    --chat-mute-bg: linear-gradient(180deg, #1a1a1a 0%, #0d0d0d 100%);
    --chat-mute-bg-hover: linear-gradient(180deg, #222 0%, #111 100%);
    --chat-mute-border: #2a2a2a;
    --chat-mute-border-hover: #3a3a3a;
    --chat-mute-border-top: #333;
    --chat-mute-border-bottom: #111;
    --chat-led: #33ff33;
    --chat-led-glow: rgba(51, 255, 51, 0.6);
    --chat-alert: #ff4444;
    --chat-alert-soft: #ff6666;
    --chat-alert-glow: rgba(255, 68, 68, 0.5);
}

[data-theme="light"] {
    --chat-bg: var(--bg-base, #faf8f5);
    --chat-overlay: linear-gradient(
        180deg,
        rgba(250, 248, 245, 0.7) 0%,
        rgba(250, 248, 245, 0.4) 30%,
        rgba(250, 248, 245, 0.35) 70%,
        rgba(250, 248, 245, 0.85) 100%
    );
    --chat-glow: radial-gradient(
        ellipse at 50% 30%,
        rgba(255, 51, 102, 0.12) 0%,
        transparent 55%
    );
    --chat-module-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 242, 237, 0.92) 100%);
    --chat-module-border: var(--border-color, #e0d8cc);
    --chat-module-shadow: 0 0 0 1px rgba(26,24,22,0.12), 0 8px 24px rgba(26,24,22,0.16), inset 0 1px 0 rgba(255,255,255,0.6);
    --chat-screw: #c9c2b8;
    --chat-screw-shadow: inset 0 1px 1px rgba(26,24,22,0.4);
    --chat-display-bg: #101a14;
    --chat-display-border: #1e2a22;
    --chat-display-shadow: inset 0 0 12px rgba(16, 26, 20, 0.6);
    --chat-ink: #22c55e;
    --chat-ink-muted: #1f7a4c;
    --chat-ink-glow: rgba(34, 197, 94, 0.5);
    --chat-ink-glow-strong: rgba(34, 197, 94, 0.8);
    --chat-divider: rgba(34, 197, 94, 0.2);
    --chat-ink-ring: rgba(34, 197, 94, 0.6);
    --chat-scanline: rgba(34, 197, 94, 0.08);
    --chat-scanline-overlay: rgba(0, 0, 0, 0.05);
    --chat-mute-bg: linear-gradient(180deg, #f0ebe3 0%, #e6dfd6 100%);
    --chat-mute-bg-hover: linear-gradient(180deg, #eae3da 0%, #dfd6cc 100%);
    --chat-mute-border: #d0c7bc;
    --chat-mute-border-hover: #c2b8ac;
    --chat-mute-border-top: #d8cfc4;
    --chat-mute-border-bottom: #c0b6ab;
    --chat-led: #22c55e;
    --chat-led-glow: rgba(34, 197, 94, 0.5);
    --chat-alert: #f43f5e;
    --chat-alert-soft: #ff7b8f;
    --chat-alert-glow: rgba(244, 63, 94, 0.45);
}

/* ========================================
   FULLSCREEN VIDEO BACKGROUND
   ======================================== */
#video-section {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background-color: var(--chat-bg);
}

#background-video {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    object-fit: cover;
    z-index: 1;
    filter: grayscale(0.3) contrast(1.1);
}

/* Cinematic overlay with gradient */
#video-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--chat-overlay);
    z-index: 2;
}

/* Accent glow overlay */
#video-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--chat-glow);
    z-index: 2;
    pointer-events: none;
}

/* ========================================
   CHAT CONTAINER
   ======================================== */
#chat-container {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 80px var(--space-md, 1rem) var(--space-lg, 1.5rem);
}

/* ========================================
   ELFSIGHT WIDGET WRAPPER
   ======================================== */
.chat-widget-wrapper {
    width: 100%;
    max-width: 800px;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.elfsight-app {
    width: 100%;
    height: 100%;
    border: none;
}

/* ========================================
   INDUSTRIAL AGENT STATUS MODULE
   ======================================== */
.agent-module {
    position: relative;
    background: var(--chat-module-bg);
    border: 1px solid var(--chat-module-border);
    border-radius: 4px;
    padding: 12px 24px;
    margin-top: var(--space-md, 1rem);
    width: min(420px, 90vw);
    box-shadow: var(--chat-module-shadow);
}

/* Hardware Screws */
.module-screw {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--chat-screw);
    border-radius: 50%;
    box-shadow: var(--chat-screw-shadow);
}
.module-screw.tl { top: 6px; left: 6px; }
.module-screw.tr { top: 6px; right: 6px; }
.module-screw.bl { bottom: 6px; left: 6px; }
.module-screw.br { bottom: 6px; right: 6px; }

/* Status Display (Pager Style) */
.status-display {
    position: relative;
    background: var(--chat-display-bg);
    border: 2px solid var(--chat-display-border);
    border-radius: 2px;
    padding: 10px 14px;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    box-shadow: var(--chat-display-shadow);
    overflow: hidden;
}

.display-scanline {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, transparent 95%, var(--chat-scanline) 100%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 1;
}

/* Status Rows */
.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 2;
}

.status-row.main-row {
    padding: 8px 0;
    margin: 6px 0;
    border-top: 1px solid var(--chat-divider);
    border-bottom: 1px solid var(--chat-divider);
}

.status-label {
    font-size: 0.65rem;
    color: var(--chat-ink-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.status-value {
    font-size: 0.7rem;
    color: var(--chat-ink);
    letter-spacing: 0.1em;
    text-shadow: 0 0 6px var(--chat-ink-glow);
}

.status-timestamp {
    font-size: 0.75rem;
    color: var(--chat-ink);
    letter-spacing: 0.15em;
    text-shadow: 0 0 8px var(--chat-ink-glow);
}

.pulse-text {
    animation: text-pulse 2s ease-in-out infinite;
}

@keyframes text-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Signal Bars */
.signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 14px;
}

.signal-bars .bar {
    width: 3px;
    background: var(--chat-ink);
    border-radius: 1px;
    box-shadow: 0 0 4px var(--chat-ink-glow);
    animation: signal-wave 1.5s ease-in-out infinite;
}

.signal-bars .bar:nth-child(1) { height: 4px; animation-delay: 0s; }
.signal-bars .bar:nth-child(2) { height: 7px; animation-delay: 0.1s; }
.signal-bars .bar:nth-child(3) { height: 10px; animation-delay: 0.2s; }
.signal-bars .bar:nth-child(4) { height: 14px; animation-delay: 0.3s; }

@keyframes signal-wave {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Agent Text */
.agent-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--chat-ink);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-shadow: 
        0 0 10px var(--chat-ink-glow-strong),
        0 0 20px var(--chat-ink-glow);
}

/* Pulse Core (animated connection indicator) */
.pulse-core {
    position: relative;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.core-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-ink);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--chat-ink);
    z-index: 2;
}

.core-ring {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 1px solid var(--chat-ink-ring);
    border-radius: 50%;
    animation: ring-expand 2s ease-out infinite;
}

@keyframes ring-expand {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ========================================
   SCANLINE EFFECT
   ======================================== */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        var(--chat-scanline-overlay) 0px,
        var(--chat-scanline-overlay) 1px,
        transparent 1px,
        transparent 2px
    );
    z-index: 4;
    pointer-events: none;
    opacity: 0.5;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    #chat-container {
        padding-top: 100px;
        padding-bottom: 80px;
    }
    
    .agent-module {
        width: 95vw;
        padding: 10px 16px;
        margin-bottom: 70px;
    }
    
    .agent-text {
        font-size: 0.7rem;
        letter-spacing: 0.12em;
    }
    
    .status-display {
        padding: 8px 10px;
    }
}

/* ========================================
   MUTE BUTTON CONTROL - INDUSTRIAL TOGGLE
   ======================================== */
.mute-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--chat-divider);
}

.mute-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--chat-mute-bg);
    border: 1px solid var(--chat-mute-border);
    border-top-color: var(--chat-mute-border-top);
    border-bottom-color: var(--chat-mute-border-bottom);
    border-radius: 2px;
    padding: 4px 10px 4px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.04),
        inset 0 -1px 0 rgba(0,0,0,0.3),
        0 2px 4px rgba(0,0,0,0.4);
}

.mute-btn:hover {
    background: var(--chat-mute-bg-hover);
    border-color: var(--chat-mute-border-hover);
}

.mute-btn:active {
    transform: translateY(1px);
    box-shadow: 
        inset 0 1px 0 rgba(0,0,0,0.2),
        inset 0 -1px 0 rgba(255,255,255,0.02),
        0 1px 2px rgba(0,0,0,0.3);
}

/* LED Indicator */
.led-indicator {
    width: 6px;
    height: 6px;
    background: var(--chat-led);
    border-radius: 50%;
    box-shadow: 
        0 0 4px var(--chat-led),
        0 0 8px var(--chat-led-glow),
        inset 0 -1px 2px rgba(0,0,0,0.3);
    animation: led-pulse 1.5s ease-in-out infinite;
}

@keyframes led-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px var(--chat-led), 0 0 8px var(--chat-led-glow); }
    50% { opacity: 0.7; box-shadow: 0 0 2px var(--chat-led), 0 0 4px var(--chat-ink-glow); }
}

.mute-btn.muted .led-indicator {
    background: var(--chat-alert);
    box-shadow: 
        0 0 4px var(--chat-alert),
        0 0 8px var(--chat-alert-glow),
        inset 0 -1px 2px rgba(0,0,0,0.3);
    animation: none;
}

.mute-text {
    font-size: 0.6rem;
    color: var(--chat-ink);
    letter-spacing: 0.12em;
    font-weight: 600;
    text-shadow: 0 0 6px var(--chat-ink-glow);
    text-transform: uppercase;
}

.mute-btn.muted .mute-text {
    color: var(--chat-alert-soft);
    text-shadow: 0 0 6px var(--chat-alert-glow);
}
