﻿
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none !important;
}

:root {
    --red: #c0392b;
    --gold: #c8973a;
    --dark: #1c1c2e;
    --dark2: #2a2040;
    --cream: #f7f3ef;
    --surface: #ffffff;
    --muted: #7a7a8c;
    --border: #e8e2da;
    --online: #27ae60;
    --bubble-out: #1c1c2e;
    --bubble-in: #ffffff;
    --shadow: 0 2px 16px rgba(0,0,0,0.07);
    --r: 14px;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Jost', sans-serif;
    background: var(--cream);
    color: var(--dark);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}



/* ── CHAT SHELL ── */
.chat-page {
    max-width: 1260px;
    margin: 42px auto 0;
    padding: 0 20px 60px;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    flex: 1;
}

/* ── PEOPLE SIDEBAR ── */
.chat-sidebar {
    background: var(--surface);
    border-radius: var(--r);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    position: sticky;
    top: 90px;
}

.cs-header {
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border);
}

    .cs-header h4 {
        font-family: 'Cormorant Garamond', serif;
        font-size: 1.15rem;
        font-weight: 700;
        margin-bottom: 10px;
        color: var(--dark);
    }

.cs-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--cream);
    border: 1.5px solid var(--border);
    border-radius: 50px;
    padding: 7px 14px;
}

    .cs-search i {
        color: var(--muted);
        font-size: 12px;
    }

    .cs-search input {
        border: none;
        outline: none;
        font-family: 'Jost', sans-serif;
        font-size: 13px;
        background: transparent;
        width: 100%;
        color: var(--dark);
    }

.cs-list {
    overflow-y: auto;
    flex: 1;
}

    .cs-list::-webkit-scrollbar {
        width: 4px;
    }

    .cs-list::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 4px;
    }

/* People list item */
.cs-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background .15s;
    text-decoration: none !important;
    color: inherit !important;
}

0
.cs-item:last-child {
    border-bottom: none;
}

.cs-item:hover {
    background: #fdf8f3;
}

.cs-item.active {
    background: rgba(192,57,43,0.06);
    border-right: 3px solid var(--red);
}

.cs-avatar {
    position: relative;
    flex-shrink: 0;
}

    .cs-avatar img {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid var(--border);
    }

.cs-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid #fff;
}

    .cs-dot.on {
        background: var(--online);
    }

    .cs-dot.off {
        background: #bbb;
    }

.cs-info {
    flex: 1;
    min-width: 0;
}

    .cs-info h6 {
        font-size: 13.5px;
        font-weight: 600;
        color: var(--dark);
        margin: 0 0 2px;
    }

    .cs-info small {
        font-size: 12px;
        color: var(--muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        max-width: 130px;
    }

        .cs-info small.unread {
            color: var(--dark);
            font-weight: 600;
        }

.cs-badge {
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}

/* ── CHAT WINDOW ── */
.chat-window {
    background: var(--surface);
    border-radius: var(--r);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    overflow: hidden;
}

/* Chat header */
.cw-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 100%);
    border-radius: var(--r) var(--r) 0 0;
    flex-shrink: 0;
}

.cw-back {
    color: rgba(255,255,255,0.7) !important;
    font-size: 18px;
    display: none;
    margin-right: 4px;
}

.cw-avatar {
    position: relative;
    flex-shrink: 0;
}

    .cw-avatar img {
        width: 46px;
        height: 46px;
        border-radius: 50%;
        object-fit: cover;
        border: 2.5px solid rgba(200,151,58,0.5);
    }

.cw-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--dark2);
    background: var(--online);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%,100% {
        box-shadow: 0 0 0 2px rgba(39,174,96,.3)
    }

    50% {
        box-shadow: 0 0 0 5px rgba(39,174,96,.08)
    }
}

.cw-hinfo {
    flex: 1;
}

    .cw-hinfo h4 {
        font-family: 'Cormorant Garamond', serif;
        font-size: 1.15rem;
        font-weight: 700;
        color: #fff;
        margin: 0;
    }

    .cw-hinfo small {
        font-size: 12px;
        color: var(--online);
        font-weight: 500;
    }

.cw-actions {
    display: flex;
    gap: 6px;
}

.cw-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.8) !important;
    font-size: 14px;
    cursor: pointer;
    transition: .2s;
}

    .cw-btn:hover {
        background: rgba(255,255,255,0.18);
        color: #fff !important;
    }

/* Message area */
.cw-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #faf7f4;
}

    .cw-body::-webkit-scrollbar {
        width: 4px;
    }

    .cw-body::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 4px;
    }

/* Day divider */
.day-divider {
    text-align: center;
    margin: 16px 0 10px;
}

    .day-divider span {
        font-size: 11.5px;
        background: rgba(0,0,0,0.08);
        color: var(--muted);
        padding: 4px 14px;
        border-radius: 20px;
        font-weight: 500;
        letter-spacing: 0.5px;
    }

/* Message bubbles */
.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 4px;
}

    .msg-row.out {
        flex-direction: row-reverse;
    }

        .msg-row.out + .msg-row.out {
            margin-top: 1px;
        }

    .msg-row.in + .msg-row.in {
        margin-top: 1px;
    }

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.msg-row.out .msg-avatar {
    display: none;
}

.msg-bubble-wrap {
    display: flex;
    flex-direction: column;
    max-width: 65%;
}

.msg-row.out .msg-bubble-wrap {
    align-items: flex-end;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.55;
    position: relative;
    word-break: break-word;
}

.msg-row.in .msg-bubble {
    background: var(--bubble-in);
    color: var(--dark);
    border-radius: 4px 18px 18px 18px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.msg-row.out .msg-bubble {
    background: var(--bubble-out);
    color: #fff;
    border-radius: 18px 4px 18px 18px;
}

/* First/last bubble rounding */
.msg-row.in.first .msg-bubble {
    border-top-left-radius: 18px;
}

.msg-row.in.last .msg-bubble {
    border-bottom-left-radius: 18px;
}

.msg-row.out.first .msg-bubble {
    border-top-right-radius: 18px;
}

.msg-row.out.last .msg-bubble {
    border-bottom-right-radius: 18px;
}

.msg-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
    padding: 0 2px;
}

.msg-time {
    font-size: 11px;
    color: var(--muted);
}

.msg-tick {
    font-size: 12px;
    color: var(--muted);
}

    .msg-tick.read {
        color: #1da1f2;
    }

/* Typing indicator */
.typing-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.typing-bubble {
    background: var(--bubble-in);
    border-radius: 18px;
    padding: 12px 16px;
    display: flex;
    gap: 4px;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    animation: bounce .9s infinite;
}

    .typing-dot:nth-child(2) {
        animation-delay: .15s;
    }

    .typing-dot:nth-child(3) {
        animation-delay: .3s;
    }

@keyframes bounce {
    0%,60%,100% {
        transform: translateY(0)
    }

    30% {
        transform: translateY(-5px)
    }
}

/* Input area */
.cw-input-wrap {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--surface);
    flex-shrink: 0;
}

.cw-input-btns {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.cw-inp-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--cream);
    border: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    cursor: pointer;
    transition: .2s;
    font-size: 15px;
}

    .cw-inp-btn:hover {
        color: var(--red);
        border-color: var(--red);
    }

.cw-textarea-wrap {
    flex: 1;
    background: var(--cream);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    transition: border-color .2s;
}

    .cw-textarea-wrap:focus-within {
        border-color: var(--red);
    }

    .cw-textarea-wrap textarea {
        flex: 1;
        border: none;
        outline: none;
        background: transparent;
        font-family: 'Jost', sans-serif;
        font-size: 14px;
        color: var(--dark);
        resize: none;
        max-height: 100px;
        line-height: 1.5;
        overflow-y: auto;
    }

.cw-emoji-btn {
    color: var(--muted);
    cursor: pointer;
    font-size: 18px;
    transition: .2s;
    flex-shrink: 0;
}

    .cw-emoji-btn:hover {
        color: var(--gold);
    }

.cw-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--red);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: .2s;
    flex-shrink: 0;
}

    .cw-send:hover {
        background: #962d22;
        transform: scale(1.05);
    }

    .cw-send:active {
        transform: scale(0.97);
    }

/* ── EMPTY STATE (no chat selected) ── */
.cw-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--muted);
    text-align: center;
    padding: 40px;
}

    .cw-empty .big-icon {
        font-size: 56px;
        margin-bottom: 16px;
        opacity: .25;
    }

    .cw-empty h3 {
        font-family: 'Cormorant Garamond', serif;
        font-size: 1.4rem;
        color: var(--dark);
        margin-bottom: 8px;
    }

    .cw-empty p {
        font-size: 14px;
    }

/* ── PROFILE STRIP ── */
.cw-profile-strip {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--cream);
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

    .cw-profile-strip img {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        object-fit: cover;
    }

.cw-strip-info {
    flex: 1;
}

    .cw-strip-info h6 {
        margin: 0;
        font-size: 13.5px;
        font-weight: 600;
    }

    .cw-strip-info small {
        font-size: 12px;
        color: var(--muted);
    }

.cw-profile-strip a {
    font-size: 12.5px;
    color: var(--red) !important;
    font-weight: 600;
    border: 1.5px solid var(--red);
    border-radius: 20px;
    padding: 5px 14px;
    transition: .2s;
    white-space: nowrap;
}

    .cw-profile-strip a:hover {
        background: var(--red);
        color: #fff !important;
    }

/* ── MOBILE ── */
@media(max-width:768px) {
    .chat-page {
        grid-template-columns: 1fr;
        padding: 0 0 60px;
        margin: 0;
    }

    .chat-sidebar {
        position: fixed;
        inset: 0;
        z-index: 500;
        border-radius: 0;
        height: 100vh;
        top: 0;
        transform: translateX(-100%);
        transition: transform .3s;
    }

        .chat-sidebar.mob-open {
            transform: translateX(0);
        }

    .chat-window {
        border-radius: 0;
        height: calc(100vh - 66px);
        border: none;
    }

    .cw-back {
        display: flex !important;
    }
}


