/* ============================================================
   WIDGETS — Alumni67 Connect
   CSS statis (tanpa npm build) untuk:
   1. Ikon notifikasi 🔔 (navbar, pojok kanan atas)
   2. Widget chat 💬 (melayang, pojok kanan bawah)
   Memakai design token --c-* (auto dark/light mode).
   ============================================================ */

/* ---------- 1. IKON LONCENG NOTIFIKASI ---------- */
.notif-btn {
    position: relative;
    display: flex;
    height: 2.25rem;
    width: 2.25rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    border: 1px solid rgb(var(--c-line) / 0.4);
    color: rgb(var(--c-cream-dim));
    transition: all 0.2s;
    cursor: pointer;
    background: transparent;
}
.notif-btn:hover { border-color: rgb(var(--c-neon)); color: rgb(var(--c-neon)); }

/* Titik merah jumlah belum dibaca */
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 1.05rem;
    height: 1.05rem;
    padding: 0 0.25rem;
    display: none; /* muncul via JS bila > 0 */
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: #ef4444;
    color: #fff;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    border: 2px solid rgb(var(--c-navy-deep));
}
.notif-badge.show { display: flex; }
.notif-badge.pulse { animation: notif-pop 0.45s ease; }
@keyframes notif-pop { 0% { transform: scale(0.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* Dropdown daftar notifikasi (di bawah lonceng) */
.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 60;
    width: min(22rem, calc(100vw - 2rem));
    max-height: 26rem;
    display: flex;
    flex-direction: column;
    border-radius: 0.6rem;
    border: 1px solid rgb(var(--c-neon-dim) / 0.4);
    background: rgb(var(--c-navy-deep) / 0.98);
    box-shadow: 0 16px 48px rgb(0 0 0 / 0.55);
    backdrop-filter: blur(8px);
    overflow: hidden;
}
.notif-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid rgb(var(--c-line) / 0.15);
}
.notif-head b { font-size: 0.8rem; color: rgb(var(--c-cream)); }
.notif-list { overflow-y: auto; }

/* Satu baris notifikasi */
.notif-item {
    display: flex;
    gap: 0.6rem;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid rgb(var(--c-line) / 0.08);
    text-decoration: none;
    transition: background 0.15s;
    cursor: pointer;
}
.notif-item:hover { background: rgb(var(--c-neon) / 0.06); }
.notif-item.unread { background: rgb(var(--c-neon) / 0.08); }
.notif-item .n-icon { font-size: 1rem; line-height: 1.4; flex-shrink: 0; }
.notif-item .n-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(var(--c-cream));
    line-height: 1.3;
}
.notif-item.unread .n-title { color: rgb(var(--c-neon)); }
.notif-item .n-msg {
    font-size: 0.7rem;
    color: rgb(var(--c-cream-dim));
    line-height: 1.35;
    margin-top: 1px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.notif-item .n-when {
    font-family: 'Space Mono', monospace;
    font-size: 0.6rem;
    color: rgb(var(--c-cream-dim) / 0.7);
    margin-top: 3px;
}
.notif-empty { padding: 1.5rem 1rem; text-align: center; font-size: 0.75rem; color: rgb(var(--c-cream-dim)); }
.notif-foot {
    padding: 0.55rem 0.9rem;
    border-top: 1px solid rgb(var(--c-line) / 0.15);
    text-align: center;
}
.notif-foot a, .notif-mark {
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    color: rgb(var(--c-cream-dim));
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.notif-foot a:hover, .notif-mark:hover { color: rgb(var(--c-neon)); text-decoration: underline; }

/* ---------- 2. WIDGET CHAT POJOK KANAN BAWAH ---------- */
.chat-fab {
    position: fixed;
    right: 1rem;
    bottom: 4.75rem; /* di atas menu bawah mobile */
    z-index: 50;
    display: flex;
    height: 3.4rem;
    width: 3.4rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: linear-gradient(135deg, rgb(var(--c-maroon)), rgb(var(--c-navy)));
    border: 1px solid rgb(var(--c-neon-dim) / 0.6);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.5);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.chat-fab:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgb(0 0 0 / 0.6); }
@media (min-width: 1024px) { .chat-fab { right: 1.5rem; bottom: 1.5rem; } }

.chat-fab svg { width: 1.5rem; height: 1.5rem; color: rgb(var(--c-cream)); }
.chat-fab .chat-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.3rem;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: #ef4444;
    color: #fff;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    border: 2px solid rgb(var(--c-navy-deep));
}
.chat-fab .chat-badge.show { display: flex; }

/* Panel chat */
.chat-panel {
    position: fixed;
    right: 1rem;
    bottom: 8.6rem;
    z-index: 55;
    width: min(23rem, calc(100vw - 2rem));
    height: min(32rem, calc(100vh - 12rem));
    display: none;
    flex-direction: column;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid rgb(var(--c-neon-dim) / 0.45);
    background: rgb(var(--c-navy-deep) / 0.98);
    box-shadow: 0 20px 60px rgb(0 0 0 / 0.6);
    backdrop-filter: blur(10px);
}
.chat-panel.open { display: flex; }
@media (min-width: 1024px) {
    .chat-panel { right: 1.5rem; bottom: 6.2rem; height: min(34rem, calc(100vh - 9rem)); }
}

/* Header panel */
.chat-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem;
    background: linear-gradient(135deg, rgb(var(--c-maroon) / 0.55), rgb(var(--c-navy) / 0.55));
    border-bottom: 1px solid rgb(var(--c-neon-dim) / 0.35);
    flex-shrink: 0;
}
.chat-head .c-ava {
    display: flex;
    height: 2.2rem;
    width: 2.2rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: linear-gradient(135deg, rgb(var(--c-maroon)), rgb(var(--c-navy)));
    color: rgb(var(--c-cream));
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.chat-head .c-title { font-size: 0.85rem; font-weight: 600; color: rgb(var(--c-cream)); line-height: 1.2; }
.chat-head .c-sub { font-family: 'Space Mono', monospace; font-size: 0.6rem; color: rgb(var(--c-cream-dim)); margin-top: 1px; }
.chat-head .c-close, .chat-head .c-back {
    margin-left: auto;
    background: none;
    border: none;
    color: rgb(var(--c-cream-dim));
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.35rem;
    font-size: 1rem;
    line-height: 1;
}
.chat-head .c-close:hover, .chat-head .c-back:hover { color: rgb(var(--c-neon)); }
.chat-head .c-back { margin-left: 0; margin-right: 0.2rem; }

/* Pencarian kontak */
.chat-search { padding: 0.6rem 0.75rem 0; flex-shrink: 0; }
.chat-search input {
    width: 100%;
    border-radius: 0.45rem;
    border: 1px solid rgb(var(--c-line) / 0.3);
    background: rgb(var(--c-navy) / 0.5);
    color: rgb(var(--c-cream));
    font-size: 0.78rem;
    padding: 0.45rem 0.7rem;
    outline: none;
}
.chat-search input:focus { border-color: rgb(var(--c-neon)); }
.chat-search input::placeholder { color: rgb(var(--c-cream-dim) / 0.6); }

/* Daftar kontak */
.chat-contacts { flex: 1; overflow-y: auto; padding: 0.5rem 0.35rem; }
.chat-contact {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.6rem;
    border-radius: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}
.chat-contact:hover { background: rgb(var(--c-neon) / 0.07); }
.chat-contact .c-ava { position: relative; }
.chat-contact .c-name { font-size: 0.8rem; font-weight: 600; color: rgb(var(--c-cream)); line-height: 1.25; }
.chat-contact .c-last {
    font-size: 0.68rem;
    color: rgb(var(--c-cream-dim));
    line-height: 1.3;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 11.5rem;
}
.chat-contact .c-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 0.95rem;
    height: 0.95rem;
    padding: 0 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: #ef4444;
    color: #fff;
    font-family: 'Space Mono', monospace;
    font-size: 9px;
    font-weight: 700;
    border: 2px solid rgb(var(--c-navy-deep));
}
.chat-empty { padding: 2rem 1rem; text-align: center; font-size: 0.75rem; color: rgb(var(--c-cream-dim)); }

/* Area percakapan */
.chat-msgs { flex: 1; overflow-y: auto; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.chat-msg { max-width: 78%; display: flex; flex-direction: column; }
.chat-msg .b {
    padding: 0.5rem 0.75rem;
    border-radius: 0.9rem;
    font-size: 0.78rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-msg .t {
    font-family: 'Space Mono', monospace;
    font-size: 0.55rem;
    color: rgb(var(--c-cream-dim) / 0.65);
    margin-top: 2px;
    padding: 0 0.3rem;
}
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.mine .b { background: rgb(var(--c-neon)); color: rgb(var(--c-navy-deep)); border-bottom-right-radius: 0.3rem; }
.chat-msg.theirs { align-self: flex-start; align-items: flex-start; }
.chat-msg.theirs .b { background: rgb(var(--c-navy) / 0.85); color: rgb(var(--c-cream)); border: 1px solid rgb(var(--c-line) / 0.15); border-bottom-left-radius: 0.3rem; }
.chat-day {
    align-self: center;
    font-family: 'Space Mono', monospace;
    font-size: 0.58rem;
    color: rgb(var(--c-cream-dim) / 0.7);
    padding: 0.2rem 0.7rem;
    border-radius: 9999px;
    border: 1px solid rgb(var(--c-line) / 0.15);
}
.chat-info { text-align: center; font-size: 0.7rem; color: rgb(var(--c-cream-dim)); padding: 1.5rem 1rem; }

/* Input pesan */
.chat-input {
    display: flex;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-top: 1px solid rgb(var(--c-line) / 0.15);
    flex-shrink: 0;
}
.chat-input textarea {
    flex: 1;
    resize: none;
    border-radius: 0.5rem;
    border: 1px solid rgb(var(--c-line) / 0.3);
    background: rgb(var(--c-navy) / 0.5);
    color: rgb(var(--c-cream));
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    padding: 0.5rem 0.7rem;
    outline: none;
    max-height: 5rem;
    line-height: 1.4;
}
.chat-input textarea:focus { border-color: rgb(var(--c-neon)); }
.chat-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.5rem;
    background: rgb(var(--c-neon));
    color: rgb(var(--c-navy-deep));
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: filter 0.15s;
}
.chat-send:hover { filter: brightness(1.15); }
.chat-send:disabled { opacity: 0.45; cursor: not-allowed; }
.chat-send svg { width: 1.05rem; height: 1.05rem; }

/* Typing / loading kecil */
.chat-typing { font-size: 0.65rem; color: rgb(var(--c-cream-dim)); padding: 0 0.9rem 0.5rem; display: none; }
.chat-typing.show { display: block; }
