/* assets/style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600&display=swap');

:root {
    --bg-color: #050505;
    --chat-bg: #0a0a0a;
    --primary: #3b82f6;
    /* Electric Blue */
    --primary-glow: rgba(59, 130, 246, 0.5);
    --secondary: #1f1f1f;
    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --success: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}

/* App Container */
#app {
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: var(--chat-bg);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border-left: 1px solid #1a1a1a;
    border-right: 1px solid #1a1a1a;
}

/* Login View */
#login-view {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    transition: opacity 0.5s ease;
}

.login-card {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

h1.logo {
    font-size: 2.5rem;
    font-weight: 600;
    background: linear-gradient(to right, #fff, #666);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2rem;
    letter-spacing: -1px;
}

.input-group {
    position: relative;
    width: 100%;
}

input {
    width: 100%;
    padding: 1rem 1.5rem;
    background: #111;
    border: 1px solid #333;
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

button.btn-primary {
    margin-top: 1rem;
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

button.btn-primary:hover {
    box-shadow: 0 0 20px var(--primary-glow);
    transform: translateY(-2px);
}

button.btn-primary:active {
    transform: translateY(0);
}

/* Chat View */
#chat-view {
    display: none;
    /* Toggled by JS */
    flex-direction: column;
    height: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#chat-view.active {
    display: flex;
    /* Changed from 'display: none' to flex logic in JS, this helps CSS transition states */
    opacity: 1;
    transform: translateY(0);
}

header {
    padding: 1rem 1.5rem;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #222;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.user-info {
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
}

/* Messages Area */
#messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.message {
    max-width: 80%;
    padding: 0.8rem 1.2rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.message.mine {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.message.theirs {
    align-self: flex-start;
    background: var(--secondary);
    color: #eee;
    border-bottom-left-radius: 4px;
}

.message .meta {
    font-size: 0.7rem;
    margin-top: 0.4rem;
    opacity: 0.7;
    text-align: right;
}

/* Input Area */
.input-area {
    padding: 1rem 1.5rem;
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid #222;
    display: flex;
    gap: 1rem;
    align-items: center;
}

#message-input {
    flex: 1;
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 0.8rem 1rem;
    border-radius: 20px;
    color: white;
    resize: none;
    height: 46px;
    /* consistent height */
    line-height: 1.1em;
    padding-top: 12px;
}

#message-input:focus {
    border-color: var(--primary);
}

.send-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
    background: #2563eb;
}

.send-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    margin-left: 2px;
    /* optical adjustment */
}

/* Utilities */
.hidden {
    display: none !important;
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}