    :root {
      /* 🎨 Palet Warna Utama */
      --primary-accent: #00F5D4;   /* Vibrant Cyan - Aksen utama yang segar */
      --secondary-accent: #9B5DE5; /* Vivid Purple - Untuk highlight & status */
      --brand-gradient: linear-gradient(45deg, var(--primary-accent), var(--secondary-accent));
      /* 💬 Gelembung Chat */
      --outgoing-chat: linear-gradient(45deg, #00F5D4, #00A8E8); /* Gradien Cyan-ke-Biru */
      --incoming-chat: #3C3A5E;  /* Ungu gelap yang soft, kontras dengan gradien */
      --outgoing-text: #1A182D;  /* Teks gelap untuk kontras di gelembung terang */
      /* 🔳 Latar Belakang & Panel */
      --bg: #1A182D;             /* Indigo Gelap - Latar belakang utama */
      --panel: #2A2840;          /* Ungu lebih terang untuk panel & modal */
      --hover-item: #3C3A5E;     /* Warna hover yang lebih kontras */
      /* ✍️ Teks */
      --ink: #F0F0F0;            /* Putih gading yang nyaman di mata */
      --ink-soft: #A0A0B0;       /* Abu-abu terang untuk subteks */
      --muted: #706D8B;          /* Abu-abu keunguan untuk info muted */
      /* 🪟 Border & Shadow */
      --border-color: rgba(255, 255, 255, 0.1);
      --shadow-glow: 0 0 15px rgba(0, 245, 212, 0.25); /* Glow cyan subtil */
    }

    html,
    body {
        height: 100%;
        margin: 0;
        padding: 0;
        background: var(--bg);
        font-family: "Poppins", sans-serif;
        color: var(--ink);
        overflow: hidden;
    }
    ::-webkit-scrollbar {
        width: 8px;
    }
    ::-webkit-scrollbar-track {
        background: var(--panel);
    }
    ::-webkit-scrollbar-thumb {
        background-color: var(--muted);
        border-radius: 4px;
    }
    ::-webkit-scrollbar-thumb:hover {
        background-color: var(--ink-soft);
    }
    .app {
      height:100vh;
      display:none;
      width:100%;
      background:var(--bg);
      flex-direction:row;
    }
    .login-page {
      height:100vh;
      display:flex;
      justify-content:center;
      align-items:center;
      background:var(--bg);
      padding:20px;
      box-sizing:border-box;
    }
    .login-box {
      background:var(--panel);
      padding: 40px;
      border-radius:24px;
      width:100%;
      max-width:400px;
      text-align:center;
      border:1px solid var(--border-color);
      box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
    .login-box h2 {
      margin-top:0;
      margin-bottom: 25px;
      font-weight:700;
      color:var(--ink);
    }
    .login-box input {
      width:100%;
      padding:14px;
      background:var(--bg);
      border:1px solid var(--border-color);
      border-radius:14px;
      color:var(--ink);
      margin-bottom:15px;
      box-sizing:border-box;
      transition:all 0.3s ease;
      font-size: 16px;
    }
    .login-box input:focus {
      outline:none;
      border-color:var(--primary-accent);
      box-shadow:0 0 0 3px rgba(0, 245, 212, 0.4);
    }
    .login-box button {
      width:100%;
      padding:14px;
      border:none;
      border-radius:14px;
      background: var(--brand-gradient);
      color:var(--ink);
      font-weight:700;
      cursor:pointer;
      transition: all 0.3s ease;
      font-size: 16px;
    }
    .login-box button:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-glow);
    }
    .login-box p {
      font-size:14px;
      color:var(--ink-soft);
      margin-top:20px;
    }
    .login-box a {
      color:var(--primary-accent);
      text-decoration:none;
      font-weight:700;
      transition:color 0.2s;
    }
    .login-box a:hover {
      color: var(--secondary-accent);
    }
    .login-page #authEmail.optional::placeholder {
      font-style:italic;
      color:var(--muted);
    }
    .sidebar {
      padding-top:24px;
      width:380px;
      min-width:280px;
      background:var(--bg);
      display:flex;
      flex-direction:column;
      border-right:1px solid var(--border-color);
      /* Make sidebar a flex container */
      display: flex;
      flex-direction: column;
    }
    .sidebar,.sidebar * {
      -ms-overflow-style:none !important;
      scrollbar-width:none !important;
    }
    .sidebar::-webkit-scrollbar,.sidebar *::-webkit-scrollbar {
      display:none !important;
    }
    .profile-header {
      display:flex;
      justify-content:space-between;
      align-items:center;
      padding: 15px 20px;
      border-bottom:1px solid var(--border-color);
    }
    .logo-container {
      display:flex;
      align-items:center;
      gap:10px;
    }
    .logo-container .logo-icon {
      font-size:24px;
      color:var(--primary-accent);
    }
    .logo-container .logo-text {
      font-size:16px;
      font-weight:700;
      color:var(--ink);
    }
    .profile-header .avatar-btn {
      width:50px;
      height:50px;
      border-radius:50%;
      cursor:pointer;
      object-fit:cover;
      border:3px solid var(--primary-accent);
      transition: transform 0.2s ease;
    }
    .profile-header .avatar-btn:hover {
        transform: scale(1.05);
    }
    .profile-menu {
      display:none;
      position:absolute;
      top:65px;
      right:15px;
      background:var(--panel);
      border-radius:16px;
      z-index:50;
      overflow:hidden;
      border:1px solid var(--border-color);
      box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    }
    .profile-menu.active {
      display:block;
    }
    .profile-menu a,.profile-menu button {
      display:block;
      width:100%;
      text-align:left;
      padding:14px 22px;
      border:none;
      background:none;
      color:var(--ink);
      text-decoration:none;
      cursor:pointer;
      font-size:16px;
      transition:background-color 0.2s,color 0.2s;
    }
    .profile-menu a:hover,.profile-menu button:hover {
      background-color:var(--hover-item);
      color:var(--primary-accent);
    }
    .chat-main {
      flex:1;
      display:flex;
      flex-direction:column;
      height:100%;
      background:var(--bg) url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%232A2840' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
      position:relative;
    }
    .chat-main::before {
      content:"";
      position:absolute;
      inset:0;
      background:var(--bg);
      opacity:0.9;
      pointer-events:none;
      z-index:0;
    }
    .chat-main > * {
      position:relative;
      z-index:1;
    }
    .chat-header {
      padding:15px;
      padding-top:24px;
      display:flex;
      align-items:center;
      gap:15px;
      border-bottom:1px solid var(--border-color);
      flex-shrink:0;
      position:relative;
      background: rgba(26, 24, 45, 0.8);
      backdrop-filter: blur(10px);
    }
    .chat-header-actions {
      margin-left:auto;
      display:flex;
      align-items:center;
      gap:15px;
    }
    .chat-header-actions button {
      background:none;
      border:none;
      color:var(--muted);
      font-size:24px;
      cursor:pointer;
      transition:color 0.2s, transform 0.2s;
    }
    .chat-header-actions button:hover {
      color:var(--primary-accent);
      transform: scale(1.1);
    }
    .back-btn {
      display:none;
      color:var(--ink);
      font-size:24px;
      cursor:pointer;
      transition:color 0.2s;
    }
    .back-btn:hover {
      color:var(--primary-accent);
    }
    .chat-avatar {
      width:50px;
      height:50px;
      border-radius:50%;
      object-fit:cover;
      cursor:pointer;
      border:3px solid var(--secondary-accent);
    }
    .chat-info {
      flex-grow:1;
      overflow:hidden;
    }
    .chat-info h3 {
      margin:0;
      font-size:18px;
      font-weight:600;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
      color:var(--ink);
    }
    .chat-info p {
      margin:0;
      font-size:14px;
      color:var(--ink-soft);
    }
    .messages {
      flex:1;
      overflow-y:auto;
      padding:20px;
      display:flex;
      flex-direction:column;
      gap:12px;
      position:relative;
      z-index:1;
      justify-content: flex-end;
    }
    .message-bubble {
      max-width:75%;
      padding:12px 18px;
      border-radius:24px;
      line-height:1.45;
      word-wrap:break-word;
      font-size:16px;
      white-space:pre-wrap;
      position: relative;
    }
    .message-bubble a {
      color:inherit;
      text-decoration:underline;
      word-break:break-all;
      font-weight: 600;
    }
    .message-bubble.outgoing a {
      color: var(--outgoing-text);
    }
    .message-bubble.incoming a {
      color: var(--primary-accent);
    }
    .message-bubble.incoming {
      background:var(--incoming-chat);
      color:var(--ink);
      align-self:flex-start;
      border-bottom-left-radius:8px;
    }
    .message-bubble.outgoing {
      background:var(--outgoing-chat);
      color:var(--outgoing-text);
      align-self:flex-end;
      border-bottom-right-radius:8px;
    }
    .message-bubble .message-content img,
    .message-bubble .message-content video {
        max-width: 100%;
        max-height: 400px;
        width: 100%;
        object-fit: cover;
        border-radius: 16px;
        display: block;
    }
    .message-bubble .message-content audio {
        max-width: 100%;
        height: auto;
        border-radius: 16px;
        display: block;
    }
    .message-bubble .sender {
      font-size:13px;
      color:var(--primary-accent);
      margin-bottom:5px;
      font-weight:600;
    }
    .message-footer {
      display:flex;
      align-items:center;
      justify-content:flex-end;
      font-size:13px;
      color:var(--ink-soft);
      margin-top:5px;
      gap:5px;
      opacity: 0.8;
    }
    .message-bubble.outgoing .message-footer {
      color: rgba(26, 24, 45, 0.7);
    }
    .message-bubble.incoming .message-footer {
      color: rgba(240, 240, 240, 0.7);
    }
    .message-bubble.voice-note {
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .message-bubble .message-content audio {
        width: 300px;
        margin-top: 5px;
        border-radius: 50px;
        height: 54px;
    }
    .message-footer .message-status {
      display:flex;
      align-items:center;
      gap:2px;
    }
    .message-footer .message-status .fa-check,
    .message-footer .message-status .fa-check-double {
      font-size:12px;
    }
    .composer {
      display:flex;
      align-items:center;
      padding: 10px 15px;
      border-top:1px solid var(--border-color);
      gap:10px;
    }
    .chat-header,.composer-wrapper {
      background:var(--bg);
      position:relative;
      z-index:2;
    }
    .composer-wrapper {
      flex-direction:column;
    }
    .composer textarea {
      flex: 1;
      background: var(--panel);
      border: 1px solid var(--border-color);
      border-radius: 14px;
      padding: 12px 18px;
      color: var(--ink);
      font-family: "Poppins", sans-serif;
      font-size: 16px;
      line-height: 1.4;
      outline: none !important;
      resize: none;
      box-shadow: none !important;
      overflow-y: hidden;
    }
    .composer textarea:focus {
      border-color:var(--primary-accent);
      box-shadow:0 0 0 3px rgba(0, 245, 212, 0.4);
    }
    .composer button {
      background: none;
      border: none;
      color: var(--muted);
      font-size: 24px;
      cursor: pointer;
      padding: 8px;
      border-radius: 50%;
      width: 44px;
      height: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s;
    }
    .composer button:hover {
      color:var(--primary-accent);
      background-color: var(--hover-item);
    }
    .composer-btn-send {
      background: var(--primary-accent);
      color: var(--outgoing-text);
    }
    .composer-btn-send:hover {
        background: var(--primary-accent);
        color: var(--outgoing-text);
        transform: scale(1.1);
    }
    .composer-btn-attach input {
      position:absolute;
      top:0;
      left:0;
      width:100%;
      height:100%;
      opacity:0;
      cursor:pointer;
    }
    .chat-list-container {
      flex:1;
      overflow-y:auto;
    }
    .chat-item {
      display:flex;
      align-items:center;
      gap:15px;
      padding:14px;
      cursor:pointer;
      transition:background-color 0.2s,transform 0.2s ease,box-shadow 0.2s ease;
      position:relative;
      margin:8px 12px;
      border-radius:18px;
      border:1px solid transparent;
    }
    .chat-item:hover {
      background-color:var(--hover-item);
      transform:translateY(-2px);
    }
    .chat-main.drag-over {
      outline:3px dashed var(--primary-accent);
      outline-offset:-3px;
      border-radius:16px;
    }
    .chat-item.drag-hover {
      background-color:rgba(0, 245, 212, 0.1);
      border:1px solid var(--primary-accent);
    }
    body.dragging {
      cursor:copy !important;
    }
    .chat-item.active {
      background-color:var(--hover-item);
      border:1px solid var(--primary-accent);
      box-shadow: 0 0 10px rgba(0, 245, 212, 0.2);
    }
    .chat-item-avatar {
      width:55px;
      height:55px;
      border-radius:50%;
      object-fit:cover;
      border:2px solid var(--border-color);
    }
    .chat-item-content {
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
    }
    .chat-item-header, .chat-item-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .chat-item-name {
      font-size: 17px;
      font-weight: 600;
      color: var(--ink);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .chat-item-time {
      font-size: 13px;
      color: var(--muted);
      flex-shrink: 0;
      margin-left: 8px;
    }
    .chat-item-last-msg {
      font-size: 15px;
      color: var(--ink-soft);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .unread-badge {
        background: var(--brand-gradient);
        color: var(--ink);
        font-size: 12px;
        font-weight: 700;
        border-radius: 50%;
        min-width: 22px;
        height: 22px;
        padding: 0 4px;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-shrink: 0;
        margin-left: 8px;
        border: 2px solid var(--bg);
    }
    .overlay {
      position:fixed;
      top:0;
      left:0;
      width:100%;
      height:100%;
      background:rgba(0,0,0,0.8);
      backdrop-filter: blur(5px);
      z-index:100;
      display:none;
      justify-content:center;
      align-items:center;
    }
    .overlay.active {
      display:flex;
    }
    .modal {
      background:var(--panel);
      padding:30px;
      border-radius:20px;
      max-width:550px;
      width:90%;
      color:var(--ink);
      position:relative;
      border:1px solid var(--border-color);
      box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
    .modal-close {
      position:absolute;
      top:18px;
      right:18px;
      font-size:24px;
      color:var(--muted);
      cursor:pointer;
      transition:all 0.2s;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 50%;
    }
    .modal-close:hover {
      color:var(--primary-accent);
      background: var(--hover-item);
      transform: rotate(90deg);
    }
    .modal h2 {
      margin-top:0;
      font-weight:700;
      color:var(--ink);
    }
    .modal .btn {
      background:var(--brand-gradient);
      color: var(--outgoing-text);
      padding:12px 25px;
      border:none;
      border-radius:12px;
      cursor:pointer;
      font-size:17px;
      width:100%;
      margin-top:20px;
      font-weight:700;
      transition:all 0.3s ease;
    }
    .modal .btn:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-glow);
    }
    .modal input,.modal select,.modal textarea {
      width:100%;
      padding:12px;
      border-radius:12px;
      background:var(--bg);
      border:1px solid var(--border-color);
      color:var(--ink);
      margin-top:10px;
      box-sizing:border-box;
      font-size:16px;
      transition:all 0.3s ease;
    }
    .modal input:focus,.modal select:focus,.modal textarea:focus {
      outline:none;
      border-color:var(--primary-accent);
      box-shadow:0 0 0 3px rgba(0, 245, 212, 0.4);
    }
    .modal .btn-secondary {
      background:var(--hover-item);
      color: var(--ink);
    }
    .modal .btn-secondary:hover {
      background:var(--muted);
      transform: translateY(0);
      box-shadow: none;
    }
    .profile-uploader {
      display:flex;
      flex-direction:column;
      align-items:center;
      gap:15px;
      margin-bottom:25px;
    }
    .profile-uploader img {
      width:100px;
      height:100px;
      border-radius:50%;
      object-fit:cover;
      border:4px solid var(--primary-accent);
    }
    .profile-uploader button {
      padding:10px 18px;
      border:2px solid var(--primary-accent);
      background:transparent;
      color:var(--ink-soft);
      border-radius:25px;
      cursor:pointer;
      font-size:15px;
      font-weight:600;
      transition:all 0.3s ease;
    }
    .profile-uploader button:hover {
      background:var(--primary-accent);
      color:var(--outgoing-text);
    }
    .profile-options {
      display:flex;
      gap:15px;
    }
    .emoji-picker-container {
      position:absolute;
      bottom:80px;
      left:15px;
      background:var(--panel);
      border-radius:20px;
      padding:15px;
      display:none;
      flex-wrap:wrap;
      gap:8px;
      width:calc(100% - 30px);
      z-index:50;
      box-sizing:border-box;
      border:1px solid var(--border-color);
      box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    }
    .emoji-picker-container span {
      font-size:30px;
      cursor:pointer;
      padding:5px;
      transition:transform 0.2s;
    }
    .emoji-picker-container span:hover {
      transform:scale(1.2);
    }
    .sidebar-controls {
      display:flex;
      align-items:center;
      padding:12px 18px;
      gap:12px;
    }
    .search-bar {
      flex-grow:1;
      padding:0;
      position: relative;
    }
    .search-bar input {
      width:100%;
      padding:12px 18px 12px 45px;
      background:var(--panel);
      border:1px solid var(--border-color);
      border-radius:14px;
      color:var(--ink);
      box-sizing:border-box;
      transition:box-shadow 0.2s,border-color 0.2s;
      font-size:16px;
    }
    .search-bar::before {
        content: "\f002";
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        position: absolute;
        left: 18px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--muted);
    }
    .search-bar input:focus {
      outline:none;
      box-shadow:0 0 0 3px rgba(0, 245, 212, 0.4);
      border-color:var(--primary-accent);
    }
    .new-group-btn {
      background:none;
      border:none;
      color:var(--muted);
      font-size:24px;
      cursor:pointer;
      padding:8px;
      transition:color 0.2s,transform 0.2s;
      width: 44px;
      height: 44px;
      border-radius: 14px;
    }
    .new-group-btn:hover {
      color:var(--primary-accent);
      background-color: var(--hover-item);
    }
    #callModal {
      z-index:200;
    }
    #callContainer {
      width:100%;
      height:100%;
      position:relative;
      display:flex;
      flex-direction:column;
      justify-content:center;
      align-items:center;
      background-color:#000;
    }
    #group-members-list,#add-members-list {
      margin-top:15px;
      max-height:250px;
      overflow-y:auto;
      border-top:1px solid var(--border-color);
      padding-top:15px;
    }
    .member-item,.user-search-item {
      display:flex;
      align-items:center;
      padding:10px;
      gap:12px;
      cursor:pointer;
      transition:background-color 0.2s;
      border-radius:12px;
    }
    .member-item:hover,.user-search-item:hover {
      background-color:var(--hover-item);
    }
    .member-item img,.user-search-item img {
      width:45px;
      height:45px;
      border-radius:50%;
      object-fit:cover;
      border:2px solid var(--border-color);
    }
    .member-item-info {
      flex-grow:1;
    }
    .member-item-info span {
      font-size:15px;
      color:var(--ink-soft);
    }
    .member-actions {
      display:flex;
      gap:8px;
    }
    .member-actions button {
      background:none;
      border:none;
      color:var(--muted);
      font-size:16px;
      cursor:pointer;
      transition:color 0.2s;
    }
    .member-actions button:hover {
      color:var(--primary-accent);
    }
    @media (max-width:768px) {
      .sidebar {
        position:absolute;
        width:100%;
        height:100%;
        z-index:20;
        display:flex;
        padding-top: 0; /* Remove top padding for mobile */
      }
      .profile-header, .sidebar-controls {
          padding-top: 15px;
      }
      .chat-main {
        width:100%;
        height:100%;
        z-index:10;
        display:none;
        position:absolute;
        top:0;
        left:0;
      }
      .chat-main.active {
        display:flex;
      }
      .back-btn {
        display:block;
      }
      .emoji-picker-container {
        width:calc(100% - 30px);
        bottom:85px;
        left:15px;
      }
      /* On mobile, the nav bar acts as the main navigation */
      #bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 25; /* Above the sidebar content */
      }
      /* Add padding to the bottom of the content to avoid overlap with nav bar */
      #sidebar-content-container {
          padding-bottom: 70px;
      }
    }
    #fileCaption {
      width:100%;
      padding:12px;
      border-radius:12px;
      background:var(--hover-item);
      border:none;
      color:var(--ink);
      font-size:15px;
      resize:none;
      max-height:120px;
      overflow-y:auto;
      line-height:1.4;
    }
    #videos {
      width:100%;
      height:100%;
      position:relative;
      display:flex;
      justify-content:center;
      align-items:center;
      background-color:#000;
    }
    #remoteVideo {
      max-width:100%;
      max-height:100%;
      object-fit:contain;
    }
    #localVideo {
      position:absolute;
      top:25px;
      right:25px;
      width:28%;
      max-width:220px;
      height:auto;
      border-radius:16px;
      border:3px solid var(--primary-accent);
      z-index:210;
      cursor:move;
      touch-action:none;
    }
    .call-controls {
      position:absolute;
      bottom:25px;
      left:50%;
      transform:translateX(-50%);
      z-index:220;
      display:flex;
      gap:25px;
      background:rgba(0,0,0,0.6);
      padding:12px 25px;
      border-radius:60px;
    }
    .call-controls button {
      background-color:var(--hover-item);
      border:none;
      color:white;
      width:55px;
      height:55px;
      border-radius:50%;
      font-size:22px;
      cursor:pointer;
      display:flex;
      align-items:center;
      justify-content:center;
      transition:background-color 0.2s;
    }
    .call-controls button:hover {
      background-color:var(--primary-accent);
    }
    .call-controls button.hangup {
      background-color:#EF5350;
    }
    .call-controls button.hangup:hover {
      background-color:#E53935;
    }
    .date-divider {
      text-align:center;
      margin:20px 0;
      color:var(--ink-soft);
      font-size:13px;
      position:relative;
    }
    .date-divider::before,.date-divider::after {
      content:"";
      position:absolute;
      top:50%;
      width:38%;
      height:1px;
      background-color:var(--muted);
      opacity:0.4;
    }
    .date-divider::before {
      left:0;
    }
    .date-divider::after {
      right:0;
    }

    #incomingCallModal .modal {
        max-width: 380px;
        text-align: center;
    }
    #callerInfo {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 30px;
    }
    #callerAvatar {
        width: 90px;
        height: 90px;
        border-radius: 50%;
        object-fit: cover;
        margin-bottom: 18px;
        border: 4px solid var(--primary-accent);
    }
    #callerName {
        font-size: 22px;
        font-weight: 700;
        color: var(--ink);
    }
    #callStatusText {
        font-size: 17px;
        color: var(--ink-soft);
    }
    #callActions {
        display: flex;
        justify-content: space-around;
        width: 100%;
        gap: 20px;
    }
    #callActions button {
        width: 65px;
        height: 65px;
        border-radius: 50%;
        border: none;
        color: white;
        font-size: 26px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: transform 0.2s;
    }
    #callActions button:hover {
        transform: scale(1.05);
    }
    #btnAcceptCall {
        background-color: #4CAF50;
    }
    #btnAcceptCall:hover {
        background-color: #66BB6A;
    }
    #btnRejectCall {
        background-color: #F44336;
    }
    #btnRejectCall:hover {
        background-color: #E57373;
    }

    .message-actions {
      position: absolute;
      top: -20px;
      display: flex;
      gap: 5px;
      background-color: var(--panel);
      padding: 8px 12px;
      border-radius: 50px;
      border: 1px solid var(--border-color);
      box-shadow: 0 4px 12px rgba(0,0,0,0.2);
      opacity: 0;
      visibility: hidden;
      transform: translateY(10px);
      transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
      z-index: 10;
    }

    .message-bubble.outgoing .message-actions {
      right: 10px;
    }

    .message-bubble.incoming .message-actions {
      left: 10px;
    }

    .message-bubble:hover .message-actions,
    .message-bubble .message-actions.show {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }

    .message-actions button, .reaction-picker button {
      background: none;
      border: none;
      color: var(--ink-soft);
      font-size: 16px;
      cursor: pointer;
      padding: 5px;
      border-radius: 50%;
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: color 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
    }

    .message-actions button:hover, .reaction-picker button:hover {
      transform: scale(1.15);
      color: var(--ink);
    }

    .reaction-picker {
        display: flex;
        gap: 8px;
    }
    .reaction-picker button {
        font-size: 20px;
    }

    .message-reactions {
        position: absolute;
        bottom: -15px;
        display: flex;
        gap: 4px;
        z-index: 5;
    }
    .message-bubble.outgoing .message-reactions {
        right: 10px;
    }
    .message-bubble.incoming .message-reactions {
        left: 10px;
    }
    .reaction-item {
        background-color: var(--panel);
        border: 1px solid var(--border-color);
        border-radius: 20px;
        padding: 2px 8px;
        font-size: 14px;
        display: flex;
        align-items: center;
        gap: 4px;
        cursor: pointer;
    }
    .reaction-item.reacted-by-me {
        background-color: var(--primary-accent);
        color: var(--outgoing-text);
    }

    .reply-context {
      padding: 8px 12px;
      background-color: var(--hover-item);
      border-bottom: 1px solid var(--border-color);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .reply-context-content {
      border-left: 3px solid var(--primary-accent);
      padding-left: 10px;
      font-size: 14px;
      display: flex;
      flex-direction: column;
    }
    .reply-context-sender {
      font-weight: 600;
      color: var(--primary-accent);
    }
    .reply-context-text {
      color: var(--ink-soft);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 300px;
    }
    .reply-context-close {
      background: none;
      border: none;
      color: var(--muted);
      font-size: 20px;
      cursor: pointer;
    }

    .replied-message {
        background-color: rgba(0,0,0,0.15);
        padding: 6px 10px;
        border-radius: 10px;
        margin-bottom: 8px;
        border-left: 3px solid var(--primary-accent);
        font-size: 13px;
        display: flex;
        flex-direction: column;
        gap: 2px;
        cursor: pointer;
        transition: background-color 0.2s ease;
    }
    .replied-message:hover {
        background-color: rgba(0,0,0,0.25);
    }
    .replied-message .sender-name {
      font-weight: 600;
      color: var(--primary-accent);
    }
    .replied-message .message-text {
      color: var(--ink-soft);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 250px;
    }

    .forwarded-label {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        color: var(--muted);
        margin-bottom: 5px;
    }

    .edited-label {
        font-size: 12px;
        color: inherit;
        opacity: 0.7;
        margin-left: 5px;
    }

    #forwardChatList .chat-item {
        margin: 2px 0;
    }

    #forwardChatList .chat-item.selected {
        background: var(--brand-gradient);
        color: var(--ink);
    }
    #forwardChatList .chat-item.selected .chat-item-name,
    #forwardChatList .chat-item.selected .chat-item-last-msg {
        color: var(--ink);
    }


    #forgotPasswordLink {
        display: block;
        margin-top: 15px;
        font-size: 14px;
        color: var(--ink-soft);
        text-decoration: none;
    }
    #forgotPasswordLink:hover {
        color: var(--primary-accent);
    }

    #loadingScreen {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: var(--bg);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9999;
        flex-direction: column;
        gap: 20px;
    }
    .spinner {
        border: 4px solid var(--panel);
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border-left-color: var(--primary-accent);
        animation: spin 1s ease infinite;
    }
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }

    .message-bubble.message-highlight {
        animation: highlight-fade 2s ease-out;
    }

    @keyframes highlight-fade {
        from {
             outline: 3px solid var(--primary-accent);
             outline-offset: 2px;
        }
        to {
             outline: 3px solid transparent;
             outline-offset: 2px;
        }
    }

    .form-group-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 15px;
        padding: 10px;
        background-color: var(--bg);
        border-radius: 12px;
    }

    .switch {
        position: relative;
        display: inline-block;
        width: 50px;
        height: 28px;
    }

    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

    .slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--hover-item);
        transition: .4s;
    }

    .slider:before {
        position: absolute;
        content: "";
        height: 20px;
        width: 20px;
        left: 4px;
        bottom: 4px;
        background-color: white;
        transition: .4s;
    }

    input:checked + .slider {
        background-color: var(--primary-accent);
    }

    input:checked + .slider:before {
        transform: translateX(22px);
    }

    .slider.round {
        border-radius: 34px;
    }

    .slider.round:before {
        border-radius: 50%;
    }

    #btnNotifications {
        position: relative;
    }

    #notificationBadge {
        position: absolute;
        top: 5px;
        right: 5px;
        font-size: 10px;
        width: 18px;
        height: 18px;
        min-width: 18px;
    }

    .request-item {
        display: flex;
        align-items: center;
        gap: 15px;
        padding: 10px;
    }
    .request-item img {
        width: 45px;
        height: 45px;
        border-radius: 50%;
    }
    .request-info {
        flex-grow: 1;
    }
    .request-actions button {
        padding: 6px 12px;
        font-size: 14px;
        margin-left: 5px;
        margin-top: 0;
        width: auto;
    }

    #viewProfilePicModal .modal-content {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #viewProfilePic {
        width: 150px;
        height: 150px;
        border-radius: 20px;
        object-fit: cover;
        margin: 0 auto;
    }
    #viewProfileActions {
        display: flex;
        gap: 15px;
        margin-top: 25px;
    }
    #viewProfileActions .btn {
        margin-top: 0;
    }
    #viewProfileActions .btn-danger {
        background-color: #e53935;
    }
    #viewProfileActions .btn-danger:hover {
        background-color: #c62828;
    }

    .user-search-actions .btn {
        padding: 8px 15px;
        font-size: 14px;
        width: auto;
        margin-top: 0;
    }

    #confirmationModal .modal {
        max-width: 400px;
    }
    #confirmationModal .modal-content {
        text-align: center;
    }
    #confirmationModal .btn-group {
        display: flex;
        gap: 10px;
        justify-content: center;
    }
    #confirmationModal .btn {
        width: auto;
        flex-grow: 1;
    }

    #mediaViewerModal {
        z-index: 1000;
    }
    #mediaViewerContent {
        max-width: 90vw;
        max-height: 90vh;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    #mediaViewerContent img,
    #mediaViewerContent video,
    #mediaViewerContent iframe {
        max-width: 100%;
        max-height: 100%;
        border: none;
        border-radius: 8px;
        object-fit: contain;
    }
    #mediaViewerContent iframe {
        width: 80vw;
        height: 85vh;
        background-color: white;
    }
    .message-content.media-viewable {
        cursor: pointer;
    }

    .message-bubble .upload-progress {
        display: flex;
        align-items: center;
        gap: 10px;
        color: var(--ink-soft);
    }
    .message-bubble .upload-progress .spinner-small {
        border: 2px solid rgba(255, 255, 255, 0.3);
        width: 16px;
        height: 16px;
        border-radius: 50%;
        border-left-color: var(--primary-accent);
        animation: spin 1s ease infinite;
    }
    .message-bubble.outgoing .upload-progress {
        color: rgba(0,0,0,0.7);
    }
    .message-bubble.outgoing .upload-progress .spinner-small {
        border: 2px solid rgba(0, 0, 0, 0.2);
        border-left-color: var(--bg);
    }

    .group-details-header {
        text-align: center;
        margin-bottom: 20px;
    }
    .group-details-header img {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        object-fit: cover;
        border: 4px solid var(--primary-accent);
        margin-bottom: 10px;
    }
    .group-details-header h2 {
        margin: 0;
    }
    .group-details-section {
        margin-bottom: 20px;
        border-top: 1px solid var(--border-color);
        padding-top: 15px;
    }
    .group-details-section h4 {
        margin: 0 0 10px 0;
        color: var(--muted);
        font-weight: 500;
        font-size: 14px;
        text-transform: uppercase;
    }
    .group-details-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }
    .group-details-actions .btn {
        width: 100%;
        margin-top: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }
    .group-details-actions .btn-danger {
        background: #e53935;
    }
    .group-details-actions .btn-danger:hover {
        background: #c62828;
        box-shadow: none;
        transform: none;
    }
    #group-members-list .member-item {
        position: relative;
        padding-right: 40px;
    }
    .member-role {
        font-size: 12px;
        color: var(--primary-accent);
        font-weight: 600;
    }
    .member-context-menu-btn {
        background: none;
        border: none;
        color: var(--muted);
        font-size: 18px;
        cursor: pointer;
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        padding: 5px 10px;
        border-radius: 50%;
    }
    .member-context-menu-btn:hover {
        background-color: var(--hover-item);
        color: var(--ink);
    }
    .member-context-menu {
        display: none;
        position: absolute;
        right: 25px;
        top: 45px;
        background: var(--panel);
        border-radius: 12px;
        border: 1px solid var(--border-color);
        z-index: 60;
        overflow: hidden;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    }
    .member-context-menu.active {
        display: block;
    }
    .member-context-menu button {
        display: block;
        width: 100%;
        text-align: left;
        padding: 10px 15px;
        border: none;
        background: none;
        color: var(--ink);
        cursor: pointer;
        font-size: 14px;
        transition: background-color 0.2s;
    }
    .member-context-menu button:hover {
        background-color: var(--hover-item);
    }
    .member-context-menu button.danger {
        color: #e53935;
    }
    #sidebar-content-container {
        flex-grow: 1;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }
    #bottom-nav {
        display: flex;
        justify-content: space-around;
        padding: 8px 0;
        border-top: 1px solid var(--border-color);
        background-color: var(--bg);
        flex-shrink: 0;
    }
    .nav-btn {
        background: none;
        border: none;
        color: var(--muted);
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px 12px;
        border-radius: 8px;
        transition: color 0.2s, background-color 0.2s;
        font-size: 11px;
    }
    .nav-btn .fa-solid {
        font-size: 20px;
    }
    .nav-btn:hover {
        color: var(--ink-soft);
        background-color: var(--hover-item);
    }
    .nav-btn.active {
        color: var(--primary-accent);
    }
    .view-panel {
        flex-grow: 1; /* Ensure panels can grow */
        display: flex;
        flex-direction: column;
    }
    .coming-soon-panel {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        gap: 15px;
        height: 100%;
        color: var(--muted);
    }
    .coming-soon-panel .fa-solid {
        font-size: 48px;
    }
    .coming-soon-panel h3 {
        font-size: 24px;
        color: var(--ink-soft);
        margin: 0;
    }
    /* AI View Specific Styles */
    #ai-view {
        color: var(--ink);
    }
    #ai-view header {
        padding: 15px;
        display: flex;
        align-items: center;
        gap: 12px;
        border-bottom: 1px solid var(--border-color);
    }
    #ai-view header img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
    }
    #ai-view header h2 {
        margin: 0; font-size: 16px;
    }
     #ai-view header p {
        margin: 0; font-size: 12px; color: #4ade80;
    }
    #ai-messages {
        flex: 1;
        padding: 15px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .ai-message {
        display: flex;
        gap: 10px;
        align-items: flex-start;
        max-width: 85%;
    }
    .ai-message.user {
        align-self: flex-end;
        flex-direction: row-reverse;
    }
    .ai-message .avatar {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        background: var(--secondary-accent);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .ai-message.user .avatar {
        background: var(--primary-accent);
    }
    .ai-message .content {
        padding: 10px 15px;
        border-radius: 18px;
        background: var(--incoming-chat);
    }
    .ai-message.user .content {
        background: var(--outgoing-chat);
        color: var(--outgoing-text);
        border-bottom-right-radius: 4px;
    }
     .ai-message.ai .content {
        border-bottom-left-radius: 4px;
    }
    #ai-form {
        display: flex;
        gap: 10px;
        padding: 10px 15px;
        border-top: 1px solid var(--border-color);
    }
    #ai-input {
        flex: 1;
        background: var(--panel);
        border-radius: 14px;
        padding: 12px 18px;
        color: var(--ink);
        border: none;
        font-size: 15px;
    }
    #ai-form button {
        background: var(--primary-accent);
        color: var(--outgoing-text);
        border: none;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        font-size: 18px;
        cursor: pointer;
    }