/* ==========================================================================
   WadiDaw! - CSS System Design
   Aesthetics: Premium Dark Mode, Glassmorphism, Neon Accents, Smooth Animations
   ========================================================================== */

:root {
    --bg-dark: #0f1016;
    --bg-sidebar: #151722;
    --bg-chat: #0a0b0e;
    --bg-card: rgba(21, 23, 34, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.2);
    
    --primary: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.4);
    --primary-hover: #4f46e5;
    --accent: #a855f7; /* Purple */
    --accent-glow: rgba(168, 85, 247, 0.4);
    --accent-hover: #9333ea;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-hint: #6b7280;
    
    --msg-own: linear-gradient(135deg, #6366f1, #a855f7);
    --msg-other: rgba(255, 255, 255, 0.07);
    
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    
    --glass: rgba(255, 255, 255, 0.03);
    --glass-blur: blur(16px);
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    
    --font-outfit: 'Outfit', sans-serif;
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-outfit);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ==========================================================================
   SCROLLBAR STYLES
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   AUTH PAGES (LOGIN & REGISTER)
   ========================================================================== */
.auth-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-dark);
    overflow: hidden;
}

.auth-bg-decor-1 {
    position: absolute;
    top: -10%;
    left: -10%;
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
    z-index: 1;
    pointer-events: none;
    animation: pulseGlow 10s infinite alternate;
}

.auth-bg-decor-2 {
    position: absolute;
    bottom: -10%;
    right: -10%;
    width: 45vw;
    height: 45vw;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.15) 0%, rgba(0,0,0,0) 70%);
    z-index: 1;
    pointer-events: none;
    animation: pulseGlow 12s infinite alternate-reverse;
}

@keyframes pulseGlow {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(5%, 5%); }
}

.auth-card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 460px;
    padding: 3rem 2.5rem;
    border-radius: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-main);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    animation: slideUpFade 0.6s ease-out;
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

.auth-logo {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 0 20px 0 var(--primary-glow);
    margin-bottom: 1rem;
    animation: floatIcon 4s ease-in-out infinite;
}

@keyframes floatIcon {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

.logo-icon {
    font-size: 2.2rem;
    color: white;
}

.auth-logo h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #d8d8d8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.4rem;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-group label i {
    color: var(--primary);
    font-size: 1.1rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: white;
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px var(--border-glow);
}

.form-group input[type="file"] {
    background: rgba(255, 255, 255, 0.02);
    padding: 0.7rem;
    border-radius: 12px;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.remember-me input {
    accent-color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.9rem 1.8rem;
    border-radius: 12px;
    font-family: var(--font-outfit);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 15px 0 rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover), var(--accent-hover));
    box-shadow: 0 6px 20px 0 rgba(99, 102, 241, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-block {
    width: 100%;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
}

.auth-footer a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.alert-danger ul {
    list-style: none;
}

/* ==========================================================================
   APP MAIN INTERFACE (DASHBOARD)
   ========================================================================== */
.app-container {
    width: 100%;
    height: 100vh;
    display: flex;
    background-color: var(--bg-dark);
}

/* 1. Sidebar */
.sidebar {
    width: 380px;
    min-width: 320px;
    height: 100%;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

.sidebar-header {
    padding: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 12px;
    transition: var(--transition-fast);
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.04);
}

.avatar-container {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.avatar-container img,
.chat-header-avatar img,
.chat-item-avatar img,
.user-item-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    text-transform: uppercase;
}

.avatar-placeholder.large {
    width: 100px;
    height: 100px;
    font-size: 2.5rem;
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-sidebar);
}

.status-indicator.online { background-color: var(--success); }
.status-indicator.offline { background-color: var(--text-hint); }
.status-indicator.sibuk { background-color: var(--danger); }
.status-indicator.ada { background-color: var(--warning); }

.user-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.user-info .user-status {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    gap: 0.4rem;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.25rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
}

.logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Sidebar Search */
.sidebar-search {
    padding: 0.8rem 1.2rem;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-hint);
    font-size: 1.1rem;
}

.search-input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.6rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: white;
    font-family: var(--font-outfit);
    font-size: 0.9rem;
    transition: var(--transition-fast);
}

.search-input-wrapper input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary);
}

/* Chats List Container */
.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.9rem;
    border-radius: 16px;
    cursor: pointer;
    margin-bottom: 0.25rem;
    transition: var(--transition-fast);
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.chat-item.active {
    background: rgba(99, 102, 241, 0.12);
    border-left: 3px solid var(--primary);
}

.chat-item-avatar {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
}

.chat-item-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 0.75rem;
    color: var(--text-hint);
    flex-shrink: 0;
}

.chat-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-item-message {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-unread {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 6px;
    flex-shrink: 0;
    box-shadow: 0 0 10px 0 var(--primary-glow);
}

/* Loading & Empty States inside list */
.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem 1.5rem;
    text-align: center;
    gap: 1rem;
    color: var(--text-hint);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 2. Main Chat Area */
.chat-area {
    flex: 1;
    height: 100%;
    background-color: var(--bg-chat);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Empty Chat State */
.empty-chat-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    background-color: var(--bg-chat);
}

.empty-illustration {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
}

.pulse-ring {
    position: absolute;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, rgba(0,0,0,0) 70%);
    animation: pulseRing 3s ease-out infinite;
}

@keyframes pulseRing {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

.empty-illustration i {
    font-size: 4.5rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    z-index: 5;
    animation: floatIcon 6s ease-in-out infinite;
}

.empty-chat-state h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.empty-chat-state p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 320px;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
}

.empty-actions {
    margin-top: 1rem;
}

/* Active Chat */
.active-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    height: 70px;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-sidebar);
}

.back-btn {
    display: none;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 1.5rem;
    margin-right: 0.75rem;
    cursor: pointer;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.chat-header-text h3 {
    font-size: 1rem;
    font-weight: 600;
}

.chat-header-text span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chat-header-actions {
    display: flex;
    gap: 0.25rem;
}

/* Chat Messages Panel */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-bubble {
    max-width: 65%;
    display: flex;
    flex-direction: column;
    animation: popBubble 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes popBubble {
    0% { transform: scale(0.9) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.message-bubble.incoming {
    align-self: flex-start;
}

.message-bubble.outgoing {
    align-self: flex-end;
}

.message-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent);
    margin-left: 0.5rem;
    margin-bottom: 0.2rem;
}

.message-bubble.outgoing .message-sender {
    display: none;
}

.message-body {
    padding: 0.75rem 1.1rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
}

.message-bubble.incoming .message-body {
    background: var(--msg-other);
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
}

.message-bubble.outgoing .message-body {
    background: var(--msg-own);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 3px 12px 0 rgba(99, 102, 241, 0.2);
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-hint);
    white-space: nowrap;
}

.message-meta i {
    display: inline-block !important;
    font-family: 'remixicon' !important;
    font-style: normal;
    font-size: 0.95rem !important;
    line-height: 1;
    vertical-align: middle;
}

.message-bubble.incoming .message-meta {
    justify-content: flex-start;
    padding-left: 0.6rem;
}

.message-bubble.outgoing .message-meta {
    justify-content: flex-end;
    padding-right: 0.6rem;
    color: var(--text-muted);
}

/* Tick Colors */
.tick-sent {
    color: #ef4444 !important; /* Red */
}

.tick-delivered {
    color: #eab308 !important; /* Yellow */
}

.tick-read {
    color: #22c55e !important; /* Green */
}

/* Chat Footer Input */
.chat-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.chat-footer-actions {
    display: flex;
    gap: 0.25rem;
}

.message-input-form {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.message-input-form input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem 1.2rem;
    color: white;
    font-family: var(--font-outfit);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.message-input-form input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 10px 0 var(--primary-glow);
    transition: var(--transition-fast);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px 0 var(--primary-glow);
}

/* ==========================================================================
   MODAL POPUPS
   ========================================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    z-index: 100;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 500px;
    border-radius: 24px;
    box-shadow: var(--shadow-main);
    overflow: hidden;
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.close-btn {
    font-size: 1.8rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}

.close-btn:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-search {
    position: relative;
    margin-bottom: 1.25rem;
}

.modal-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-hint);
}

.modal-search input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.6rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: white;
    font-family: var(--font-outfit);
    font-size: 0.9rem;
}

.modal-search input:focus {
    outline: none;
    border-color: var(--primary);
}

.users-list,
.users-list-select {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.user-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-item-info {
    flex: 1;
    min-width: 0;
}

.user-item-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-item-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-item-checkbox {
    margin-right: 0.5rem;
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
}

.group-select-users-label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Profile Upload */
.profile-upload-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.profile-avatar-preview-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
}

.profile-avatar-preview-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--primary);
}

.avatar-upload-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: var(--transition-fast);
}

.avatar-upload-badge:hover {
    transform: scale(1.1);
}

/* ==========================================================================
   FILE ATTACHMENTS STYLING
   ========================================================================== */
.attachment-preview-bar {
    background: rgba(21, 23, 34, 0.95);
    border-top: 1px solid var(--border-color);
    padding: 0.8rem 1.5rem;
    animation: slideUpFade 0.2s ease-out;
}

.preview-content {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    border-radius: 12px;
}

.preview-icon-wrapper {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary);
    font-size: 1.3rem;
}

.preview-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.preview-file-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.preview-file-size {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.cancel-preview-btn {
    background: transparent;
    border: none;
    color: var(--text-hint);
    font-size: 1.25rem;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition-fast);
}

.cancel-preview-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

/* Image attachment in bubble */
.message-attachment.image-attachment {
    max-width: 280px;
    max-height: 280px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.message-attachment.image-attachment img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: var(--transition-fast);
}

.message-attachment.image-attachment img:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.message-text-caption {
    font-size: 0.95rem;
    margin-top: 0.4rem;
    word-break: break-word;
}

/* Document attachment in bubble */
.message-attachment.doc-attachment {
    margin-bottom: 0.25rem;
}

.attachment-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    color: var(--text-main);
    transition: var(--transition-fast);
}

.message-bubble.outgoing .attachment-link {
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(255, 255, 255, 0.08);
}

.attachment-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

.message-bubble.outgoing .attachment-link:hover {
    background: rgba(0, 0, 0, 0.25);
}

.attachment-doc-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--primary);
    font-size: 1.25rem;
}

.message-bubble.outgoing .attachment-doc-icon-wrapper {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.attachment-doc-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.attachment-doc-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-doc-action {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-bubble.outgoing .attachment-doc-action {
    color: rgba(255, 255, 255, 0.7);
}

/* ==========================================================================
   CALL SYSTEM STYLING
   ========================================================================== */
.call-modal {
    background-color: rgba(10, 11, 14, 0.85);
}

.call-card {
    background: rgba(21, 23, 34, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    padding: 3rem 2rem;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-main);
    position: relative;
    overflow: hidden;
}

.call-status-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 2rem;
    animation: pulseText 1.5s infinite alternate;
}

@keyframes pulseText {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

.call-avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
}

.call-avatar-container img,
.call-avatar-container .avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    z-index: 10;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.call-avatar-pulse,
.call-avatar-pulse-2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, rgba(168, 85, 247, 0) 70%);
    z-index: 1;
}

.call-avatar-pulse {
    animation: avatarPulse 2.5s infinite linear;
}

.call-avatar-pulse-2 {
    animation: avatarPulse 2.5s infinite linear 1.25s;
}

@keyframes avatarPulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.8); opacity: 0; }
}

.call-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: white;
}

.call-timer {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 3rem;
}

/* Call Video Preview Card */
.call-video-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 15;
    border-radius: 32px;
    overflow: hidden;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

#local-video {
    width: 90px;
    height: 120px;
    object-fit: cover;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 2;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.video-overlay-info {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: var(--glass-blur);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

/* Call Actions buttons */
.call-actions {
    display: flex;
    gap: 1.5rem;
    z-index: 20;
    position: relative;
}

.call-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.call-btn.btn-mute,
.call-btn.btn-speaker {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
}

.call-btn.btn-mute:hover,
.call-btn.btn-speaker:hover {
    background: rgba(255, 255, 255, 0.15);
}

.call-btn.btn-mute.active,
.call-btn.btn-speaker.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.call-btn.btn-end {
    background: var(--danger);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    transform: rotate(135deg); /* Hang up rotation */
}

.call-btn.btn-end:hover {
    background: #dc2626;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
    transform: rotate(135deg) scale(1.05);
}

.call-btn.btn-accept:hover {
    background: #16a34a !important;
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.6);
    transform: scale(1.05);
}

.call-btn.btn-decline:hover {
    background: #dc2626 !important;
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
    transform: rotate(135deg) scale(1.05);
}

/* ==========================================================================
   MOBILE RESPONSIVENESS
   ========================================================================== */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        min-width: unset;
    }
    
    .chat-area {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 30;
        display: none; /* Controlled by mobile classes in JS */
    }
    
    .app-container.chat-open .chat-area {
        display: flex;
    }
    
    .back-btn {
        display: block;
    }
}

/* Maintain audio track decoding for voice-only calls in hidden state */
.call-video-preview.invisible-audio-carrier {
    display: block !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    position: absolute !important;
}
