/* --- VARIABEL GLOBAL --- */
:root {
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Palette HSL Kurasi Premium */
  --bg-primary: #0a0812;
  --bg-secondary: #120e22;
  --glass-bg: rgba(18, 14, 34, 0.45);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-focus: rgba(139, 92, 246, 0.4);
  
  --primary-glow: linear-gradient(135deg, #7c3aed, #c084fc);
  --primary-glow-hover: linear-gradient(135deg, #6d28d9, #a855f7);
  --accent: #ec4899;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #6b7280;
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --error: #ef4444;
  
  --sidebar-width: 280px;
  --header-height: 70px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --shadow-lg: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- RESET & GLOBAL STYLE --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* --- ANIMASI BACKGROUND NEON BLUR --- */
.bg-blur-circle {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  opacity: 0.15;
  pointer-events: none;
}

.bg-blur-1 {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, #7c3aed 0%, transparent 70%);
  top: -10%;
  left: -10%;
}

.bg-blur-2 {
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  bottom: -10%;
  right: -10%;
}

/* --- UTILITIES --- */
.hidden {
  display: none !important;
}

#app {
  width: 100%;
  height: 100vh;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.view-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* --- TOMBOL-TOMBOL PREMIUM --- */
.btn {
  font-family: var(--font-family);
  font-size: 15px;
  font-weight: 600;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary-glow);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-glow-hover);
  transform: translateY(-2px);
}

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

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

.btn-glow:hover {
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
}

.btn:active {
  transform: translateY(0);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

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

/* --- LAYAR AUTENTIKASI --- */
.auth-card {
  width: 100%;
  max-width: 420px;
  margin: 20px;
  padding: 40px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 10;
  animation: fadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.logo-icon {
  font-size: 28px;
  background: var(--primary-glow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: pulse 2s infinite alternate;
}

.logo h1, .logo h2 {
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff, #d8b4fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo h1 { font-size: 28px; }
.logo h2 { font-size: 22px; }

.auth-header p {
  color: var(--text-muted);
  font-size: 14px;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.auth-form.active {
  display: flex;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.form-group input {
  font-family: var(--font-family);
  font-size: 15px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.form-group input:focus {
  border-color: var(--glass-border-focus);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
  background: rgba(0, 0, 0, 0.4);
}

.error-message {
  color: var(--error);
  font-size: 13px;
  font-weight: 500;
  min-height: 18px;
}

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

.auth-switch a {
  color: #a78bfa;
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.auth-switch a:hover {
  color: #c084fc;
  text-decoration: underline;
}

/* --- TAMPILAN UTAMA CHAT --- */
.chat-layout {
  width: 100%;
  height: 100vh;
  display: flex;
  background-color: var(--bg-primary);
  position: relative;
}

/* SIDEBAR KIRI */
.chat-sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
}

/* Profil User */
.user-profile {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--glass-border);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
}

.user-name {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status-text {
  font-size: 12px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-status-text::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
}

.btn-icon-logout {
  background: transparent;
  border: none;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

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

.input {
  font-family: var(--font-family);
  font-size: 15px;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.input:focus {
  border-color: var(--glass-border-focus);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
  background: rgba(0, 0, 0, 0.4);
}

/* Bagian Daftar Rooms */
.rooms-section {
  max-height: 45%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Bagian Daftar Direct Messages */
.dm-section {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--glass-border);
}

.dm-list {
  list-style: none;
  padding: 8px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.dm-list li {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 15px;
  color: var(--text-muted);
  transition: var(--transition);
  position: relative;
  border: 1px solid transparent;
}

.dm-list li:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.dm-list li.active {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: white;
  box-shadow: var(--shadow-lg);
}

.dm-avatar-mini {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
  position: relative;
}

.dm-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  background: var(--text-dark);
  transition: var(--transition);
}

.dm-status-dot.online {
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.dm-badge {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 0 8px rgba(236, 72, 153, 0.4);
  animation: messageSlideIn 0.3s ease;
}


.section-title-bar {
  padding: 20px 24px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title-bar h3 {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-dark);
}

.btn-icon-add {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon-add:hover {
  background: var(--primary-glow);
  color: white;
  transform: rotate(90deg);
}

.rooms-list {
  list-style: none;
  padding: 8px 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-grow: 1;
}

.rooms-list li {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 15px;
  color: var(--text-muted);
  transition: var(--transition);
}

.rooms-list li::before {
  content: '#';
  color: var(--text-dark);
  font-weight: 400;
  font-size: 16px;
}

.rooms-list li:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
}

.rooms-list li.active {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: white;
  box-shadow: var(--shadow-lg);
}

.rooms-list li.active::before {
  color: #a78bfa;
}

/* AREA CHAT KANAN */
.chat-main {
  flex-grow: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: relative;
}

/* Header Area Chat */
.chat-header {
  height: var(--header-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--glass-border);
  background: var(--bg-secondary);
  z-index: 50;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.chat-header-info h2 {
  font-size: 18px;
  font-weight: 600;
}

.room-members-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-badge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge.connected {
  background: var(--success-glow);
  color: var(--success);
}

.status-badge.connected::before {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-badge.disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
}

.status-badge.disconnected::before {
  background: var(--error);
  box-shadow: 0 0 8px var(--error);
}

/* Kontainer Pesan */
.messages-container {
  flex-grow: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: radial-gradient(circle at top right, rgba(124, 58, 237, 0.02) 0%, transparent 60%);
}

.chat-placeholder {
  margin: auto;
  text-align: center;
  max-width: 320px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.placeholder-icon {
  font-size: 48px;
  animation: float 3s ease-in-out infinite;
}

.chat-placeholder h3 {
  color: var(--text-main);
  font-weight: 600;
}

.chat-placeholder p {
  font-size: 14px;
  line-height: 1.5;
}

/* Balon Pesan (Message Bubbles) */
.message-wrapper {
  display: flex;
  gap: 12px;
  max-width: 75%;
  animation: messageSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message-wrapper.outgoing {
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-main);
  flex-shrink: 0;
}

.message-wrapper.outgoing .msg-avatar {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.2);
}

.message-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-sender {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.message-wrapper.outgoing .msg-sender {
  text-align: right;
}

.msg-bubble {
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}

.message-wrapper.incoming .msg-bubble {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-top-left-radius: 2px;
  color: var(--text-main);
}

.message-wrapper.outgoing .msg-bubble {
  background: var(--primary-glow);
  color: white;
  border-top-right-radius: 2px;
}

.msg-time {
  font-size: 10px;
  color: var(--text-dark);
  align-self: flex-end;
  margin-top: 2px;
}

.message-wrapper.outgoing .msg-time {
  align-self: flex-start;
}

/* Pesan Sistem (System Event Messages) */
.system-message {
  text-align: center;
  font-size: 12px;
  color: var(--text-dark);
  margin: 8px auto;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.02);
  animation: fadeIn 0.3s ease;
}

/* Panel Input Chat */
.chat-input-panel {
  padding: 16px 24px 24px;
  background: var(--bg-primary);
  border-top: 1px solid var(--glass-border);
}

.chat-input-form {
  display: flex;
  gap: 12px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 6px 6px 6px 18px;
  align-items: center;
  transition: var(--transition);
}

.chat-input-form:focus-within {
  border-color: var(--glass-border-focus);
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.15);
}

.chat-input-form input {
  flex-grow: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
}

.chat-input-form input::placeholder {
  color: var(--text-dark);
}

.btn-send {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  padding: 0;
  flex-shrink: 0;
}

.btn-send svg {
  transform: rotate(0deg) translate(1px, -1px);
}

/* --- DIALOG MODAL BARU (NEW ROOM) --- */
dialog {
  margin: auto;
  padding: 0;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  color: var(--text-main);
  width: 100%;
  max-width: 400px;
  outline: none;
  animation: dialogScaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.dialog-content {
  padding: 32px;
}

.dialog-content h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}

.input-tip {
  font-size: 11px;
  color: var(--text-dark);
  margin-top: 4px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* --- KUSTOM SCROLLBAR --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* --- RESPONSIVITAS MOBILE --- */
.mobile-only {
  display: none !important;
}

@media (max-width: 768px) {
  /* Prevent iOS/Android auto-zoom on input focus */
  input, select, textarea {
    font-size: 16px !important;
  }

  .mobile-only {
    display: flex !important;
  }
  
  .chat-sidebar {
    position: fixed;
    left: -290px;
    top: 0;
    bottom: 0;
    width: 290px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.6);
    z-index: 1000;
  }
  
  .chat-sidebar.active {
    left: 0;
  }
  
  .message-wrapper {
    max-width: 90%;
  }

  .chat-header {
    padding: 0 16px;
  }

  .messages-container {
    padding: 16px;
    gap: 12px;
  }

  .chat-input-panel {
    padding: 12px 16px 16px;
  }

  .homepage-panel {
    padding: 20px 16px;
  }

  dialog {
    width: 92%;
    padding: 0;
  }

  /* Sticker picker popup on mobile width adjustments */
  .sticker-picker-popup {
    bottom: 70px;
    left: 8px;
    right: 8px;
    width: auto;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 24px 20px;
    margin: 16px;
  }
  
  .logo h2 {
    font-size: 24px;
  }

  #ws-status-badge {
    font-size: 10px;
    padding: 3px 8px;
  }

  .chat-header-info h2 {
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }
  
  .room-members-count {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
  }

  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
  
  .color-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* --- ANIMASI --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dialogScaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

@keyframes pulse {
  0% { filter: drop-shadow(0 0 2px rgba(124, 58, 237, 0.4)); }
  100% { filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.8)); }
}

/* --- Halaman Kelola Teman & Password Dialog --- */
.dialog-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 20px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 10px 16px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

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

.tab-btn.active {
  color: #a78bfa;
  border-bottom-color: #8b5cf6;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.row-group {
  flex-direction: row !important;
  gap: 10px;
}

.row-group input {
  flex-grow: 1;
}

.search-result-container {
  margin-top: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  padding: 16px;
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
}

.friend-card {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.friend-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.friend-card-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: white;
}

.friend-card-username {
  font-weight: 600;
  color: var(--text-main);
}

.badge-count {
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: 6px;
}

.badge-count.hidden {
  display: none;
}

.pending-requests-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.pending-requests-list:empty::before {
  content: 'Tidak ada permintaan pertemanan masuk.';
  color: var(--text-dark);
  text-align: center;
  display: block;
  padding: 20px 0;
  font-size: 14px;
}

.pending-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  gap: 12px;
}

.pending-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pending-username {
  font-weight: 600;
  font-size: 14px;
}

.pending-actions {
  display: flex;
  gap: 8px;
}

.pending-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.room-lock {
  font-size: 12px;
  opacity: 0.7;
  cursor: help;
}

.room-unread-dot {
  background: #8b5cf6;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(139, 92, 246, 0); }
}

/* --- AKORDEON ROOMS --- */
.room-accordion {
  display: block;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}

.room-accordion summary {
  list-style: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: 1px;
  padding: 6px 8px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.room-accordion summary::-webkit-details-marker {
  display: none;
}

.room-accordion summary::before {
  content: '▶';
  font-size: 8px;
  color: var(--text-dark);
  transition: transform 0.2s ease;
}

.room-accordion[open] summary::before {
  transform: rotate(90deg);
}

.room-accordion summary:hover {
  color: var(--text-muted);
}

/* --- TOMBOL BERANDA SIDEBAR --- */
.btn-sidebar-nav {
  transition: var(--transition) !important;
}

.btn-sidebar-nav:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.btn-sidebar-nav.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.3)) !important;
  border-color: rgba(139, 92, 246, 0.5) !important;
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
}

/* --- HOMEPAGE / HALAMAN BERANDA --- */
.chat-active-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.chat-active-panel.hidden {
  display: none !important;
}

.homepage-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 40px;
  overflow-y: auto;
  gap: 32px;
}

.homepage-panel.hidden {
  display: none !important;
}

.homepage-header {
  margin-bottom: 8px;
}

.homepage-header h1 {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  letter-spacing: -1px;
}

.homepage-header p {
  color: var(--text-muted);
  font-size: 16px;
}

.homepage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.homepage-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 400px;
}

.homepage-card h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 12px;
  margin-bottom: 4px;
}

.card-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* SEARCH TOGGLES */
.search-type-toggle {
  display: flex;
  gap: 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  padding: 6px;
  border-radius: var(--radius-md);
}

.radio-label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}

.radio-label input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-label span {
  display: block;
  text-align: center;
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.radio-label input:checked + span {
  background: #8b5cf6;
  color: white;
  box-shadow: var(--shadow-sm);
}

/* HOMEPAGE SEARCH RESULTS */
.homepage-search-results {
  margin-top: 8px;
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  overflow-y: auto;
}

.search-empty-state {
  font-size: 13px;
  color: var(--text-dark);
  text-align: center;
}

/* INFO CARD STYLING */
.guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
}

.guide-list li {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-muted);
  position: relative;
  padding-left: 20px;
}

.guide-list li::before {
  content: '✦';
  position: absolute;
  left: 0;
  top: 0;
  color: #a78bfa;
}

.guide-list strong {
  color: var(--text-main);
}

.terms-text {
  font-size: 12.5px;
  color: var(--text-dark);
  line-height: 1.6;
  font-style: italic;
}

/* RESPONSIVE HOMEPAGE */
@media (max-width: 900px) {
  .homepage-grid {
    grid-template-columns: 1fr;
  }
  .homepage-panel {
    padding: 24px;
  }
}

/* --- AVATAR SELECTION GRID --- */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-height: 280px;
  overflow-y: auto;
  padding: 8px;
}

.avatar-select-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  font-size: 32px;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.avatar-select-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #8b5cf6;
  transform: scale(1.08);
}

.avatar-select-btn.active {
  background: rgba(139, 92, 246, 0.2);
  border-color: #8b5cf6;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.4);
}

.user-profile .user-avatar {
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.user-profile .user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.6);
}

.user-profile .user-avatar:hover::after {
  content: '✏️';
  position: absolute;
  font-size: 10px;
  right: -2px;
  bottom: -2px;
  background: #7c3aed;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- PILIHAN WARNA BACKGROUND AVATAR --- */
.color-select-btn {
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.color-select-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.color-select-btn.active {
  border-color: white;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

/* --- STICKER & EMOJI PICKER POPUP --- */
.btn-icon-picker {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.btn-icon-picker:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: scale(1.08);
}

.sticker-picker-popup {
  position: absolute;
  bottom: 74px;
  left: 12px;
  width: 300px;
  background: rgba(17, 24, 39, 0.96);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.sticker-picker-popup.hidden {
  display: none;
}

.picker-tabs {
  display: flex;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
}

.picker-tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.picker-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.picker-tab-btn.active {
  color: #a78bfa;
  border-bottom: 2px solid #8b5cf6;
  background: rgba(255, 255, 255, 0.05);
}

.picker-content {
  display: none;
  padding: 12px;
  max-height: 200px;
  overflow-y: auto;
}

.picker-content.active {
  display: grid;
}

#picker-emojis-content {
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

#picker-stickers-content {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.emoji-btn {
  background: transparent;
  border: none;
  font-size: 22px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.15);
}

.sticker-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 8px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.sticker-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #8b5cf6;
  transform: scale(1.08);
}

.sticker-btn-emoji {
  font-size: 28px;
  line-height: 1;
}

.sticker-btn-label {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* --- CHAT BUBBLE UNTUK STIKER --- */
.sticker-message-bubble {
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 20px !important;
  border-radius: var(--radius-lg) !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 120px;
  max-width: 160px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: floatSticker 3s ease-in-out infinite;
  user-select: none;
}

.sticker-emoji {
  font-size: 56px;
  line-height: 1.1;
  display: block;
}

.sticker-caption {
  font-size: 11px;
  font-weight: 700;
  color: #a78bfa;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

@keyframes floatSticker {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.msg-bubble.sticker-bubble-parent {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* --- BOTTOM NAVIGATION BAR (MOBILE ONLY) --- */
.mobile-bottom-nav {
  position: fixed;
  bottom: 16px;
  left: 16px;
  right: 16px;
  height: 66px;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1100;
  padding: 0 8px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
  padding-bottom: env(safe-area-inset-bottom);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 0;
  border-radius: 16px;
  flex-grow: 1;
  position: relative;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #a78bfa;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item.active::after {
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 0 8px #a78bfa;
}

.nav-item:active {
  transform: scale(0.95);
}

.nav-item.active {
  color: #a78bfa;
}

.nav-icon {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  flex-shrink: 0;
  transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-item.active .nav-icon {
  transform: translateY(-4px) scale(1.12);
  color: #a78bfa;
  filter: drop-shadow(0 2px 8px rgba(139, 92, 246, 0.5));
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  transition: all 0.3s ease;
  opacity: 0.8;
}

.nav-item.active .nav-label {
  opacity: 1;
  font-weight: 800;
  color: var(--text-main);
  transform: translateY(-1px);
}

/* Tab layout states on mobile */
@media (max-width: 768px) {
  .chat-layout {
    padding-bottom: 64px;
    height: 100vh;
    overflow: hidden;
  }

  .mobile-tab-home .chat-sidebar {
    display: none !important;
  }
  .mobile-tab-home .chat-main {
    display: flex !important;
    width: 100% !important;
    height: calc(100vh - 64px) !important;
  }
  
  .mobile-tab-rooms .chat-sidebar {
    display: flex !important;
    width: 100% !important;
    height: calc(100vh - 64px) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
  }
  .mobile-tab-rooms .chat-sidebar .rooms-section {
    display: flex !important;
    flex-direction: column !important;
    max-height: 100% !important;
    flex-grow: 1 !important;
  }
  .mobile-tab-rooms .chat-sidebar .dm-section {
    display: none !important;
  }
  .mobile-tab-rooms .chat-main {
    display: none !important;
  }

  .mobile-tab-dms .chat-sidebar {
    display: flex !important;
    width: 100% !important;
    height: calc(100vh - 64px) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
  }
  .mobile-tab-dms .chat-sidebar .rooms-section {
    display: none !important;
  }
  .mobile-tab-dms .chat-sidebar .dm-section {
    display: flex !important;
    flex-direction: column !important;
    max-height: 100% !important;
    flex-grow: 1 !important;
  }
  .mobile-tab-dms .chat-main {
    display: none !important;
  }
  
  /* Active Chat Screen overlays everything */
  .mobile-chat-active .chat-sidebar {
    display: none !important;
  }
  .mobile-chat-active .chat-main {
    display: flex !important;
    width: 100% !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1000 !important;
  }
  .mobile-chat-active .mobile-bottom-nav {
    display: none !important;
  }
  .mobile-chat-active .chat-layout {
    padding-bottom: 0 !important;
  }
  .mobile-chat-active .chat-active-panel {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    overflow: hidden !important;
  }
  .mobile-chat-active .messages-container {
    flex: 1 1 0 !important;
    overflow-y: auto !important;
    min-height: 0 !important;
  }
  .mobile-chat-active .chat-input-panel {
    flex-shrink: 0 !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 10 !important;
  }

  /* On mobile: sidebar + homepage hidden — mobile panels take over */
  .chat-sidebar {
    display: none !important;
  }
  /* Hide chat-main (homepage + idle state) unless a chat is active */
  .chat-main {
    display: none !important;
    width: 100% !important;
  }
  /* Only show chat-main when a chat is actively open */
  .mobile-chat-active .chat-main {
    display: flex !important;
  }
  /* Always hide the homepage panel on mobile */
  .homepage-panel {
    display: none !important;
  }
}

/* ========================================
   MOBILE PANEL STYLES
   Full-screen overlay panels for each tab
   ======================================== */

.mobile-panel {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-base);
  z-index: 900;
  overflow: hidden;
}

.mobile-panel.hidden {
  display: none !important;
}

/* Panel Header */
.mobile-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.mobile-panel-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.mobile-panel-action {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #a78bfa;
  transition: var(--transition);
}

.mobile-panel-action:hover {
  background: rgba(139, 92, 246, 0.3);
}

/* --- Search Panel --- */
.mobile-search-wrap {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.mobile-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 50px;
  padding: 10px 16px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.mobile-search-bar:focus-within {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.07);
}

.mobile-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 15px;
}

.mobile-search-bar input::placeholder {
  color: var(--text-dark);
}

.mobile-search-bar svg {
  color: var(--text-dark);
  flex-shrink: 0;
}

.mobile-search-type {
  display: flex;
  gap: 10px;
}

.msearch-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 50px;
  border: 1px solid var(--glass-border);
  transition: var(--transition);
}

.msearch-radio input[type="radio"] {
  display: none;
}

.msearch-radio:has(input:checked) {
  color: #a78bfa;
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
}

.mobile-search-results {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 96px;
}

.mobile-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  min-height: 200px;
  color: var(--text-dark);
  font-size: 13px;
  text-align: center;
}

/* --- Chats Panel --- */
.mobile-chats-list,
.mobile-friends-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
  padding: 0 0 96px;
  margin: 0;
}

.mobile-chats-list li,
.mobile-friends-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: var(--transition);
  position: relative;
}

.mobile-chats-list li:hover,
.mobile-friends-list li:hover {
  background: rgba(255,255,255,0.04);
}

.mobile-chats-list li.active,
.mobile-friends-list li.active {
  background: rgba(139, 92, 246, 0.08);
}

.mobile-chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  position: relative;
}

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

.mobile-chat-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.mobile-chat-preview {
  font-size: 12px;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-chat-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.mobile-chat-time {
  font-size: 11px;
  color: var(--text-dark);
}

.mobile-chat-badge {
  background: #8b5cf6;
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* --- Rooms Panel --- */
.mobile-rooms-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 96px;
}

/* --- Profile Panel --- */
.mobile-profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 32px;
  background: linear-gradient(180deg, rgba(139,92,246,0.1) 0%, transparent 100%);
  border-bottom: 1px solid var(--glass-border);
}

.mobile-profile-avatar-wrap {
  position: relative;
  margin-bottom: 16px;
}

.mobile-profile-avatar {
  width: 90px !important;
  height: 90px !important;
  font-size: 38px !important;
  border-radius: 50% !important;
}

.mobile-profile-edit-avatar {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 28px;
  height: 28px;
  background: #8b5cf6;
  border: 2px solid var(--bg-base);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: var(--transition);
}

.mobile-profile-edit-avatar:hover {
  background: #7c3aed;
}

.mobile-profile-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 6px;
}

.mobile-profile-status {
  font-size: 13px;
  color: #34d399;
  font-weight: 600;
}

.mobile-profile-actions {
  padding: 24px 20px 96px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-profile-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-main);
  width: 100%;
  text-align: left;
  font-family: var(--font-family);
}

.mobile-profile-btn.danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.2);
  background: rgba(248, 113, 113, 0.05);
}

.mobile-profile-btn.danger:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.4);
}

.bottom-nav-badge {
  position: absolute;
  top: 4px;
  right: 18%;
  background: #ef4444; /* WhatsApp style red badge */
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 1.5px solid #111827; /* Dark background overlap */
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  z-index: 10;
}

.bottom-nav-badge.hidden {
  display: none !important;
}

.mobile-friends-content {
  display: none;
}

.mobile-friends-content.active {
  display: block;
}

.mobile-pending-list {
  padding: 0;
  margin: 0;
  list-style: none;
}

.mobile-pending-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* --- MESSAGES TICKS (WHATSAPP-STYLE) --- */
.message-status-tick {
  font-size: 11px;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
  user-select: none;
  vertical-align: middle;
}

.tick-sent {
  color: rgba(255, 255, 255, 0.35);
}

.tick-delivered {
  color: rgba(255, 255, 255, 0.6);
}

.tick-read {
  color: #38bdf8; /* Bright sky blue glow on dark background */
}

/* --- TEMA TERANG (LIGHT THEME) OVERRIDES --- */
body.light-theme {
  --bg-primary: #f3f4f6;
  --bg-secondary: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.65);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-focus: rgba(139, 92, 246, 0.5);
  
  --text-main: #1f2937;
  --text-muted: #4b5563;
  --text-dark: #9ca3af;
  
  --shadow-lg: 0 8px 32px 0 rgba(31, 38, 135, 0.05);
}

body.light-theme .bg-blur-circle {
  opacity: 0.04;
}

body.light-theme .mobile-bottom-nav {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.06),
              inset 0 1px 0 0 rgba(255, 255, 255, 0.8);
}

body.light-theme .mobile-bottom-nav .nav-item {
  color: #6b7280;
}

body.light-theme .mobile-bottom-nav .nav-item.active {
  color: #7c3aed;
}

body.light-theme .mobile-bottom-nav .nav-item.active .nav-icon {
  color: #7c3aed;
  filter: drop-shadow(0 2px 8px rgba(124, 58, 237, 0.25));
}

body.light-theme .mobile-bottom-nav .nav-item::after {
  background: #7c3aed;
}

body.light-theme .mobile-bottom-nav .nav-item.active::after {
  box-shadow: 0 0 8px #7c3aed;
}

body.light-theme .bottom-nav-badge {
  border: 1.5px solid #ffffff;
}

body.light-theme .mobile-panel-header {
  background: rgba(255, 255, 255, 0.8);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.light-theme .sidebar {
  background: rgba(255, 255, 255, 0.65);
}

body.light-theme .chat-header {
  background: rgba(255, 255, 255, 0.65);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.light-theme .chat-messages {
  background: #f9fafb;
}

body.light-theme .chat-input-area {
  background: rgba(255, 255, 255, 0.65);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

body.light-theme .tick-sent {
  color: #9ca3af;
}

body.light-theme .tick-delivered {
  color: #6b7280;
}

body.light-theme .tick-read {
  color: #0284c7; /* Darker blue read receipts for white backgrounds */
}

/* ==========================================
   POLLING (VOTE VIEW) STYLES
   ========================================== */
.poll-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.poll-question {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.poll-meta {
  font-size: 11px;
  color: var(--text-dark);
  display: flex;
  justify-content: space-between;
}

.poll-options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.poll-option-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.poll-option-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255,255,255,0.15);
}

.poll-option-btn.voted {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.05);
}

.poll-option-progress {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: rgba(139, 92, 246, 0.15);
  z-index: 0;
  pointer-events: none;
  transition: width 0.5s ease-out;
}

.poll-option-btn.voted .poll-option-progress {
  background: rgba(139, 92, 246, 0.25);
}

.poll-option-text {
  position: relative;
  z-index: 1;
  font-weight: 600;
}

.poll-option-votes {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}

/* ==========================================
   CALENDAR VIEW STYLES
   ========================================== */
.calendar-header-cell {
  text-align: center;
  font-weight: 800;
  font-size: 11px;
  color: var(--text-dark);
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-cell {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: var(--transition);
}

.calendar-cell:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
}

.calendar-cell.today {
  border-color: #8b5cf6;
  background: rgba(139, 92, 246, 0.05);
}

.calendar-cell.today .calendar-day-num {
  color: #c084fc;
  font-weight: 800;
}

.calendar-cell.selected {
  background: rgba(139, 92, 246, 0.15);
  border-color: #8b5cf6;
}

.calendar-day-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.calendar-event-dot {
  width: 5px;
  height: 5px;
  background: #a78bfa;
  border-radius: 50%;
  margin-top: 4px;
  box-shadow: 0 0 6px #a78bfa;
}

.calendar-cell.other-month {
  opacity: 0.25;
}

.event-detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}

.event-detail-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.event-detail-meta {
  font-size: 10px;
  color: var(--text-dark);
}

.btn-delete-event {
  background: transparent;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 4px;
  opacity: 0.6;
  transition: var(--transition);
}

.btn-delete-event:hover {
  opacity: 1;
}

/* ==========================================
   TODO VIEW STYLES
   ========================================== */
.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

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

.todo-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.todo-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--glass-border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: transparent;
  transition: var(--transition);
}

.todo-checkbox.checked {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.todo-task-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  transition: var(--transition);
}

.todo-item.completed-todo {
  opacity: 0.5;
}

.todo-item.completed-todo .todo-task-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-creator-tag {
  font-size: 10px;
  color: var(--text-dark);
  margin-top: 2px;
  display: block;
}

/* Light Theme Adjustments */
body.light-theme .poll-card,
body.light-theme .event-detail-item,
body.light-theme .todo-item {
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

body.light-theme .poll-option-btn,
body.light-theme .calendar-cell {
  background: rgba(0, 0, 0, 0.01);
}

body.light-theme .poll-option-btn:hover,
body.light-theme .calendar-cell:hover {
  background: rgba(0, 0, 0, 0.03);
}

body.light-theme #calendar-events-detail {
  background: rgba(255, 255, 255, 0.6);
}








