/* ============================================
   NIKA Hug: Unity WebGL Glassmorphism Theme
   ============================================ */

:root {
    --bg-dark: #fff8f5; 
    --primary: #ff7e93; 
    --secondary: #ffb4a2; 
    --text-main: #332d2d;
    --text-muted: #827578;
    --font-main: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden; /* No scroll, Canvas takes full screen */
}

/* 1. Interactive Container Layout (Simulating Unity) */
#unity-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    background: 
        radial-gradient(circle at 50% 50%, rgba(255, 126, 147, 0.1) 0%, rgba(255, 255, 255, 1) 100%),
        #fff8f5;
}

/* 3D Mind Background */
#mind-background-3d {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    pointer-events: none; /* Allow clicks to pass through to particles if needed, but usually 3D consumes */
}

#mind-background-3d canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Mouse Interactive Aura */
.mouse-aura {
    position: absolute;
    top: 0;
    left: 0;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255, 126, 147, 0.2) 0%, rgba(255, 180, 162, 0.1) 40%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 5;
    filter: blur(25px);
    transition: width 0.3s, height 0.3s, opacity 0.3s;
    mix-blend-mode: multiply;
}
.mouse-aura.clicking {
    width: 450px;
    height: 450px;
    opacity: 0.8;
    background: radial-gradient(circle, rgba(255, 126, 147, 0.35) 0%, rgba(255, 180, 162, 0.15) 50%, transparent 80%);
}

/* Unity Loading Screen (Fake) */
#unity-loading-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
    transition: opacity 0.5s;
}

#unity-logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 20px;
    letter-spacing: 2px;
}

#unity-progress-bar-empty {
    width: 300px;
    height: 8px;
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto 10px auto;
}

#unity-progress-bar-full {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--secondary), var(--primary));
    transition: width 0.3s ease;
}

#unity-loading-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* 2. Glassmorphism HUD Overlay */
#hud-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    pointer-events: none; /* Let clicks pass through to background */
    display: flex;
    flex-direction: column;
}

/* UI Elements that should receive clicks */
#hud-overlay > * {
    pointer-events: auto;
}

/* Header - Enhanced Hero Style */
.glass-header {
    padding: 25px 40px;
    display: flex;
    flex-direction: column; /* Vertical stack */
    justify-content: center;
    align-items: center;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0.3) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 40px rgba(255, 126, 147, 0.08);
    position: relative;
    z-index: 101;
}

.logo-box {
    text-align: center;
}

.logo-box .logo {
    font-size: 2.4rem;
    font-weight: 900;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #ff5e78 0%, #ffb4a2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
    display: inline-block;
}

.logo-box .logo span {
    font-weight: 300;
    color: var(--text-main); /* Fallback */
    -webkit-text-fill-color: var(--text-main);
}

.header-slogan {
    font-size: 0.95rem;
    color: #827578;
    font-weight: 500;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

/* Hide old status badge */
.status-badge {
    display: none;
}

/* Adjust Main Area height to account for taller header */
.hud-main {
    flex: 1;
    display: flex;
    padding: 20px 40px;
    gap: 30px;
    align-items: center;
    justify-content: center;
    height: calc(100vh - 120px - 50px); /* Adjusted for taller header */
    overflow: hidden;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    height: 90%; /* Optimal height for centered panel */
    max-height: 800px;
}

/* Left Chat Panel */
.chat-panel {
    width: 750px; /* Wider chat window for desktop */
    padding: 24px;
}

.panel-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.panel-header h2 {
    font-size: 1.3rem;
    color: var(--text-main);
    margin: 0;
}

.panel-header .subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 4px 0 0 0;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 20px;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: rgba(0,0,0,0.02); border-radius: 10px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255, 126, 147, 0.3); border-radius: 10px; }

/* Input Area */
.input-area {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 15px 20px;
    border-radius: 24px;
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    resize: none;
    line-height: 1.5;
    transition: 0.3s;
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(255, 126, 147, 0.15);
}

.send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    flex-shrink: 0;
    box-shadow: 0 8px 20px rgba(255, 126, 147, 0.3);
    z-index: 1000;
}

.send-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 25px rgba(255, 126, 147, 0.4);
}

.send-btn svg {
    width: 22px;
    height: 22px;
}

/* Chat Bubbles Style */
.msg-row {
    display: flex;
    align-items: flex-end;
    margin-bottom: 20px;
    width: 100%;
}

.msg-row.me {
    justify-content: flex-end;
}

.msg-row.you {
    justify-content: flex-start;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fff5f7, #ffe4e9);
    border: 1px solid rgba(255, 126, 147, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-right: 10px;
    box-shadow: 0 4px 12px rgba(255, 126, 147, 0.15);
    flex-shrink: 0;
    user-select: none;
}

/* Header Avatar */
.header-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: white;
    box-shadow: 0 8px 20px rgba(255, 126, 147, 0.3);
    flex-shrink: 0;
}

.txt {
    padding: 14px 18px;
    line-height: 1.5;
    font-size: 0.95rem;
    max-width: 75%;
    word-break: break-word;
    animation: fadeIn 0.3s ease-out;
    position: relative;
}

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

.txt.me {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 8px 20px rgba(255, 126, 147, 0.25);
    margin-left: 0;
}

.txt.you {
    background: rgba(255, 255, 255, 0.95);
    color: var(--text-main);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
    margin-right: 0;
}

/* Typing Cursor Animation */
.typing-cursor::after {
    content: '▋';
    display: inline-block;
    vertical-align: baseline;
    animation: blink 1s step-end infinite;
    color: var(--primary);
    margin-left: 2px;
    font-size: 0.9em;
    opacity: 0.8;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Footer */
.hud-footer {
    text-align: center;
    padding: 15px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

/* Responsive */
@media (max-width: 768px) {
    .hud-main {
        padding: 10px;
        /* Dynamic viewport height for mobile bars */
        height: 100vh;
        height: 100dvh; 
        padding-bottom: 90px; /* Extra space for mobile browser bottom bar */
        align-items: flex-end; /* Push chat to bottom */
    }
    
    .chat-panel {
        width: 100%;
        max-width: 100%;
        height: 82%; /* Reduced height to be safe */
        border-radius: 24px 24px 0 0;
        margin-bottom: 0;
        backdrop-filter: blur(25px);
        padding-bottom: 30px; /* Internal padding for input area */
    }
    
    .glass-header {
        padding: 15px 20px;
    }
    
    .header-avatar {
        width: 42px;
        height: 42px;
        font-size: 1.3rem;
    }
    
    .panel-header h2 {
        font-size: 1.1rem;
    }
}
