@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Hina+Mincho&display=swap');

:root {
    --bg-color: #1a1a1a;
    --sidebar-bg: #252525;
    --msg-bg: #333;
    --msg-mine: #005c4b;
    --text-color: #e0e0e0;
    --accent: #4a90e2;
}

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

body, html{
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Playfair Display', 'Hina Mincho', serif;
}

i {
    pointer-events: none;
}

body {
    margin: 0;
    color: var(--text-color);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#login-screen {
    display: flex;
    flex-direction: column;
    gap: 1em;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.31);
    padding: 1em;
    border-radius: 16px;
    width: 20em;
}

input {
    padding: 1em;
    border-radius: 4px;
    border: 1px solid #444;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.31);
    padding: 1em;
    color: white;
    font-family: inherit;
}

button {
    padding: 1em;
    cursor: pointer;
    color: white;
    border: none;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.281);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.31);
    padding: 1em;
    font-family: inherit;
}

button:hover {
     background: rgb(53, 53, 53); 
}

.error-msg { color: #ff6b6b; display: none; font-size: 0.9rem; }

/* Main App */
#app-container {
    display: none; /* Hidden by default */
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#sidebar {
    width: 25%;
    border-left: 1px solid rgba(255, 255, 255, 0.31);
    padding: 1rem;
    overflow-y: auto;
}

#main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
}

header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.31);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#header-title {
    font-size: 2em;
}

#header-user-info { display: flex; align-items: center; gap: 1em; }

#messages-list {
    flex: 1;
    list-style: none;
    padding: 1rem;
    overflow-y: auto;
    margin: 0;
    display: flex;
    flex-direction: column;
    scrollbar-width: none;
    gap: 0em;
}

#messages-list::-webkit-scrollbar {
    background-color: transparent;
}

.message-item {
    padding: 1em;
    border-radius: 0px;
    /* border-bottom: 1px solid rgba(255, 255, 255, 0.31); */
    display: flex;
    gap: 1em;
}

.avatar-small {
    width: 4em;
    height: 4em;
    border-radius: 50%;
    object-fit: cover;
    background-color: rgba(255, 255, 255, 0.31);
}

.message-avatar {
    width: 3em;
    height: 3em;
    border-radius: 50%;
    object-fit: cover;
}

.message-body {
    flex: 1;
}

.message-meta {
    font-size: 1em;
    opacity: 0.8;
    color: #ffffff;
    margin-bottom: 0.3em;
}

.actions { margin-top: 5px; }
.btn-sm { padding: 2px 6px; font-size: 0.7rem; margin-right: 5px; background: #555; }

/* Typing Indicator */
#typing-indicator {
    height: 2em;
    padding: 0 1rem;
    font-size: 1rem;
    color: #888;
    font-style: italic;
    margin-bottom: 5px;
}

#input-area {
    position: relative;
    padding: 0em 1em 1em 1em;
    display: flex;
    gap: 1em;
}

#message-input { flex: 1; }

emoji-picker {
    --border-radius: 16px 16px 0px 16px;
    --background: rgba(0, 0, 0, 0.25);;
    --border-color: #555;
    --indicator-color: #ffffff6c;
    position: absolute;
    right: 8em;
    bottom: 1em;
    width: 0em;
    height: 0em;
    opacity: 0;
    transition: all 0.1s ease-in;
}
.online-user {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin: 0.75em 0em;
    font-size: 0.9rem;
}

.online-dot {
    /* width: 8px;
    height: 8px; */
    background: #00ff00;
    border-radius: 50%;
}

.modal {
    display: none; 
    position: fixed; 
    z-index: 100; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
}

.modal-content {
    margin: 15% auto; 
    padding: 20px;
    border: 1px solid #555;
    border-radius: 8px;
    width: 80%;
    max-width: 400px;
    position: relative;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.31);
    padding: 1em;
    }

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.pfp-section {
    margin-top: 1em;
    padding-top: 1em;
    border-top: 1px solid #444;
}

.small-text { font-size: 0.8rem; color: #aaa; }
#pfp-status-msg { margin-top: 10px; font-weight: bold; }


#context-menu {
    display: none;
    position: absolute;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.31);
    padding: 0.5em;
    gap: 1em;
    min-width: 150px;
    overflow: hidden;
}

#context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

#context-menu li {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #e0e0e0;
    transition: background 0.2s;
    border-radius: 16px;
}

#context-menu li:last-child {
    border-bottom: none;
}

#context-menu li:hover {
    background-color: #7777773b;
}

#context-menu li.delete-option:hover {
    background-color: #7777773b;
}

.modal-actions {
    margin-top: 2em;
    display: flex;
    justify-content: flex-end;
    gap: 1em;
}

#edit-message-input {
    width: 100%;
    box-sizing: border-box; /* Fix padding overflow */
    margin-top: 1em;
}

.btn-primary {
    background-color: #333333;
    color: white;
}

.btn-secondary {
    background-color: #242424;
    color: #e0e0e0;
}

.btn-danger {
    background-color: #ff000033;
    color: white;
}

.btn-secondary:hover { background-color: #666; }
.btn-danger:hover { background-color: #e8421883; }

#ui-toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 20000;
    left: 50%;
    bottom: 30px;
    transform: translateX(-50%);
    font-size: 17px;
    border: 1px solid #555;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}

#ui-toast.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px;
}

#ui-toast.error {
    background-color: #ff4757;
    border-color: #ff6b81;
}

#ui-toast.success {
    background-color: #005c4b;
    border-color: #00cc66;
}

/* Auth Screen Redesign */
#auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.auth-box {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 2.5rem;
    border-radius: 8px;
    width: 350px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    border: 1px solid #444;
}

.auth-switch {
    font-size: 0.9rem;
    text-align: center;
    color: #aaa;
    margin-top: 10px;
}

.auth-switch a {
    color: var(--accent);
    text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

.verify-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Button Variants (Ensure these exist) */
.btn-text {
    background: none;
    border: 1px solid #555;
    color: #aaa;
}
.btn-text:hover { background: #333; color: white; }

/* Hide App by default */
#app-container { display: none; }

@media only screen and (max-width: 720px) {
    #sidebar {
    display: none;
    }
}