/* Base styles for the messenger app
   This stylesheet uses modern CSS features like backdrop-filter to achieve
   a frosted “liquid glass” look reminiscent of Apple’s design system and
   Snapchat’s playful color palette. The translucent panels allow the
   background gradient to subtly bleed through.
*/

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #ffefba, #ffffff); /* soft yellow inspired by Snapchat */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: #222;
}

/* Navigation bar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px) saturate(180%);
    background: rgba(255, 255, 255, 0.35);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.navbar .app-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffdc00; /* Snapchat yellow */
}

.navbar a {
    margin: 0 0.5rem;
    text-decoration: none;
    color: #222;
    font-weight: 500;
}

.navbar a:hover {
    color: #ffdc00;
}

.navbar select {
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    color: #222;
    margin-right: 0.5rem;
}

.navbar .username {
    margin-right: 0.5rem;
    font-weight: 500;
}

.navbar .logout {
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    color: #222;
    font-weight: 500;
}

.footer {
    text-align: center;
    padding: 1rem;
    margin-top: auto;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

/* Forms */
.form-container {
    max-width: 400px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: 1rem;
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.form-container h2 {
    margin-top: 0;
    text-align: center;
    color: #222;
}

.form-group {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.form-group input, .form-group select {
    padding: 0.5rem;
    border: none;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    color: #222;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #ffdc00;
    color: #222;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    transition: background 0.2s ease;
}

.btn:hover {
    background: #ffd633;
}

/* Chat layout */
.chat-container {
    display: flex;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.chat-sidebar {
    width: 250px;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
}

.chat-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chat-sidebar li {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-sidebar li:hover, .chat-sidebar li.active {
    background: rgba(255, 255, 255, 0.5);
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.message {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

.message .sender {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.message .text {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    padding: 0.5rem;
    border-radius: 0.5rem;
    max-width: 70%;
    word-wrap: break-word;
}

.message.self .text {
    align-self: flex-end;
    background: #ffdc00;
    color: #222;
}

.message-input {
    display: flex;
    padding: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.message-input textarea {
    flex: 1;
    resize: none;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: none;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    color: #222;
    min-height: 2.5rem;
}

.message-input button {
    margin-left: 0.5rem;
}

/* Friend list */
.friends-container {
    max-width: 600px;
    margin: 2rem auto;
    padding: 1rem;
    border-radius: 1rem;
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.4);
}

.friends-container ul {
    list-style: none;
    padding: 0;
}

.friends-container li {
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.friends-container li:last-child {
    border-bottom: none;
}

/* Avatar builder */
.avatar-builder {
    max-width: 600px;
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    border-radius: 1rem;
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.4);
}

.avatar-preview {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    margin: 0 auto;
    position: relative;
}

.avatar-preview img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.avatar-options button {
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.avatar-options button.active {
    background: #ffdc00;
    color: #222;
}

/* Admin panel */
.admin-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1rem;
    border-radius: 1rem;
    backdrop-filter: blur(14px);
    background: rgba(255, 255, 255, 0.4);
}

.admin-container table {
    width: 100%;
    border-collapse: collapse;
}

.admin-container th, .admin-container td {
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    text-align: left;
}

.admin-container th {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
    }
    .chat-sidebar {
        width: 100%;
        height: 200px;
        order: 2;
    }
    .chat-main {
        order: 1;
        height: calc(100vh - 270px);
    }
}