/* ========================= Global ========================= */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background: #f2f2f2;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================= TOP BAR ========================= */
#top-bar {
    background: #4a90e2;
    color: white;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.1em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}


#top-bar .hidden { display: none !important; }

#online-users {
    position: relative;
    cursor: pointer;
    font-weight: 600;
}

#user-dropdown {
    position: absolute;
    top: 56px;
    left: 0;
    background: #2a2b2e;
    padding: 8px;
    border-radius: 6px;
    min-width: auto;
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    color: #fff;
}

#user-dropdown .user-row {
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.95em;
    max-width: none; 
}

#user-dropdown .user-row + .user-row {
    margin-top: 6px;
}

/* center area */
/* ========================= Language Selector ========================= */
#current-lang {
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

#current-lang:hover #lang-selector {
    display: block; /* keep dropdown open on hover */
}

#lang-selector {
    display: none; /* initially hidden */
    position: absolute;
    top: 100%; /* just below the button */
    left: 50%;
    transform: translateX(-50%);
    background: #2a2b2e;
    padding: 4px 6px;
    border-radius: 6px;
    min-width: auto;
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    color: #fff;
    z-index: 999; /* ensure on top */
}

#lang-selector div {
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    max-width: none;
}

#lang-selector div:hover {
    background: rgba(255,255,255,0.06);
}


/* profile */
#profile-area {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

#user-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #4f4f51;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-weight: 700;
    color: white;
    margin-right: 10px;  /* <-- NEW */
}

#user-menu {
    position: absolute;
    right: 0;
    top: 56px;
    background: #2a2b2e;
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    color: #fff;
}

#user-menu div {
    padding: 6px 10px;
    cursor: pointer;
}
#user-menu div:hover { background: rgba(255,255,255,0.06); }

/* ========================= Auth Boxes ========================= */
#register-container, #login-container {
    width: 350px;
    margin: 15px auto; /* push down beneath top-bar */
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#register-container h3, #login-container h3 {
    text-align: center;
    color: #4a90e2;
    margin-bottom: 10px;
    font-size: 1.4em;
}

#register-container input,
#login-container input,
#register-container select {
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ccc;
    font-size: 1em;
}

#register-container button,
#login-container button {
    background: #4a90e2;
    color: white;
    padding: 12px;
    border-radius: 10px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    font-size: 1em;
}

.hidden {
    display: none !important;
}

/* ========================= Chat Layout ========================= */
#chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: white;
    height: calc(100vh - 56px);
    overflow: hidden;
}

#chat-box {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f7f7;
}

/* DEFAULT bubble shape */
#chat-box div {
    padding: 10px 15px;
    border-radius: 12px;
    max-width: 75%;
    background: #e4e6eb;
    word-wrap: break-word;
    width: fit-content;
}

/* RIGHT SIDE — your messages */
#chat-box .own-message {
    align-self: flex-end;
    background: #4a90e2;
    color: white;
}

/* Center system notifications */
#chat-box .status-message {
    align-self: center;
    background: transparent !important;
    color: #666;
    font-style: italic;
    font-size: 0.9em;
}

/* ========================= Input Bar ========================= */
#chat-input-container {
    display: flex;
    padding: 14px;
    background: #fff;
    border-top: 1px solid #ddd;
    gap: 12px;
}

#message-input {
    flex-grow: 1;
    padding: 14px 18px;
    border-radius: 25px;
    border: 1px solid #ccc;
    font-size: 1em;
}

#send-button {
    padding: 12px 22px;
    border-radius: 25px;
    background: #4a90e2;
    font-weight: bold;
    border: none;
    cursor: pointer;
    color: white;
    font-size: 1em;
}

#send-button:hover {
    background: #357ab7;
}

/* ========================= Scrollbar ========================= */
#chat-box::-webkit-scrollbar {
    width: 8px;
}

#chat-box::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

/* General flags in chat or dropdown */
.flag-icon {
    width: 20px;
    height: 14px;
    vertical-align: middle;
    margin-right: 5px;
}

/* Top bar flag */
#current-lang .flag-icon {
    width: 40px;   /* make bigger */
    height: 36px;  /* maintain aspect ratio */
}

#chat-box .status-message {
    align-self: center;
    background: transparent !important;
    color: #666;
    font-style: italic;
    font-size: 0.9em;
}

#app-title.auth-title {
    margin-top: 60px;  /* pushes below top bar */
    margin-bottom: 20px;
    text-align: center;
    font-size: 2.3em;
    font-weight: 800;
    color: #4a90e2;
    letter-spacing: 0.5px;
}
