*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --blue: #2563eb;
    --blue-light: #dbeafe;
    --blue-mid: #93c5fd;
    --navy: #1e3a5f;
    --navy-light: #4b6a8a;
    --bg: #f7faff;
    --white: #fff;
    --border: #cddcf5;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--navy);
    min-height: 100vh;
}

/* NAV */
.vp-nav {
    background: var(--white);
    border-bottom: 0.5px solid var(--border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.vp-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.vp-logo-dot {
    width: 28px;
    height: 28px;
    background: var(--blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 11px;
    color: #fff;
}

.vp-logo-name {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--navy);
}

.vp-nav-back {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--navy-light);
    text-decoration: none;
    transition: color .2s;
}

.vp-nav-back:hover {
    color: var(--navy);
}

/* LAYOUT */
.page-wrap {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: calc(100vh - 50px);
}

/* SIDEBAR */
.sidebar {
    background: var(--white);
    border-right: 0.5px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 18px 18px 14px;
    border-bottom: 0.5px solid var(--border);
    flex-shrink: 0;
}

.sidebar-eyebrow {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--blue);
    margin-bottom: 4px;
}

.sidebar-header h1 {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 17px;
    color: var(--navy);
    margin-bottom: 3px;
}

.sidebar-header p {
    font-size: 11px;
    color: var(--navy-light);
    line-height: 1.5;
}

.sidebar-divider {
    width: 28px;
    height: 2px;
    background: var(--blue-mid);
    border-radius: 2px;
    margin: 8px 0 0;
}

.room-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 10px;
}

.room-list::-webkit-scrollbar {
    width: 4px;
}

.room-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.room-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 11px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
    border: 0.5px solid transparent;
    margin-bottom: 4px;
}

.room-item:hover {
    background: var(--bg);
    border-color: var(--border);
}

.room-item.active {
    background: var(--blue-light);
    border-color: #93c5fd;
}

.room-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: var(--blue-light);
    color: var(--blue);
    transition: background .15s;
}

.room-item.active .room-icon {
    background: var(--blue);
    color: #fff;
}

.room-meta {
    flex: 1;
    min-width: 0;
}

.room-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--navy);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-desc {
    font-size: 10px;
    color: var(--navy-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-count {
    font-size: 10px;
    color: var(--navy-light);
    flex-shrink: 0;
    margin-top: 2px;
}

/* CHAT AREA */
.chat-area {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: var(--white);
    border-bottom: 0.5px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chat-header-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--blue-light);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-header-info {
    flex: 1;
}

.chat-header-name {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 15px;
    color: var(--navy);
}

.chat-header-sub {
    font-size: 11px;
    color: var(--navy-light);
}

.chat-header-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--blue-light);
    color: var(--blue);
    font-size: 10px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 50px;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse 1.8s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .35;
    }
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* Welcome state */
.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    gap: 12px;
}

.chat-welcome-icon {
    width: 56px;
    height: 56px;
    background: var(--blue-light);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: var(--blue);
}

.chat-welcome h2 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--navy);
}

.chat-welcome p {
    font-size: 12px;
    color: var(--navy-light);
    max-width: 280px;
    line-height: 1.65;
}

/* Messages */
.msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.msg.own {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue);
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.msg.own .msg-avatar {
    background: var(--navy);
    color: #fff;
}

.msg-body {
    max-width: 65%;
}

.msg-name {
    font-size: 10px;
    color: var(--navy-light);
    margin-bottom: 3px;
    font-weight: 500;
}

.msg.own .msg-name {
    text-align: right;
}

.msg-bubble {
    background: var(--white);
    border: 0.5px solid var(--border);
    border-radius: 14px 14px 14px 4px;
    padding: 9px 13px;
    font-size: 12px;
    line-height: 1.65;
    color: var(--navy);
}

.msg.own .msg-bubble {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
    border-radius: 14px 14px 4px 14px;
}

.msg-time {
    font-size: 9px;
    color: var(--navy-light);
    margin-top: 3px;
    padding: 0 2px;
}

.msg.own .msg-time {
    text-align: right;
}

/* Date separator */
.date-sep {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 10px;
    color: var(--navy-light);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.date-sep::before,
.date-sep::after {
    content: '';
    flex: 1;
    height: 0.5px;
    background: var(--border);
}

/* Input bar */
.chat-input-bar {
    background: var(--white);
    border-top: 0.5px solid var(--border);
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

.chat-input-wrap {
    flex: 1;
    background: var(--bg);
    border: 0.5px solid var(--border);
    border-radius: 20px;
    display: flex;
    align-items: center;
    padding: 7px 14px;
    gap: 8px;
    transition: border-color .2s;
}

.chat-input-wrap:focus-within {
    border-color: var(--blue);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    color: var(--navy);
    outline: none;
    resize: none;
    max-height: 80px;
    line-height: 1.5;
}

.chat-input::placeholder {
    color: #a0b4cc;
}

.chat-send-btn {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    background: var(--blue);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .2s;
}

.chat-send-btn:hover {
    opacity: .85;
}

.chat-send-btn:disabled {
    opacity: .4;
    cursor: default;
}

.input-nickname {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nickname-pill {
    background: var(--blue-light);
    color: var(--blue);
    font-size: 10px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 50px;
    cursor: pointer;
    border: none;
    font-family: 'DM Sans', sans-serif;
    transition: background .15s;
}

.nickname-pill:hover {
    background: #bfdbfe;
}

/* Nickname modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(30, 58, 95, .35);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--white);
    border-radius: 16px;
    padding: 28px 28px 22px;
    width: 320px;
    box-shadow: 0 16px 48px rgba(30, 58, 95, .15);
    transform: translateY(12px);
    transition: transform .2s;
}

.modal-overlay.open .modal {
    transform: translateY(0);
}

.modal h3 {
    font-family: 'Playfair Display', serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 5px;
}

.modal p {
    font-size: 11px;
    color: var(--navy-light);
    margin-bottom: 14px;
}

.modal input {
    width: 100%;
    padding: 8px 14px;
    border: 0.5px solid var(--border);
    border-radius: 50px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    color: var(--navy);
    outline: none;
    margin-bottom: 12px;
}

.modal input:focus {
    border-color: var(--blue);
}

.modal-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.modal-cancel {
    background: none;
    border: 0.5px solid var(--border);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 11px;
    color: var(--navy-light);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
}

.modal-ok {
    background: var(--blue);
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--navy);
    color: #fff;
    padding: 9px 20px;
    border-radius: 50px;
    font-size: 12px;
    z-index: 999;
    opacity: 0;
    transition: opacity .3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    gap: 10px;
    align-items: center;
    opacity: 0;
    transition: opacity .3s;
    height: 0;
    overflow: hidden;
}

.typing-indicator.visible {
    opacity: 1;
    height: auto;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--navy-light);
    animation: bounce 1.2s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: .2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: .4s;
}

@keyframes bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

.typing-label {
    font-size: 10px;
    color: var(--navy-light);
}