* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --blue: #1687ff;
    --blue-light: #42b5ff;
    --bg: #050a12;
    --panel: #091322;
    --panel-2: #0d1a2b;
    --border: rgba(255,255,255,.09);
    --text: #ffffff;
    --muted: #8d9bad;
    --danger: #ff4d67;
    --success: #31d07c;
}

body {
    font-family:
        Tahoma,
        Arial,
        sans-serif;

    background: var(--bg);
    color: var(--text);

    min-height: 100vh;
}


/* =========================
   AUTH
========================= */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;

    padding: 20px;

    background:
        radial-gradient(
            circle at top,
            #0d2948 0,
            #050a12 55%
        );
}


.auth-box {
    width: 100%;
    max-width: 430px;

    background:
        rgba(9,19,34,.9);

    border: 1px solid var(--border);

    border-radius: 26px;

    padding: 30px;

    box-shadow:
        0 25px 70px
        rgba(0,0,0,.4);

    backdrop-filter: blur(20px);
}


.logo {
    display: flex;
    align-items: center;
    gap: 13px;

    margin-bottom: 28px;
}


.logo h1 {
    font-size: 23px;
}


.logo span {
    display: block;

    color: var(--muted);

    font-size: 12px;

    margin-top: 5px;
}


.logo-icon {
    width: 55px;
    height: 55px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 17px;

    background:
        linear-gradient(
            135deg,
            var(--blue),
            var(--blue-light)
        );

    font-size: 28px;
    font-weight: bold;

    box-shadow:
        0 8px 30px
        rgba(22,135,255,.35);
}


.logo-icon.small {
    width: 42px;
    height: 42px;

    border-radius: 13px;

    font-size: 21px;
}


.tabs {
    display: flex;

    background: #050c16;

    border-radius: 14px;

    padding: 4px;

    margin-bottom: 22px;
}


.tab {
    width: 50%;

    border: 0;

    background: transparent;

    color: var(--muted);

    padding: 12px;

    border-radius: 11px;

    cursor: pointer;

    font-size: 14px;
}


.tab.active {
    background: var(--blue);

    color: white;
}


.form {
    display: flex;

    flex-direction: column;

    gap: 14px;
}


.hidden {
    display: none !important;
}


input {
    width: 100%;

    border: 1px solid var(--border);

    outline: none;

    background: #050d18;

    color: white;

    border-radius: 13px;

    padding: 14px;

    font-size: 14px;

    transition: .2s;
}


input:focus {
    border-color: var(--blue);

    box-shadow:
        0 0 0 3px
        rgba(22,135,255,.12);
}


.password-box {
    position: relative;
}


.password-box input {
    padding-left: 50px;
}


.password-box button {
    position: absolute;

    left: 7px;
    top: 7px;

    width: 40px;
    height: 40px;

    border: 0;

    border-radius: 10px;

    background: transparent;

    color: var(--muted);

    cursor: pointer;
}


.main-btn {
    border: 0;

    background:
        linear-gradient(
            135deg,
            var(--blue),
            var(--blue-light)
        );

    color: white;

    border-radius: 13px;

    padding: 14px;

    font-size: 15px;

    font-weight: bold;

    cursor: pointer;

    transition: .2s;
}


.main-btn:hover {
    transform: translateY(-1px);

    box-shadow:
        0 10px 25px
        rgba(22,135,255,.25);
}


.password-strength {
    width: 100%;
    height: 5px;

    background: #172333;

    border-radius: 10px;

    overflow: hidden;
}


#strengthBar {
    width: 0;
    height: 100%;

    background: var(--blue);

    transition: .3s;
}


#strengthText {
    color: var(--muted);

    font-size: 11px;
}


#message {
    margin-top: 16px;

    text-align: center;

    font-size: 13px;
}


#message.error {
    color: var(--danger);
}


#message.success {
    color: var(--success);
}


#message.loading {
    color: var(--blue-light);
}


/* =========================
   CHAT
========================= */

.chat-page {
    overflow: hidden;
}


.chat-app {
    height: 100vh;

    display: flex;

    background: var(--bg);
}


/* SIDEBAR */

.sidebar {
    width: 330px;

    flex-shrink: 0;

    background:
        rgba(9,19,34,.96);

    border-left: 1px solid var(--border);

    display: flex;

    flex-direction: column;
}


.sidebar-top {
    display: flex;

    align-items: center;

    justify-content: space-between;

    padding: 18px;

    border-bottom: 1px solid var(--border);
}


.brand {
    display: flex;

    align-items: center;

    gap: 10px;
}


.brand strong {
    display: block;
}


.brand small {
    display: block;

    color: var(--muted);

    font-size: 11px;

    margin-top: 3px;
}


.logout {
    color: var(--danger);

    text-decoration: none;

    font-size: 12px;
}


.search-box {
    padding: 15px;

    position: relative;
}


.search-box input {
    background: #050d18;
}


#searchResults {
    position: absolute;

    top: 70px;

    right: 15px;
    left: 15px;

    background: #0b1727;

    border: 1px solid var(--border);

    border-radius: 14px;

    overflow: hidden;

    z-index: 20;

    box-shadow:
        0 15px 40px
        rgba(0,0,0,.45);
}


.search-user {
    width: 100%;

    border: 0;

    background: transparent;

    color: white;

    display: flex;

    align-items: center;

    gap: 10px;

    padding: 11px;

    text-align: right;

    cursor: pointer;
}


.search-user:hover {
    background: rgba(255,255,255,.05);
}


.search-user strong {
    display: block;
}


.search-user small {
    color: var(--muted);

    font-size: 10px;
}


.no-result {
    color: var(--muted);

    text-align: center;

    padding: 15px;

    font-size: 12px;
}


.user-info {
    margin-top: auto;

    padding: 17px;

    border-top: 1px solid var(--border);

    display: flex;

    align-items: center;

    gap: 12px;
}


.user-info strong {
    display: block;
}


.user-info span {
    color: var(--muted);

    font-size: 11px;
}


/* AVATAR */

.avatar {
    width: 42px;
    height: 42px;

    flex-shrink: 0;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background:
        linear-gradient(
            135deg,
            var(--blue),
            #1251a3
        );

    color: white;

    font-weight: bold;
}


/* CHAT MAIN */

.chat-main {
    flex: 1;

    min-width: 0;

    display: flex;

    flex-direction: column;
}


.chat-header {
    height: 75px;

    flex-shrink: 0;

    display: flex;

    align-items: center;

    gap: 12px;

    padding: 12px 20px;

    background:
        rgba(9,19,34,.8);

    border-bottom: 1px solid var(--border);
}


.chat-header strong {
    display: block;
}


.chat-header span {
    display: block;

    color: var(--muted);

    font-size: 11px;

    margin-top: 4px;
}


/* MESSAGES */

.messages {
    flex: 1;

    overflow-y: auto;

    padding: 25px;

    scroll-behavior: smooth;
}


.empty-chat {
    height: 100%;

    display: flex;

    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;

    color: var(--muted);
}


.empty-chat h2 {
    color: white;

    font-size: 20px;

    margin: 10px 0 7px;
}


.empty-chat p {
    font-size: 13px;
}


.empty-icon {
    width: 65px;
    height: 65px;

    display: flex;

    align-items: center;
    justify-content: center;

    background:
        rgba(22,135,255,.12);

    border-radius: 20px;

    font-size: 28px;
}


.message-row {
    display: flex;

    margin-bottom: 9px;
}


.message-row.mine {
    justify-content: flex-start;
}


.message-row.other {
    justify-content: flex-end;
}


.message {
    max-width: min(70%, 600px);

    padding: 10px 13px;

    border-radius: 16px;

    background: #101d2e;

    border: 1px solid var(--border);
}


.message-row.mine .message {
    background:
        linear-gradient(
            135deg,
            #096bd5,
            #1687ff
        );

    border-bottom-right-radius: 5px;
}


.message-row.other .message {
    border-bottom-left-radius: 5px;
}


.message-text {
    white-space: pre-wrap;

    word-break: break-word;

    font-size: 14px;

    line-height: 1.7;
}


.message-time {
    font-size: 9px;

    opacity: .65;

    margin-top: 4px;
}


/* MESSAGE INPUT */

.message-form {
    display: flex;

    gap: 9px;

    padding: 14px 18px;

    background:
        rgba(9,19,34,.96);

    border-top: 1px solid var(--border);
}


.message-form input {
    flex: 1;
}


.message-form button {
    width: 48px;

    border: 0;

    border-radius: 13px;

    background: var(--blue);

    color: white;

    font-size: 20px;

    cursor: pointer;
}


/* SCROLLBAR */

::-webkit-scrollbar {
    width: 7px;
}


::-webkit-scrollbar-track {
    background: transparent;
}


::-webkit-scrollbar-thumb {
    background: #1b3048;

    border-radius: 20px;
}


/* =========================
   MOBILE
========================= */

@media (max-width: 700px) {

    .auth-page {
        padding: 12px;
    }


    .auth-box {
        padding: 22px;

        border-radius: 20px;
    }


    .chat-app {
        display: block;
    }


    .sidebar {
        width: 100%;

        height: 125px;

        border-left: 0;

        border-bottom: 1px solid var(--border);
    }


    .sidebar-top {
        padding: 10px 14px;
    }


    .search-box {
        padding: 8px 12px;
    }


    #searchResults {
        top: 55px;

        right: 12px;
        left: 12px;
    }


    .user-info {
        display: none;
    }


    .chat-main {
        height:
            calc(100vh - 125px);
    }


    .chat-header {
        height: 62px;

        padding: 9px 14px;
    }


    .messages {
        padding: 14px;
    }


    .message {
        max-width: 82%;
    }


    .message-form {
        padding: 9px;
    }


    .message-form button {
        width: 45px;
    }
}


@media (max-width: 380px) {

    .auth-box {
        padding: 18px;
    }


    .logo h1 {
        font-size: 20px;
    }


    .message-text {
        font-size: 13px;
    }

}