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

html, body { width: 100%; height: 100%; overflow: hidden; background-color: #000000; }

body {
    font-family: 'Poppins', system-ui, sans-serif;
    background-image: url('bg.png'); 
    background-size: cover; background-position: center; background-repeat: no-repeat;
    color: #ffffff; 
    display: flex; flex-direction: column;
    height: 100dvh; 
}

.hidden { display: none !important; }

.login-container {
    position: fixed; top: 0; left: 0; width: 100vw; 
    height: 100dvh; 
    background: rgba(0, 0, 0, 0.7); 
    backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    display: flex; justify-content: center; align-items: center;
    z-index: 9999; padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.05); 
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px; padding: 40px; text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    width: 100%; max-width: 380px;
}

.login-subtitle { color: #aaaaaa; margin: 10px 0 30px 0; font-size: 0.9rem; }

.google-btn {
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255,255,255,0.2);
    color: white; padding: 14px 20px; border-radius: 30px; font-size: 1rem; font-family: 'Poppins', sans-serif;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 12px; 
    width: 100%; transition: all 0.3s ease;
}
.google-btn:hover { background: rgba(255, 255, 255, 0.2); transform: translateY(-2px); }
.google-btn:disabled { opacity: 0.6; cursor: not-allowed; }

#sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; 
    height: 100dvh; 
    background: rgba(0,0,0,0.6); z-index: 2000;
}
#sidebar-menu {
    position: fixed; top: 0; left: -300px; width: 280px; 
    height: 100dvh; 
    background: rgba(15, 15, 20, 0.85); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2001; transition: left 0.3s ease; display: flex; flex-direction: column;
}
#sidebar-menu.open { left: 0; }

#close-sidebar { position: absolute; top: 15px; right: 15px; background: transparent; border: none; color: white; font-size: 28px; cursor: pointer; }
.sidebar-header { padding: 30px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-nav { display: flex; flex-direction: column; padding: 20px 0; }
.sidebar-nav a, .sidebar-nav button {
    display: block; padding: 15px 25px; color: white; text-decoration: none; font-size: 1rem;
    font-family: 'Poppins', sans-serif; background: transparent; border: none; text-align: left; cursor: pointer; transition: background 0.2s;
}
.sidebar-nav a:hover, .sidebar-nav button:hover { background: rgba(255,255,255,0.1); color: #00d2ff; }

#app-container { 
    width: 100%; 
    height: 100dvh; 
    display: flex; flex-direction: column; 
    overflow: hidden;
}

header {
    background: rgba(255, 255, 255, 0.03); 
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    padding: 10px 15px; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08); flex-shrink: 0;
}

.header-left { display: flex; align-items: center; gap: 15px; }
#menu-btn { background: transparent; border: none; color: white; cursor: pointer; display: flex; align-items: center; }
#menu-btn svg { width: 28px; height: 28px; }
.header-titles { display: flex; flex-direction: column; }

.title { font-size: 1.25rem; font-weight: 700; background: linear-gradient(90deg, #ffffff, #00d2ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.copyright { font-size: 0.8rem; vertical-align: super; margin-left: 1px; color: white; }
.author { font-size: 0.75rem; color: #aaaaaa; font-weight: 500; }

.header-right { display: flex; align-items: center; }
#fullscreen-btn { background: transparent; border: none; color: #00d2ff; cursor: pointer; padding: 5px; }
#fullscreen-btn svg { width: 22px; height: 22px; transition: transform 0.2s ease; }
#fullscreen-btn:hover svg { transform: scale(1.1); }

.chat-area { flex: 1; overflow-y: auto; padding: 20px 15px; display: flex; flex-direction: column; gap: 20px; scroll-behavior: smooth; }
.message { max-width: 85%; display: flex; flex-direction: column; animation: slideUp 0.3s ease forwards; }
@keyframes slideUp { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.message.ai-message { align-self: flex-start; }
.message.user-message { align-self: flex-end; align-items: flex-end; }

.bubble { 
    padding: 14px 20px; border-radius: 20px; line-height: 1.6; font-size: 0.95rem; word-wrap: break-word; 
    background: rgba(255, 255, 255, 0.05); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); 
    border: 1px solid rgba(255, 255, 255, 0.15); color: #ffffff; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.ai-message .bubble { border-bottom-left-radius: 4px; }
.user-message .bubble { border-bottom-right-radius: 4px; }

.sent-image { max-width: 200px; border-radius: 12px; margin-bottom: 8px; border: 1px solid rgba(255,255,255,0.2); }
.bubble p { margin-bottom: 10px; } .bubble p:last-child { margin-bottom: 0; }
.bubble strong { color: #00d2ff; }
.katex-display { margin: 12px 0; overflow-x: auto; overflow-y: hidden; text-align: left !important; }

.preview-container { display: none; padding: 10px 15px; background: rgba(255, 255, 255, 0.05); border-top: 1px solid rgba(255, 255, 255, 0.1); }
.preview-box { position: relative; display: inline-block; }
.preview-box img { height: 60px; border-radius: 8px; }
#remove-image-btn { position: absolute; top: -5px; right: -5px; background: rgba(255,68,68,0.8); color: white; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; }

.input-bar {
    width: 100%; background: rgba(255, 255, 255, 0.02); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    padding: 12px 15px; display: flex; align-items: center; gap: 10px; border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

.attach-wrapper { position: relative; }
#attach-btn { width: 45px; height: 45px; border-radius: 50%; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.15); color: #ffffff; cursor: pointer; display: flex; justify-content: center; align-items: center; }
.attach-menu { display: none; position: absolute; bottom: 60px; left: 0; background: rgba(0, 0, 0, 0.8); border-radius: 12px; padding: 8px; flex-direction: column; gap: 5px; width: 140px; z-index: 100;}
.attach-menu button { background: none; border: none; color: white; padding: 10px; text-align: left; cursor: pointer; font-family: 'Poppins', sans-serif; }

.input-wrapper {
    flex: 1; display: flex; align-items: center; min-width: 0; 
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.15); 
    border-radius: 30px; padding: 2px 12px;
}
#user-input { flex: 1; width: 100%; min-width: 0; background: transparent; border: none; color: #ffffff; font-size: 1rem; outline: none; padding: 10px 5px; font-family: 'Poppins', sans-serif; }
#user-input::placeholder { color: #888899; }

#mic-btn { background: transparent; border: none; color: #888899; cursor: pointer; padding: 8px; display: flex; align-items: center; justify-content: center; transition: color 0.3s ease; }
#mic-btn svg { width: 22px; height: 22px; transition: all 0.3s ease; }
#mic-btn:hover { color: #00d2ff; }

#mic-btn.recording { color: #ff4444; }
#mic-btn.recording svg {
    animation: activeMicGlow 1.5s infinite ease-in-out;
}

@keyframes activeMicGlow {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255, 68, 68, 0.4)); }
    50% { transform: scale(1.2); filter: drop-shadow(0 0 12px rgba(255, 68, 68, 1)); }
    100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(255, 68, 68, 0.4)); }
}

#send-btn { width: 45px; height: 45px; flex-shrink: 0; border-radius: 16px; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); color: #ffffff; cursor: pointer; display: flex; justify-content: center; align-items: center; transition: all 0.3s ease; }
#send-btn:hover { background: rgba(255, 255, 255, 0.2); transform: scale(1.05); }
#send-btn svg { width: 22px; height: 22px; }
  
