/* ═══════════════════════════════════════════════
   ChatWave — Stijlblad
   Donker thema, modern & clean
═══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg-base:      #0d0f14;
    --bg-sidebar:   #13161e;
    --bg-card:      #1a1e29;
    --bg-input:     #1f2434;
    --bg-hover:     #222840;
    --bg-active:    #252c44;
    --bg-msg-mine:  #3b5bdb;
    --bg-msg-them:  #1f2434;

    --accent:       #4c6ef5;
    --accent-hover: #5c7cfa;
    --accent-soft:  rgba(76,110,245,.15);
    --danger:       #f03e3e;
    --success:      #37b24d;
    --warning:      #f59f00;

    --text-main:    #e8ecf5;
    --text-sub:     #7e8aa8;
    --text-muted:   #4a5170;

    --border:       rgba(255,255,255,.06);
    --radius:       14px;
    --radius-sm:    8px;
    --shadow:       0 8px 32px rgba(0,0,0,.4);
    --font:         'Plus Jakarta Sans', sans-serif;
    --sidebar-w:    300px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; font-family: var(--font); background: var(--bg-base); color: var(--text-main); font-size: 15px; -webkit-font-smoothing: antialiased; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { font-family: inherit; }

/* ══ SCROLLBAR ════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 4px; }

/* ══ AUTH PAGES ══════════════════════════════ */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; background: radial-gradient(ellipse at 30% 20%, rgba(76,110,245,.12) 0%, transparent 60%), var(--bg-base); }

.auth-container { width: 100%; max-width: 420px; }

.auth-logo { text-align: center; margin-bottom: 32px; }
.logo-wave { font-size: 48px; display: block; margin-bottom: 8px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.auth-logo h1 { font-size: 32px; font-weight: 700; background: linear-gradient(135deg, #fff 0%, var(--accent) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.auth-logo p { color: var(--text-sub); margin-top: 6px; }

.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 24px; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px; }
.form-group input[type=text],
.form-group input[type=email],
.form-group input[type=password] { width: 100%; padding: 12px 16px; background: var(--bg-input); border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--text-main); font-size: 15px; transition: border .2s; outline: none; }
.form-group input:focus { border-color: var(--accent); }

.avatar-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.avatar-opt { width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; font-size: 22px; border-radius: 10px; background: var(--bg-input); border: 2px solid transparent; cursor: pointer; transition: all .2s; }
.avatar-opt:hover { border-color: var(--accent-hover); transform: scale(1.1); }
.avatar-opt.selected { border-color: var(--accent); background: var(--accent-soft); }

.btn-primary { background: var(--accent); color: #fff; padding: 12px 24px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600; transition: background .2s, transform .1s; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(.98); }
.btn-secondary { background: var(--bg-input); color: var(--text-main); padding: 12px 24px; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600; transition: background .2s; }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-full { width: 100%; }

.auth-switch { text-align: center; margin-top: 20px; color: var(--text-sub); font-size: 14px; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 18px; }
.alert-error   { background: rgba(240,62,62,.12); border: 1px solid rgba(240,62,62,.3); color: #ff6b6b; }
.alert-success { background: rgba(55,178,77,.12); border: 1px solid rgba(55,178,77,.3); color: #69db7c; }

/* ══ CHAT LAYOUT ══════════════════════════════ */
.chat-page { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ── */
.sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--bg-sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; height: 100vh; overflow: hidden; z-index: 10; }

.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.me-info { display: flex; align-items: center; gap: 10px; }
.my-avatar { font-size: 28px; }
.me-text strong { display: block; font-size: 14px; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.online { background: var(--success); box-shadow: 0 0 0 2px rgba(55,178,77,.3); }

.sidebar-actions { display: flex; gap: 4px; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 16px; color: var(--text-sub); transition: background .2s, color .2s; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-main); }

.sidebar-tabs { display: flex; border-bottom: 1px solid var(--border); }
.tab-btn { flex: 1; padding: 10px 0; font-size: 13px; font-weight: 600; color: var(--text-sub); transition: color .2s; border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--text-main); }

.sidebar-search { padding: 12px 12px 8px; }
.sidebar-search input { width: 100%; padding: 9px 14px; background: var(--bg-input); border: 1.5px solid var(--border); border-radius: 20px; color: var(--text-main); font-size: 14px; outline: none; transition: border .2s; }
.sidebar-search input:focus { border-color: var(--accent); }

.tab-content { display: none; flex: 1; overflow-y: auto; }
.tab-content.active { display: block; }

/* ── List items ── */
.list-items { padding: 6px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; transition: background .15s; position: relative; }
.list-item:hover { background: var(--bg-hover); }
.list-item.active { background: var(--bg-active); }

.item-avatar { font-size: 26px; position: relative; flex-shrink: 0; }
.status-bubble { position: absolute; bottom: 0; right: -2px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--bg-sidebar); }
.status-bubble.online  { background: var(--success); }
.status-bubble.away    { background: var(--warning); }
.status-bubble.offline { background: var(--text-muted); }

.item-info { flex: 1; min-width: 0; }
.item-info strong { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-info small { font-size: 12px; color: var(--text-sub); }
.item-top { display: flex; justify-content: space-between; align-items: baseline; }
.item-top strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.item-top small { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.item-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.item-preview { font-size: 13px; color: var(--text-sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }

.badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 10px; flex-shrink: 0; }
.badge-green  { background: rgba(55,178,77,.2); color: #69db7c; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.badge-yellow { background: rgba(245,159,0,.15); color: #fcc419; font-size: 12px; padding: 2px 8px; border-radius: 6px; }

.request-btns { display: flex; gap: 6px; }
.btn-xs { padding: 4px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.btn-xs.btn-primary  { background: var(--accent); color: #fff; }
.btn-xs.btn-danger   { background: rgba(240,62,62,.2); color: #ff6b6b; }
.danger-btn { color: var(--danger) !important; opacity: 0; transition: opacity .15s !important; }
.list-item:hover .danger-btn { opacity: 1; }

.empty-msg { text-align: center; padding: 30px 20px; color: var(--text-muted); font-size: 14px; line-height: 1.7; }

/* ── Main chat area ── */
.chat-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.chat-welcome { flex: 1; display: flex; align-items: center; justify-content: center; }
.welcome-inner { text-align: center; }
.welcome-icon { font-size: 64px; display: block; margin-bottom: 16px; animation: float 3s ease-in-out infinite; }
.welcome-inner h2 { font-size: 26px; font-weight: 700; margin-bottom: 10px; }
.welcome-inner p { color: var(--text-sub); margin-bottom: 24px; }
.welcome-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.chat-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ── Chat header ── */
.chat-header { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--bg-sidebar); }
.chat-avatar-big { font-size: 32px; }
.chat-header-info { flex: 1; }
.chat-header-info strong { display: block; font-size: 16px; font-weight: 700; }
.chat-header-info small { font-size: 13px; color: var(--text-sub); }
.chat-header-actions { display: flex; gap: 6px; }
.mobile-back { display: none; }

/* ── Messages ── */
.messages-area { flex: 1; overflow-y: auto; padding: 20px 20px 10px; display: flex; flex-direction: column; gap: 4px; }
.messages-area .empty-msg.center { margin: auto; }

.msg-wrap { display: flex; align-items: flex-end; gap: 8px; max-width: 75%; animation: msgIn .2s ease-out; }
@keyframes msgIn { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform: translateY(0); } }
.msg-wrap.mine   { align-self: flex-end; flex-direction: row-reverse; }
.msg-wrap.theirs { align-self: flex-start; }

.msg-avatar { font-size: 22px; margin-bottom: 2px; flex-shrink: 0; }

.msg-bubble { max-width: 100%; }
.msg-sender { font-size: 12px; font-weight: 600; color: var(--accent); margin-bottom: 3px; padding-left: 4px; }
.msg-text { padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.55; word-break: break-word; }
.mine   .msg-text { background: var(--bg-msg-mine); color: #fff; border-bottom-right-radius: 4px; }
.theirs .msg-text { background: var(--bg-msg-them); color: var(--text-main); border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.msg-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; padding: 0 4px; }
.mine   .msg-time { text-align: right; }
.theirs .msg-time { text-align: left; }

/* ── Message input ── */
.message-input-bar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); background: var(--bg-sidebar); }
.message-input-bar input { flex: 1; padding: 12px 18px; background: var(--bg-input); border: 1.5px solid var(--border); border-radius: 24px; color: var(--text-main); font-size: 15px; outline: none; transition: border .2s; }
.message-input-bar input:focus { border-color: var(--accent); }
.send-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; transition: background .2s, transform .1s; flex-shrink: 0; }
.send-btn:hover { background: var(--accent-hover); }
.send-btn:active { transform: scale(.92); }
.send-btn svg { width: 18px; height: 18px; }

/* ══ MODALS ═══════════════════════════════════ */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 100; align-items: center; justify-content: center; padding: 20px; }

.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); width: 100%; max-width: 420px; max-height: 80vh; display: flex; flex-direction: column; box-shadow: var(--shadow); animation: modalIn .2s ease-out; }
@keyframes modalIn { from { opacity:0; transform: scale(.95) translateY(10px); } to { opacity:1; transform: scale(1) translateY(0); } }

.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-header button { width: 30px; height: 30px; border-radius: 6px; font-size: 14px; color: var(--text-sub); }
.modal-header button:hover { background: var(--bg-hover); color: var(--text-main); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-body input[type=text] { width: 100%; padding: 11px 14px; background: var(--bg-input); border: 1.5px solid var(--border); border-radius: var(--radius-sm); color: var(--text-main); font-size: 15px; outline: none; transition: border .2s; margin-bottom: 14px; }
.modal-body input:focus { border-color: var(--accent); }
.modal-label { font-size: 13px; font-weight: 600; color: var(--text-sub); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }

.search-results { margin-top: 6px; }
.check-list { display: flex; flex-direction: column; gap: 4px; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 15px; transition: background .15s; }
.check-item:hover { background: var(--bg-hover); }
.check-item input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* ══ MOBILE ═══════════════════════════════════ */
.mobile-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 5; }

@media (max-width: 700px) {
    .sidebar { width: 100%; min-width: 100%; position: fixed; inset: 0; transform: translateX(0); transition: transform .25s; z-index: 10; }
    .chat-main { width: 100%; position: fixed; inset: 0; transform: translateX(100%); transition: transform .25s; z-index: 15; }
    .chat-main.mobile-open { transform: translateX(0); }
    .mobile-back { display: inline-flex !important; }
}

/* ── Remember Me checkbox ── */
.form-check { margin-bottom: 18px; }
.check-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--text-sub); }
.check-label input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
