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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(circle at 20% 30%, #1a2a3a, #0b1119);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: rgba(12, 20, 30, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(100, 180, 255, 0.15);
    border-radius: 36px;
    padding: 32px 28px;
    box-shadow: 0 25px 50px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(70, 140, 220, 0.1) inset;
}

.auth-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 28px;
}

.auth-header h1 {
    font-weight: 500;
    font-size: 2.2rem;
    letter-spacing: -0.5px;
    color: #eef4ff;
    text-shadow: 0 2px 5px #00000040;
}

.auth-header span {
    background: #1e3b5c;
    padding: 2px 10px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #9dc6ff;
    border: 1px solid #2c5a84;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: 1px solid #2a4b6e;
    border-radius: 40px;
    color: #8f9eb5;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: #1f4a7a;
    border-color: #3f8eff;
    color: white;
}

.auth-tab:hover {
    border-color: #3f8eff;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.input-group {
    margin-bottom: 16px;
}

.input-group input {
    width: 100%;
    padding: 16px 18px;
    background: #0e1623;
    border: 1px solid #314a62;
    border-radius: 50px;
    color: #edf2fb;
    font-size: 1rem;
    outline: none;
    transition: 0.15s;
}

.input-group input:focus {
    border-color: #3f8eff;
    box-shadow: 0 0 0 3px #1e62a033;
}

.input-group input::placeholder {
    color: #6f85a2;
}

.auth-btn {
    width: 100%;
    padding: 16px;
    background: #2266bb;
    border: none;
    border-radius: 50px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 6px 14px #00000040, 0 0 0 1px #4080dd inset;
    margin-top: 8px;
}

.auth-btn:hover {
    background: #2f7ad6;
    transform: scale(0.98);
}

.error-msg {
    color: #ff6b6b;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
}

.success-msg {
    color: #32cd32;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: #5d7f9e;
    font-size: 0.85rem;
}

.messenger {
    width: 100%;
    max-width: 720px;
    height: 85vh;
    max-height: 800px;
    background: rgba(12, 20, 30, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(100, 180, 255, 0.15);
    border-radius: 36px;
    box-shadow: 0 25px 50px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(70, 140, 220, 0.2) inset, 0 0 20px rgba(0, 180, 255, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.title h2 {
    font-weight: 500;
    font-size: 1.7rem;
    letter-spacing: -0.5px;
    color: #eef4ff;
    text-shadow: 0 2px 5px #00000040;
}

.title span {
    background: #1e3b5c;
    padding: 2px 10px;
    border-radius: 40px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #9dc6ff;
    border: 1px solid #2c5a84;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #111e2b;
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid #27496e;
}

#status {
    font-size: 0.9rem;
    font-weight: 500;
    color: #b3e0b3;
}

.pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #32cd32;
    box-shadow: 0 0 10px #32cd32;
    animation: pulse-green 1.8s infinite;
}

.offline-pulse {
    background: #ff4d4d !important;
    box-shadow: 0 0 8px #ff4d4d !important;
    animation: none !important;
}

@keyframes pulse-green {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); background: #7cfc00; }
    100% { opacity: 1; transform: scale(1); }
}

.logout-btn {
    background: #1e3144;
    border: 1px solid #2d4b6b;
    color: #9dc6ff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.15s;
}

.logout-btn:hover {
    background: #2f4b6e;
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
    width: 5px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: #2e4b6e;
    border-radius: 10px;
}

.message-row {
    display: flex;
    width: 100%;
}

.message-row.out {
    justify-content: flex-end;
}

.message-row.in {
    justify-content: flex-start;
}

.bubble {
    max-width: 75%;
    padding: 12px 18px;
    border-radius: 24px;
    font-size: 0.95rem;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 6px 12px -6px #0000004d;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.bubble.in {
    background: #1e3144;
    color: #e3ecf5;
    border-bottom-left-radius: 6px;
    border: 1px solid #2d4b6b;
}

.bubble.out {
    background: linear-gradient(145deg, #1f4a7a, #103456);
    color: white;
    border-bottom-right-radius: 6px;
    border: 1px solid #3e7ab3;
}

.sender-name {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 4px;
    font-weight: 600;
}

.time-meta {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 6px;
    text-align: right;
}

.system-msg {
    align-self: center;
    background: #0e1a26b3;
    padding: 6px 16px;
    border-radius: 50px;
    color: #9bb9e0;
    font-size: 0.8rem;
    border: 1px solid #2f4f6e;
    backdrop-filter: blur(8px);
    margin: 6px 0;
}

.input-area {
    padding: 16px 20px 22px;
    border-top: 1px solid #1e364b;
    background: #0a121eb0;
    backdrop-filter: blur(10px);
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #111f2e;
    border-radius: 60px;
    padding: 4px 4px 4px 22px;
    border: 1px solid #2a4b6e;
    transition: border 0.2s, box-shadow 0.2s;
}

.input-wrapper:focus-within {
    border-color: #3f8eff;
    box-shadow: 0 0 0 3px #1e62a033, 0 0 15px #1e90ff40;
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 14px 0;
    color: #f0f6ff;
    font-size: 1rem;
    outline: none;
}

.input-wrapper input::placeholder {
    color: #7e9dbb;
}

.send-btn {
    background: #2266bb;
    border: none;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    font-size: 24px;
    transition: all 0.15s;
    box-shadow: 0 6px 14px #00000040, 0 0 0 1px #4080dd inset;
}

.send-btn:hover {
    background: #2f7ad6;
    transform: scale(0.96);
}

.footer-note {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    color: #5d7f9e;
    font-size: 0.75rem;
}