/*
==============================================
Modern Chat App - UI/UX Revamp Styles
==============================================
- Theme: Glassmorphism
- Palette: Purple/Blue/Green Gradients
- Typography: Poppins
- Animations: Subtle fades, glows, and transitions
*/

:root {
    --font-family: 'Poppins', sans-serif;
    --gradient-main: linear-gradient(120deg, #8E2DE2, #4A00E0);
    --gradient-accent: linear-gradient(120deg, #00C9FF, #92FE9D);
    --gradient-text: linear-gradient(120deg, #00C9FF, #92FE9D);
}

/* --- Base & Theme Variables --- */
html.dark {
    --bg-primary: #100f16;
    --bg-secondary: #1a1922;
    --glass-bg: rgba(26, 25, 34, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c80;
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --active-bg: rgba(255, 255, 255, 0.1);
}

html.light {
    --bg-primary: #f0f2f5;
    --bg-secondary: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.1);
    --text-primary: #1c1e21;
    --text-secondary: #65676b;
    --text-muted: #8a8d91;
    --border-color: rgba(0, 0, 0, 0.1);
    --hover-bg: rgba(0, 0, 0, 0.03);
    --active-bg: rgba(0, 0, 0, 0.06);
}

html.gradient {
     --bg-primary: #100f16;
    --bg-secondary: #1a1922;
    --glass-bg: rgba(26, 25, 34, 0.5);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f0f0f5;
    --text-secondary: #a0a0b0;
    --text-muted: #6c6c80;
    --border-color: rgba(255, 255, 255, 0.1);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --active-bg: rgba(255, 255, 255, 0.1);
}

/* --- General Styling --- */
body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s, color 0.3s;
    overflow: hidden;
}

.gradient-body-bg {
     background: #100f16 url('https://www.transparenttextures.com/patterns/cubes.png');
}

/* --- Glassmorphism Effect --- */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    transition: background 0.3s, border 0.3s;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--glass-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-color); }

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.fade-in { animation: fadeIn 0.5s ease-out forwards; }
.message-in { animation: slideInUp 0.4s ease-out forwards; }

/* --- Components --- */
.gradient-btn {
    background-image: var(--gradient-accent);
    color: #100f16;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.gradient-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(146, 254, 157, 0.4);
}

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gradient-border {
    border: 2px solid transparent;
    background-clip: padding-box;
    -webkit-background-clip: padding-box;
    position: relative;
}
.gradient-border::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: -1;
    margin: -2px;
    border-radius: inherit;
    background: var(--gradient-main);
}

.input-glass {
    background-color: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
}
.input-glass::placeholder {
    color: var(--text-muted);
}

/* --- Chat Specific Styles --- */
.chat-bubble-sent {
    background-image: var(--gradient-main);
    color: white;
}
.chat-bubble-received {
    background-color: var(--active-bg);
}

.status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary);
}
.status-online { background-color: #34d399; }
.status-offline { background-color: #9ca3af; }

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    margin: 0 2px;
    animation: bounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: -0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: -0.4s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1.0); } }

.reply-preview {
    background-color: rgba(0,0,0,0.2);
    border-left: 2px solid;
    border-image: var(--gradient-accent) 1;
    padding: 6px 10px;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: 0.8rem;
}

/* New Styles for Group Member Selection */
.member-select-card {
    border: 2px solid var(--border-color);
    transition: all 0.2s ease-in-out;
    border-radius: 0.75rem; /* Menyamakan dengan class 'rounded-xl' dari Tailwind */
    background-color: transparent;
    position: relative;
}

.member-select-card.selected {
    border-color: transparent;
    box-shadow: 0 0 15px rgba(146, 254, 157, 0.3);
    transform: scale(1.02);
    color: var(--text-primary);
}

/* Ini adalah trik untuk membuat border gradient mengikuti border-radius */
.member-select-card.selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0.75rem;
    padding: 2px; /* Lebar border */
    background: var(--gradient-accent);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
}

/* Style baru untuk checkbox saat item dipilih */
.member-select-card.selected .checkmark-indicator {
    background-image: var(--gradient-accent);
    border-color: transparent;
}

/* Emoji Picker Styles */
#emoji-picker-container {
    position: absolute;
    bottom: 70px;
    left: 10px;
    z-index: 20;
}

/* --- PRELOADER / LOADING TRANSITION --- */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.4s ease-in-out, visibility 0.4s ease-in-out;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--glass-border);
    border-top-color: #92FE9D; /* Accent color */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}