/* Modern Variables */
:root {
    --bg-gradient: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #00d2ff;
    --primary-gradient: linear-gradient(90deg, #00d2ff 0%, #3a7bd5 100%);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --msg-bg-receive: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 100%;
    max-width: 500px;
    height: 90vh;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.chat-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.status {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #00e676;
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 10px #00e676;
}

.messages-list {
    flex: 1;
    list-style-type: none;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Custom Scrollbar for messages */
.messages-list::-webkit-scrollbar {
    width: 6px;
}
.messages-list::-webkit-scrollbar-track {
    background: transparent;
}
.messages-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.messages-list li {
    padding: 12px 18px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 0.95rem;
    line-height: 1.4;
    animation: fadeIn 0.3s ease forwards;
}

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

/* Differentiation between sent vs received is handled in app.js based on socket id, but for testing we'll just style them generally. Let's make all messages look neat */
.message-sent {
    background: var(--primary-gradient);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.2);
}

.message-received {
    background: var(--msg-bg-receive);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--glass-border);
}

.chat-form {
    padding: 20px;
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--glass-border);
}

.chat-form input {
    flex: 1;
    padding: 14px 20px;
    border-radius: 25px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.chat-form input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.chat-form input::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(0, 210, 255, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

/* User Login Overlay */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
}

.login-box h2 {
    margin-bottom: 10px;
    color: var(--primary);
}

.login-box p {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.login-box input {
    width: 100%;
    padding: 12px 20px;
    border-radius: 25px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 1rem;
    outline: none;
    margin-bottom: 15px;
}

.login-box .login-btn {
    width: 100%;
    padding: 12px;
    border-radius: 25px;
    border: none;
    background: var(--primary-gradient);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

/* Typing Indicator */
.typing-indicator {
    padding: 0 20px 10px 20px;
    font-size: 0.8rem;
    color: var(--primary);
    min-height: 24px;
    font-style: italic;
    opacity: 0.8;
}
