/* =========================================
   ROOT THEME
========================================= */
:root {
    --bg: #1a1a1a;
    --bg-elev: #1d1d1d;
    --bg-panel: #1f1f1f;
    --border: #2c2c2c;
    --text: #e4e4e4;
    --text-dim: #999999;
    --accent: #18c964;
    --accent-hover: #14a653;
    --danger: #e5484d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* =========================================
   TITLE BAR
========================================= */
#titlebar {
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =========================================
   MAIN LAYOUT
========================================= */
#main {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* =========================================
   SERVERS
========================================= */
#servers {
    width: 180px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    padding: 12px;
    overflow-y: auto;
}

/* =========================================
   CHANNELS
========================================= */
#channels {
    width: 220px;
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    padding: 12px;
    overflow-y: auto;
}

.channel {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-dim);

}

.channel:hover {
    background: rgba(24, 201, 100, 0.08);
    color: var(--text);
}

.channel.active {
    background: rgba(24, 201, 100, 0.15);
    color: var(--accent);
}

/* =========================================
   CHAT
========================================= */
#chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    min-height: 0;
}

#messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.message {
    margin-bottom: 16px;
}

.username {
    font-weight: 600;
    color: var(--accent);
}

.time {
    font-size: 12px;
    color: var(--text-dim);
    margin-left: 8px;
}

.content {
    margin-top: 4px;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* =========================================
   INPUT AREA
========================================= */
#inputArea {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg-elev);
    display: flex;
    gap: 10px;
}

#msgInput {
    flex: 1;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
    font-size: 14px;
}

#msgInput:focus {
    outline: none;
    border-color: var(--accent);
}

/* =========================================
   USER PANEL
========================================= */
#userPanel {
    width: 220px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border);
    padding: 16px;
    overflow-y: auto;
}

.statusIcon {
    width: 14px;
    height: 14px;
}

/* =========================================
   BUTTONS
========================================= */
.winbtn {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
    cursor: pointer;
}

.winbtn:hover {
    border-color: var(--accent);
    background: rgba(24, 201, 100, 0.08);
}

.winbtn:active {
    background: rgba(24, 201, 100, 0.15);
}

/* =========================================
   AUTH PAGE
========================================= */
#container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.panel {
    width: 380px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: 10px;
}

.groupBox {
    margin-bottom: 24px;
}

.panelTitle {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--accent);
}

.row {
    margin-bottom: 14px;
}

.label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-dim);
}

.input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

/* =========================================
   STATUS BOX
========================================= */
.status {
    margin-top: 12px;
    padding: 10px;
    border-radius: 6px;
    background: rgba(24, 201, 100, 0.08);
    border: 1px solid rgba(24, 201, 100, 0.2);
    font-size: 13px;
    display: none;
}

/* =========================================
   MODAL
========================================= */
#modalOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
}

#modalBox {
    width: 380px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#modalTitle {
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--accent);
}

.modalInput {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--text);
}

#topActions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.winbtn.ghost {
    background: transparent;
}

.winbtn.danger:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.modalActions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.sidebarTitle {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 12px;
}

.serverItem {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-dim);
}

.serverItem:hover {
    background: rgba(24, 201, 100, 0.08);
    color: var(--text);
}

.serverItem.active {
    background: rgba(24, 201, 100, 0.15);
    color: var(--accent);
}

/* Modern minimal scrollbars */

/* Chrome, Edge, Safari */
*::-webkit-scrollbar {
    width: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: #2a3430;
    border-radius: 6px;
}

*::-webkit-scrollbar-thumb:hover {
    background: #33403a;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #2a3430 transparent;
}

/* =========================================
   SIDEBAR SECTION HEADERS
========================================= */

.sidebarTitleRow {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 10px;
    padding: 0 4px;
}

/* + buttons in headers */
.ghostAddBtn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.ghostAddBtn:hover {
    background: rgba(24, 201, 100, 0.08);
    color: var(--accent);
}

/* =========================================
   SERVER / CHANNEL ROW STRUCTURE
========================================= */

.serverItemRow,
.channelRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

/* Ensure text area takes full width */
.serverItem,
.channel {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

/* =========================================
   CONTEXT MENU BUTTON (⋯)
========================================= */

.ghostMenuBtn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    padding: 4px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
}

/* Show ⋯ only on hover */
.serverItemRow:hover .ghostMenuBtn,
.channelRow:hover .ghostMenuBtn {
    opacity: 1;
}

.ghostMenuBtn:hover {
    background: rgba(24, 201, 100, 0.08);
    color: var(--accent);
}

/* =========================================
   PING ICON
========================================= */

.pingIcon {
    width: 10px;
    height: 10px;
    margin-left: auto;
}

/* Optional modern dot style instead of image */
/*
.pingIcon {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}
*/

/* =========================================
   CONTEXT MENU
========================================= */

#contextMenu {
    position: fixed;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 0;
    z-index: 9999;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.contextItem {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: background 0.15s ease;
}

.contextItem:hover {
    background: rgba(24, 201, 100, 0.08);
}

/* =========================================
   PROFILE DRAWER
========================================= */

/* =========================================
   PROFILE MODAL (Discord style)
========================================= */

.profileOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.profileModal {
    width: 420px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: popIn 0.18s ease;
}

@keyframes popIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.profileHeaderRow {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 16px;
}

.profileAvatar {
    width: 72px;
    height: 72px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
}

.profileName {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.profileBio {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: 8px;
    white-space: pre-wrap;
    font-size: 13px;
    margin-bottom: 10px;
}

.profileActions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.hidden {
    display: none;
}