/* ==========================================================================
   ZERO CORE PRESENCE LAYER - TOKYO CYBERPUNK THEME
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-dark: #09090b; /* Very dark slate, almost black */
    --bg-panel: rgba(24, 24, 27, 0.7); /* Translucent dark gray */
    --border-color: rgba(63, 63, 70, 0.5);
    
    /* Neon Accents */
    --neon-blue: #00f0ff;
    --neon-purple: #b026ff;
    --neon-pink: #ff0055;
    
    /* Status Colors */
    --status-green: #39ff14;
    --status-yellow: #ffea00;
    --status-red: #ff2a2a;
    --status-gray: #6b7280;
    
    /* Text */
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    
    /* Fonts */
    --font-main: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    /* Subtle background grid */
    background-image: 
        linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* --- UTILITIES --- */
.hidden { display: none !important; }
.screen { height: 100vh; width: 100vw; position: absolute; top: 0; left: 0; transition: opacity 0.3s ease; }
.screen:not(.active) { opacity: 0; pointer-events: none; z-index: -1; }
.screen.active { opacity: 1; z-index: 1; }

.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.neon-text {
    color: var(--neon-blue);
    text-shadow: 0 0 5px rgba(0, 240, 255, 0.5), 0 0 20px rgba(0, 240, 255, 0.3);
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 8px currentColor;
}
.status-dot.green { color: var(--status-green); background-color: var(--status-green); }
.status-dot.yellow { color: var(--status-yellow); background-color: var(--status-yellow); }
.status-dot.red { color: var(--status-red); background-color: var(--status-red); }
.status-dot.gray { color: var(--status-gray); background-color: var(--status-gray); box-shadow: none;}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(57, 255, 20, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(57, 255, 20, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(57, 255, 20, 0); }
}
.pulse { animation: pulse 2s infinite; }

/* --- LOGIN SCREEN --- */
#login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-container {
    padding: 3rem;
    border-radius: 12px;
    width: 400px;
    text-align: center;
    border-top: 2px solid var(--neon-blue);
}

.login-logo {
    margin-bottom: 2rem;
}

.login-logo i { font-size: 3rem; margin-bottom: 1rem; }
.login-logo h1 { font-weight: 800; letter-spacing: 2px; }
.login-logo .light { font-weight: 300; color: var(--text-main); text-shadow: none; }
.login-logo p { font-family: var(--font-mono); font-size: 0.8rem; color: var(--neon-purple); letter-spacing: 3px; margin-top: 5px; }

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--neon-blue);
}

.input-group input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-family: var(--font-mono);
    outline: none;
    transition: all 0.3s;
}

.input-group input:focus {
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
}

.cyber-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--neon-blue);
    color: var(--neon-blue);
    font-family: var(--font-mono);
    font-weight: bold;
    letter-spacing: 1px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
}

.cyber-btn:hover {
    background: var(--neon-blue);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.5);
}

.cyber-btn.primary {
    background: rgba(176, 38, 255, 0.1);
    border-color: var(--neon-purple);
    color: var(--neon-purple);
}
.cyber-btn.primary:hover {
    background: var(--neon-purple);
    color: #fff;
    box-shadow: 0 0 20px rgba(176, 38, 255, 0.6);
}

.cyber-btn.outline.active {
    background: rgba(57, 255, 20, 0.1);
    border-color: var(--status-green);
    color: var(--status-green);
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
}

.error-msg {
    margin-top: 15px;
    color: var(--status-red);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: rgba(255, 42, 42, 0.1);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 42, 42, 0.3);
}

/* --- DASHBOARD LAYOUT --- */
#dashboard-screen {
    display: flex;
    padding: 15px;
    gap: 15px;
}

/* Sidebar */
.sidebar {
    width: 280px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    border-left: 2px solid var(--neon-purple);
    height: 100%;
}

.brand {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.brand h2 { font-weight: 800; letter-spacing: 1px; }

/* Sidebar sections share available height equally */
.sidebar-section {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.sidebar-section h3 {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    margin-bottom: 10px;
    letter-spacing: 1px;
    flex-shrink: 0;
}

/* Avatar and feed each take 50% of sidebar height */
.avatar-section {
    flex: 1;
    min-height: 0;
}
.event-feed-section {
    flex: 1;
    min-height: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding: 15px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Top Bar */
.top-bar {
    border-radius: 12px;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    border-top: 2px solid var(--neon-blue);
}
.tunnel-info { color: var(--text-muted); }

/* Chat Container */
.chat-container {
    flex: 1;
    border-radius: 12px;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 8px;
    line-height: 1.5;
    font-size: 0.95rem;
}
.message.system {
    align-self: center;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}
.message.user {
    align-self: flex-end;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-right: 3px solid var(--neon-blue);
}
.message.zero {
    align-self: flex-start;
    background: rgba(176, 38, 255, 0.1);
    border: 1px solid rgba(176, 38, 255, 0.3);
    border-left: 3px solid var(--neon-purple);
}

/* Controls */
.controls-container {
    border-radius: 12px;
    padding: 15px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.voice-controls {
    display: flex;
    gap: 10px;
}

.voice-controls .cyber-btn {
    width: auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-input-wrapper {
    flex: 1;
    display: flex;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.chat-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 15px;
    color: var(--text-main);
    outline: none;
    font-family: var(--font-mono);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0 20px;
    cursor: pointer;
    transition: color 0.3s;
}
.icon-btn:hover { color: var(--neon-blue); }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--neon-blue); }

/* AVATAR CORE STYLES */
.avatar-section {
    text-align: center;
}
.avatar-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--neon-blue);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
    transition: all 0.4s ease;
    flex-shrink: 0;
}
.avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.avatar-status {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: var(--neon-blue);
    font-size: 0.7rem;
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid var(--neon-blue);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

/* EVENT FEED STYLES */
.event-feed-section {
    display: flex;
    flex-direction: column;
}
.event-feed-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
}
.event-item {
    margin-bottom: 5px;
    color: #a0aec0;
    line-height: 1.4;
}
.event-item .event-time {
    color: var(--neon-blue);
    margin-right: 5px;
}

/* TOGGLE MIC STYLES */
#ptt-btn.recording {
    background-color: transparent;
    border: 2px solid var(--neon-red);
    color: var(--neon-red);
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
    animation: pulse-red 1s infinite;
}
@keyframes pulse-red {
    0% { box-shadow: 0 0 10px rgba(255,0,0,0.3); }
    50% { box-shadow: 0 0 20px rgba(255,0,0,0.8); }
    100% { box-shadow: 0 0 10px rgba(255,0,0,0.3); }
}

/* MULTIMODAL IMAGE STYLES */
#image-preview-container {
    margin-top: 10px;
    display: flex;
    justify-content: flex-start;
}
#image-preview-container.hidden {
    display: none;
}
.preview-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    border: 1px solid var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
}
#image-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
#remove-image-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--neon-red);
    color: var(--neon-red);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
    transition: all 0.2s ease;
}
#remove-image-btn:hover {
    background: var(--neon-red);
    color: #000;
}

/* Chat Attached Images */
.chat-attached-image {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-top: 8px;
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chat-attached-image:hover {
    transform: scale(1.02);
    box-shadow: 0 0 15px var(--neon-blue);
    border-color: var(--neon-blue);
}

/* Fullscreen Modal */
#image-modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}
#image-modal.modal-hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}
#modal-img {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
    border: 2px solid var(--neon-blue);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.6);
    border-radius: 6px;
}
.modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}
.modal-close:hover {
    color: var(--neon-red);
}
