:root {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --msg-sent: #3b82f6;
    --msg-received: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Glassmorphism Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

/* Overlay & Login */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-box {
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.login-box h2 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.login-box p {
    color: #94a3b8;
    margin-bottom: 1.5rem;
}

input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.6);
    color: white;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

button {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 1rem;
    width: 100%;
}

button:hover {
    background: var(--accent-hover);
}

/* Main App */
.app-container {
    width: 100%;
    max-width: 600px;
    height: 100vh; /* Full mobile height */
    max-height: 800px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 0;
}

@media (min-width: 600px) {
    .app-container {
        border-radius: 20px;
        height: 90vh;
        border: 1px solid var(--glass-border);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    }
}

.chat-header {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    border-radius: 20px 20px 0 0;
}

.chat-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

#current-user-display {
    color: var(--accent-color);
    font-weight: 500;
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.welcome-message {
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 2rem;
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.sent {
    background: var(--msg-sent);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.message.received {
    background: var(--msg-received);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.message .meta {
    display: block;
    font-size: 0.75rem;
    margin-bottom: 4px;
    opacity: 0.8;
}

.message.sent .meta {
    text-align: right;
    display: none; /* Hide my name */
}

.message.received .meta {
    color: #94a3b8;
}

/* Input Area */
.chat-input-area {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid var(--glass-border);
    border-radius: 0 0 20px 20px;
}

.chat-input-area button {
    width: auto;
    margin-top: 0;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-input-area button svg {
    width: 20px;
    height: 20px;
}
