/* =============================== */
/*            UI VARS              */
/* =============================== */
:root{
  --ui-text: rgba(30, 41, 60, 0.92);
  --ui-muted: rgba(84, 97, 121, 0.82);
  --ui-muted2: rgba(84, 97, 121, 0.62);
  --ui-line: rgba(22, 33, 49, 0.10);

  --ui-glass: rgba(255,255,255,0.72);
  --ui-glass-b: rgba(120, 140, 175, 0.14);

  --ui-shadow-sm: 0 10px 22px rgba(32, 44, 76, 0.12);
  --ui-shadow: 0 18px 40px rgba(32, 44, 76, 0.14);

  --fab-size: 56px;
  --fab-radius: 20px;
  --fab-shadow: 0 18px 40px rgba(63, 99, 255, 0.28);
  --fab-shadow-hover: 0 22px 52px rgba(63, 99, 255, 0.34);
}

/* =============================== */
/*     GLOBAL BG (как в мокапе)    */
/* =============================== */
html,body{ height:100%; }

body{
  margin:0;
  position: relative;
  overflow:hidden;
  background:#cdd8ff;
}

body::before{
  content:"";
  position: fixed;
  inset: -25%;
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(245,246,255,0.55) 0px, rgba(245,246,255,0.00) 260px),
    radial-gradient(closest-side at 20% 20%, rgba(255,255,255,0.75), transparent 60%),
    radial-gradient(closest-side at 80% 30%, rgba(255,255,255,0.55), transparent 62%),
    radial-gradient(closest-side at 35% 85%, rgba(255,255,255,0.55), transparent 62%),
    radial-gradient(closest-side at 75% 80%, rgba(255,255,255,0.45), transparent 62%),
    linear-gradient(135deg, #d6ddff 0%, #c4bcff 58%, #c5deff 100%);
  filter: saturate(1.02);
  pointer-events:none;
}


body::after{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,0.70) 0 2px, transparent 3px),
    radial-gradient(circle at 22% 55%, rgba(255,255,255,0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 60% 16%, rgba(255,255,255,0.60) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 42%, rgba(255,255,255,0.60) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 82%, rgba(255,255,255,0.55) 0 2px, transparent 3px),
    radial-gradient(circle at 40% 78%, rgba(255,255,255,0.55) 0 2px, transparent 3px);
  opacity:.55;
  transform: rotate(-8deg) scale(1.1);
  pointer-events:none;
}

.layout,
.container{
  background: transparent;
}

/* =============================== */
/*          CHAT LIST SHELL        */
/* =============================== */
.chat-list{
  width: calc(35.05% - 10px);
  height: calc(100% - 20px);
  padding: 12px 0;
  padding-bottom: calc(env(safe-area-inset-bottom) + 28px);

  box-sizing: border-box;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;

  scrollbar-width: none;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scroll-padding-top: 20px;

  border-right: 1px solid rgba(255,255,255,0.65);

  background: linear-gradient(180deg, rgba(255,255,255,0.80) 0%, rgba(255,255,255,0.62) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.chat-list::-webkit-scrollbar{ display:none; }
.chat-list::before,
.chat-list::after{
  content:none;
}

/* =============================== */
/*            DARK MODE            */
/* =============================== */
.chat-list.dark{
  --ui-text: rgba(235,240,255,0.92);
  --ui-muted: rgba(190,200,220,0.78);
  --ui-muted2: rgba(190,200,220,0.62);
  --ui-line: rgba(255,255,255,0.10);

  --ui-glass: rgba(35,46,60,0.72);
  --ui-glass-b: rgba(255,255,255,0.10);

  border-right-color: rgba(255,255,255,0.10);
  background: linear-gradient(180deg, rgba(35,46,60,0.62) 0%, rgba(35,46,60,0.44) 100%);
}

.chat-list.dark ~ *{}

body.dark::before{
  background:
    radial-gradient(closest-side at 20% 20%, rgba(255,255,255,0.12), transparent 60%),
    radial-gradient(closest-side at 80% 30%, rgba(255,255,255,0.10), transparent 62%),
    radial-gradient(closest-side at 35% 85%, rgba(255,255,255,0.10), transparent 62%),
    radial-gradient(closest-side at 75% 80%, rgba(255,255,255,0.08), transparent 62%),
    linear-gradient(135deg, rgba(24,32,46,1) 0%, rgba(34,44,66,1) 45%, rgba(28,40,58,1) 100%);
  filter:saturate(1.02);
}

/* =============================== */
/*            RESPONSIVE           */
/* =============================== */
@media (max-width: 737px){
  .chat-list{
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.65);
    display: block;
    flex: 1 1 auto;
    padding-bottom: 0;
  }

  .chat-list.dark{
    border-bottom-color: rgba(255,255,255,0.10);
  }
}

@media (min-width: 738px){
  .chat-list{
    flex: 0 0 var(--sidebarWidth);
    max-width: var(--sidebarWidth);
  }

  .left-header{
    flex: 0 0 var(--sidebarWidth);
    max-width: var(--sidebarWidth);
  }
}

/* =============================== */
/*          SEARCH (TOP)           */
/* =============================== */
.search-wrapper{
  position: relative;
  height: 42px;
  width: 87%;
  margin: 0 auto;
  border-radius: 18px;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(120, 140, 175, 0.14);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  box-shadow: 0 10px 22px rgba(32, 44, 76, 0.12);
}

.search-wrapper i{
  position: static;
  font-size: 16px;
  color: #aab2ba;
}

#userTagInput{
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  padding: 0;
  font-size: 16px;
  color: #949ca4;
}

#userTagInput::placeholder{
  color: #949ca4;
  opacity: 1;
}


/* =============================== */
/*        CHAT LIST CONTENT        */
/* =============================== */
.chat-list-dynamic{
  display:flex;
  flex-direction:column;
  gap:0;
  padding:0;
}

.user-result{
  width:100%;
}

.chat-item,
.user-button{
  width:100%;
  border:0;
  background:transparent;

  display:flex;
  align-items:center;
  gap:12px;

  padding:12px 18px;
  border-radius:16px;

  text-align:left;
  cursor:pointer;

  box-sizing:border-box;
  transition:
    transform .12s ease,
    background .12s ease,
    box-shadow .12s ease;
}

.chat-item:hover,
.user-button:hover{
  background:rgba(255,255,255,0.44);
}

.chat-list.dark .chat-item:hover,
.chat-list.dark .user-button:hover{
  background:rgba(255,255,255,0.08);
}

.chat-item:active,
.user-button:active{
  transform:scale(0.992);
}

.chat-item + .chat-item,
.user-button + .user-button{
  border-top:1px solid var(--ui-line);
  border-radius:0;
}

.chat-item:first-child,
.user-button:first-child{
  border-top:0;
}

.chat-item.active,
.user-button.active{
  background:rgba(95,84,220,0.12);
  box-shadow:
    0 10px 22px rgba(32,44,76,0.10),
    inset 0 1px 0 rgba(255,255,255,0.55);
  border-radius:16px;
}

.chat-list.dark .chat-item.active,
.chat-list.dark .user-button.active{
  background:rgba(95,84,220,0.16);
  box-shadow:
    0 10px 22px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.08);
}


/* =============================== */
/*        AVATAR + ONLINE DOT      */
/* =============================== */
[data-avatar-wrapper]{
  position: relative;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
}

.avatar,
.user-avatar{
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;

  box-shadow: var(--ui-shadow-sm);
  border: 3px solid rgba(255,255,255,0.86);
  background: rgba(255,255,255,0.65);

  display: block;
}

.chat-list.dark .avatar,
.chat-list.dark .user-avatar{
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
}

.online-indicator{
  position:absolute;
  right:-4px;
  bottom:-4px;

  width:11px;
  height:11px;
  border-radius:50%;

  background:linear-gradient(
    135deg,
    #4f63ff,
    #7a5cff
  );

  border:2px solid #eef1ff;
  outline:2px solid rgba(79,99,255,0.45);

  box-shadow:
    0 6px 14px rgba(79,99,255,0.35);
}

.chat-list.dark .online-indicator{
  border-color:#1e2a38;
  outline-color:rgba(255,255,255,0.22);
}




/* =============================== */
/*        TEXT (NAME + LAST)       */
/* =============================== */
.chat-mid{
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.chat-name,
.user-name{
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.1px;
  color: var(--ui-text);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.chat-last,
.last-message{
  margin-top: 4px;
  font-size: 14px;
  color: var(--ui-muted);

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  transform: none;
  padding-left: 0;
}

.group-icon{
  font-size: 0.9em;
  color: inherit;
}

/* =============================== */
/*        RIGHT SIDE (TIME)        */
/* =============================== */
.chat-right{
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding-left: 8px;
}

.chat-time,
.msg-time{
  font-size: 12px;
  font-weight: 700;
  color: var(--ui-muted2);
  white-space: nowrap;
}

.unread{
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;

  background: linear-gradient(135deg, var(--color-primary, #3f63ff), #7b5cff);
  color: #fff;

  font-weight: 900;
  font-size: 12px;

  display: grid;
  place-items: center;

  box-shadow: 0 14px 22px rgba(63, 99, 255, 0.25);
}

.chat-list.dark .unread{
  box-shadow: 0 14px 22px rgba(0,0,0,0.28);
}



/* =============================== */
/*      MESSAGE STATUS ICONS       */
/* =============================== */
.msg-time[data-status]::before{
  content: "";
  display: inline-block;
  background: currentColor;

  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;

  -webkit-mask-size: contain;
  mask-size: contain;

  margin-right: 4px;
  vertical-align: middle;
}

.msg-time[data-status="unread"]::before{
  width: 16px;
  height: 14px;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg width='16' height='14' viewBox='0 0 16 14' xmlns='http://www.w3.org/2000/svg'><path d='M5.99999 9.17203L2.82796 6L1.76758 7.06038L5.99999 11.2928L15.0603 2.23242L14 1.17203L5.99999 9.17203Z' fill='black'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg width='16' height='14' viewBox='0 0 16 14' xmlns='http://www.w3.org/2000/svg'><path d='M5.99999 9.17203L2.82796 6L1.76758 7.06038L5.99999 11.2928L15.0603 2.23242L14 1.17203L5.99999 9.17203Z' fill='black'/></svg>");
}

.msg-time[data-status="read"]::before{
  width: 21px;
  height: 14px;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg width='26' height='14' viewBox='0 0 26 14' xmlns='http://www.w3.org/2000/svg'><path d='M5.99999 9.17203L2.82796 6L1.76758 7.06038L5.99999 11.2928L15.0603 2.23242L14 1.17203L5.99999 9.17203Z' fill='black'/><path d='M11.59501 8.00586L10.53463 6.94548L9.47424 8.00586L11.59501 10.1266L20.6554 1.06622L19.595 0.00585938L11.59501 8.00586Z' fill='black'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg width='26' height='14' viewBox='0 0 26 14' xmlns='http://www.w3.org/2000/svg'><path d='M5.99999 9.17203L2.82796 6L1.76758 7.06038L5.99999 11.2928L15.0603 2.23242L14 1.17203L5.99999 9.17203Z' fill='black'/><path d='M11.59501 8.00586L10.53463 6.94548L9.47424 8.00586L11.59501 10.1266L20.6554 1.06622L19.595 0.00585938L11.59501 8.00586Z' fill='black'/></svg>");
}

/* =============================== */
/*              FAB               */
/* =============================== */
#openModal.btn-corner{
  position: fixed;
  right: 22px;
  bottom: 98px;
  z-index: 500;
}

#openModal.btn-circle{
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: var(--fab-radius);
  border: 0;
  outline: 0;

  background: linear-gradient(135deg, rgba(63, 99, 255, 0.95), rgba(123, 92, 255, 0.95));
  color: #fff;

  display: grid;
  place-items: center;

  cursor: pointer;
  box-shadow: var(--fab-shadow);

  transition: transform .18s ease, box-shadow .25s ease, filter .25s ease;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

#openModal:hover{
  filter: brightness(1.03) saturate(1.05);
  box-shadow: var(--fab-shadow-hover);
}

#openModal:active{
  transform: scale(.985);
}

#openModal .animated-button-icon-icon{
  position: static;
  font-size: 24px;
  line-height: 1;
  opacity: 1;
  transform: none;
}

#openModal .animated-button-icon-icon-first{
  display: none;
}

#openModal .c-ripple{
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fab-wrapper{
  position: fixed;
  right: 22px;
  bottom: 98px;
  z-index: 500;
}

.fab-mini{
  position: absolute;
  right: 3px;
  width: 46px;
  height: 46px;
  border-radius: 18px;
  border: 0;
  background: linear-gradient(135deg, rgba(63,99,255,.95), rgba(123,92,255,.95));
  color:#fff;
  display:grid;
  place-items:center;
  font-size:18px;
  cursor:pointer;
  box-shadow: var(--fab-shadow);
  opacity:0;
  transform: translateY(0) scale(.85);
  pointer-events:none;
  transition: .25s ease;
}

.fab-wrapper.open .fab-mini{
  opacity:1;
  pointer-events:auto;
}

#fabGroup{
  bottom: 56px;
}

#fabBroadcast{
  bottom: 109px;
}


.fab-wrapper.open #fabGroup{
  transform: translateY(-6px) scale(1);
}

.fab-wrapper.open #fabBroadcast{
  transform: translateY(-6px) scale(1);
}



.ripple-wave{
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  opacity: .35;
  background: currentColor;
  animation: ripple .6s ease-out forwards;
}

@keyframes ripple{
  to{ transform: scale(3.2); opacity: 0; }
}

.tabs{
  position:absolute;
  left:12px;
  right:12px;
  bottom:8px;
  height:56px;
  border-radius:20px;

  background:rgba(255,255,255,0.72);
  border:1px solid rgba(120, 140, 175, 0.14);
  box-shadow:0 18px 34px rgba(32, 44, 76, 0.14);

  display:flex;
  align-items:center;
  justify-content:space-around;

  padding:8px 10px calc(8px + env(safe-area-inset-bottom));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  z-index: 50;
}

.tab{
  border:0;
  background:transparent;
  width:32%;
  height:100%;
  border-radius:16px;

  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;

  gap:4px;
  color:rgba(60, 74, 96, 0.72);
}

.tab-ic{ width:20px; height:20px; display:block; }

.tab-label{
  font-size:11px;
  font-weight:800;
}

.tab:active{ transform:scale(0.992); }
.tab.active{ color:rgba(63, 99, 255, 0.98); }
:root{
  --fab-size: 55px;
  --fab-radius: 21px;
}

#openModal .animated-button-icon-icon{
  font-size: 22px;
}
.tabs{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  height: 56px;
  border-radius: 20px;

  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(120, 140, 175, 0.14);
  box-shadow: 0 18px 34px rgba(32, 44, 76, 0.14);

  display: flex;
  align-items: center;
  justify-content: space-around;

  padding: 8px 10px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  z-index: 1000;
}

#openModal.btn-corner{
  position: fixed;
  right: 22px;
  bottom: calc(98px + env(safe-area-inset-bottom));
  z-index: 1100;
}

.chat-list{
  padding-bottom: calc(56px + 24px + env(safe-area-inset-bottom));
}

@media (max-width: 737px){
  .chat-list{
    height: 100vh;
    overflow-y: auto;
    padding-bottom: calc(56px + 24px + env(safe-area-inset-bottom));
  }
}


.calls-date-sep{
  margin: 14px 16px 6px;
  font-weight: 800;
  color: var(--ui-muted2);
}

.call-item{
  width:100%;
  border:0;
  background:transparent;

  display:flex;
  align-items:center;
  gap:12px;

  padding:12px 18px;
  border-radius:16px;

  text-align:left;
  cursor:pointer;

  box-sizing:border-box;
  transition:
    transform .12s ease,
    background .12s ease,
    box-shadow .12s ease;

  -webkit-tap-highlight-color: transparent;
}

.call-item:hover{
  background:rgba(255,255,255,0.44);
}

.chat-list.dark .call-item:hover{
  background:rgba(255,255,255,0.08);
}

.call-item:active{
  transform:scale(0.992);
}

.call-item + .call-item{
  border-top:1px solid var(--ui-line);
  border-radius:0;
}

.call-item:first-of-type{
  border-top:0;
}

.call-avatar{
  width:52px;
  height:52px;
  border-radius:50%;
  object-fit:cover;

  box-shadow: var(--ui-shadow-sm);
  border:3px solid rgba(255,255,255,0.86);
  background: rgba(255,255,255,0.65);

  flex:0 0 auto;
  display:block;
}

.chat-list.dark .call-avatar{
  border-color: rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.10);
}

.call-main{
  min-width:0;
  flex:1 1 auto;
  display:flex;
  flex-direction:column;
}

.call-top{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:10px;
}

.call-name{
  font-size:18px;
  font-weight:800;
  letter-spacing:0.1px;
  color: var(--ui-text);

  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.call-when{
  font-size:12px;
  font-weight:700;
  color: var(--ui-muted2);
  white-space:nowrap;
  flex:0 0 auto;
}

.call-sub{
  margin-top:4px;
  display:flex;
  align-items:center;
  gap:8px;
  font-size:14px;
  color: var(--ui-muted);
  white-space:nowrap;
}

.call-arrow{
  font-weight:900;
  line-height:1;
}

.call-dur{
  font-weight:800;
}
.chat-list{
  position: relative;
  display: flex;
  flex-direction: column;
  height: calc(100% - 20px);
  overflow: hidden;
  padding: 12px 0;
  padding-bottom: 0;
}

.chat-scroll{
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;

  scrollbar-width: none;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;

  padding-bottom: calc(56px + 24px + env(safe-area-inset-bottom));
}

.chat-scroll::-webkit-scrollbar{ display:none; }

.tabs{
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  height: 56px;
  z-index: 1000;
}

#openModal.btn-corner{
  position: fixed;
  right: 22px;
  bottom: calc(98px + env(safe-area-inset-bottom));
  z-index: 1100;
}

@media (max-width: 737px){
  .chat-list{
    height: 100vh;
  }
}

@media (min-width: 738px){
  .chat-list{
    height: calc(100% - 20px);
  }
}


.fab-wrapper{
  position: fixed;
  right: 22px;
  bottom: calc(98px + env(safe-area-inset-bottom));
  z-index: 1100;
  width: var(--fab-size);
  height: var(--fab-size);
}

#openModal{
  position: absolute;
  right: 0;
  bottom: 0;
}

.fab-mini{
  position: absolute;
  right: 3px;
  opacity: 0;
  pointer-events: none;
  transform: scale(.85);
  transition: .25s ease;
}

.fab-wrapper.open .fab-mini{
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

#fabGroup{ bottom: calc(var(--fab-size) + 10px); }
#fabBroadcast{ bottom: calc(var(--fab-size) + 10px + 53px); }
