* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #080a10;
    color: #ffffff;
}

.chat-container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0c0f17;
}

/* =========================
   HEADER
========================= */

header {
    height: 68px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: linear-gradient(135deg, #171b29, #10131d);
    border-bottom: 1px solid #292f40;
}

header h1 {
    margin: 0;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: .5px;
}

.channel-name {
    margin-top: 4px;
    color: #8f9bb3;
    font-size: 12px;
}

#status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #67e8a5;
}

#status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 10px rgba(74, 222, 128, .7);
}

/* =========================
   LOGIN
========================= */

#login {
    width: min(420px, calc(100% - 30px));
    margin: auto;
    padding: 30px;
    background: #151925;
    border: 1px solid #292f40;
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
}

#login input {
    width: 100%;
    height: 48px;
    padding: 0 15px;
    margin-bottom: 12px;
    border: 1px solid #343b50;
    border-radius: 10px;
    outline: none;
    background: #0d1018;
    color: #ffffff;
    font-size: 15px;
}

#login input:focus {
    border-color: #7c5cff;
    box-shadow: 0 0 0 3px rgba(124, 92, 255, .12);
}

#connect,
#send {
    border: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #7c5cff, #a855f7);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    transition: .15s ease;
}

#connect {
    width: 100%;
    height: 48px;
}

#connect:hover,
#send:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

#connect:disabled,
#send:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* =========================
   CHAT
========================= */

#chat {
    flex: 1;
    min-height: 0;
}

.chat-layout {
    height: 100%;
    display: flex;
    min-height: 0;
}

.chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* =========================
   TABS
========================= */

.messages-tabs {
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #10131c;
    border-bottom: 1px solid #292f40;
}

.tab {
    height: 36px;
    padding: 0 18px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #7f8aa1;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.tab:hover {
    background: #191e2c;
    color: #ffffff;
}

.tab.active {
    background: #252b3d;
    color: #ffffff;
}

/* =========================
   MESSAGE AREA
========================= */

#messages,
#server-status {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
}

.message,
.system,
.action {
    margin-bottom: 10px;
    line-height: 1.45;
    word-break: break-word;
}

.message {
    padding: 10px 14px;
    width: fit-content;
    max-width: 82%;
    background: #191e2c;
    border: 1px solid #292f40;
    border-radius: 12px;
    color: #e9ebf2;
}

.system {
    color: #7f8aa1;
    font-size: 13px;
}

.action {
    color: #c4b5fd;
    font-style: italic;
}

/* =========================
   STATUS WINDOW
========================= */

#server-status {
    background: #090c13;
    font-family: "Courier New", monospace;
    font-size: 12px;
    color: #9da8bc;
}

.status-line {
    padding: 5px 8px;
    border-bottom: 1px solid rgba(255,255,255,.035);
    white-space: pre-wrap;
    word-break: break-word;
}

.status-line:hover {
    background: #111622;
}

.status-time {
    color: #59657c;
    margin-right: 8px;
}

/* =========================
   INPUT
========================= */

.input-area {
    flex-shrink: 0;
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    background: #11141e;
    border-top: 1px solid #292f40;
}

#message {
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 0 15px;
    border: 1px solid #343b50;
    border-radius: 10px;
    outline: none;
    background: #0b0e15;
    color: #ffffff;
    font-size: 15px;
}

#message:focus {
    border-color: #7c5cff;
    box-shadow: 0 0 0 3px rgba(124, 92, 255, .1);
}

#send {
    width: 105px;
    flex-shrink: 0;
}

/* =========================
   USERS
========================= */

.users-panel {
    width: 240px;
    flex-shrink: 0;
    overflow-y: auto;
    background: #11141e;
    border-left: 1px solid #292f40;
}

.users-title {
    height: 56px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    border-bottom: 1px solid #292f40;
    color: #ffffff;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .4px;
}

#user-count {
    margin-left: auto;
    min-width: 27px;
    height: 23px;
    padding: 0 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: #292f40;
    color: #c4b5fd;
    font-size: 12px;
}

.user-item {
    padding: 11px 16px;
    border-bottom: 1px solid rgba(255,255,255,.035);
    color: #e8eaf0;
    font-size: 14px;
    transition: background .12s ease;
}

.user-item:hover {
    background: #191e2c;
}

.user-dot {
    color: #4ade80;
    font-size: 9px;
    margin-right: 5px;
}

.user-op {
    color: #fbbf24;
    font-size: 9px;
    margin-right: 5px;
}

/* =========================
   SCROLLBARS
========================= */

#messages::-webkit-scrollbar,
#server-status::-webkit-scrollbar,
.users-panel::-webkit-scrollbar {
    width: 7px;
}

#messages::-webkit-scrollbar-thumb,
#server-status::-webkit-scrollbar-thumb,
.users-panel::-webkit-scrollbar-thumb {
    background: #30374a;
    border-radius: 10px;
}

#messages::-webkit-scrollbar-track,
#server-status::-webkit-scrollbar-track,
.users-panel::-webkit-scrollbar-track {
    background: transparent;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 700px) {

    .users-panel {
        width: 170px;
    }

    .users-title {
        padding: 0 10px;
    }

    .user-item {
        padding: 10px;
    }

    #messages,
    #server-status {
        padding: 14px;
    }

    .input-area {
        padding: 10px;
    }

    #send {
        width: 85px;
    }
}

@media (max-width: 520px) {

    .users-panel {
        width: 125px;
    }

    header {
        padding: 0 14px;
    }

    header h1 {
        font-size: 17px;
    }

    #status {
        font-size: 11px;
    }

    .users-title {
        font-size: 11px;
    }

    .user-item {
        font-size: 12px;
    }

    .tab {
        padding: 0 12px;
    }
}
