#bottom-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  height: 65px;
  z-index: 100000;
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid rgba(255, 0, 0, 0.35);
  border-radius: 50px;
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
  opacity: 1;
  transition: background 0.3s ease, border 0.3s ease;
  overflow: hidden;
}

#bottom-bar::after {
  content: '';
  position: absolute;
  width: 90px;
  height: 60px;
  border-radius: 50px;
  border: none;
  background: rgba(202, 132, 132, 0.25);
  box-shadow: inset 0 0 12px rgba(141, 97, 97, 0.25);
  left: calc(10% - 45px);
  transition: left 0.45s cubic-bezier(0.34,1.56,0.64,1), background 0.3s ease, box-shadow 0.3s ease;
  pointer-events: none;
  z-index: 0;
}
#bottom-bar:has(#btn-summary.active)::after {
  left: calc(10% - 37px);
}
#bottom-bar:has(#btn-quran.active)::after {
  left: calc(30% - 45px);
}
#bottom-bar:has(#btn-habits.active)::after {
  left: calc(50% - 45px);
}
#bottom-bar:has(#btn-athkar.active)::after {
  left: calc(70% - 45px);
}
#bottom-bar:has(#btn-counter.active)::after {
  left: calc(90% - 53px);
}

@keyframes slideUpBar {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(100px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

#viewer.screen, #chatsScreen, #chatScreen {
  display: none;
}

#viewer.screen[style*="display: flex"] ~ body #bottom-bar,
body:has(#viewer[style*="display: flex"]) #bottom-bar {
  opacity: 0 !important;
  pointer-events: none;
  transform: translateX(-50%) translateY(100px) scale(0.8) !important;
}

#viewer.screen, #chatsScreen, #chatScreen {
  display: none;
}

#viewer.screen[style*="display: flex"] ~ body #bottom-bar,
body:has(#viewer[style*="display: flex"]) #bottom-bar {
  opacity: 0 !important;
  pointer-events: none;
  transform: translateX(-50%) translateY(100px) scale(0.8) !important;
}

#bottom-bar button {
  width: 55px;
  height: 55px;
  background: none;
  border: none;
  padding: 0;
  border-radius: 30px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;
  z-index: 1;
  transition: transform 0.2s cubic-bezier(0.4,0,0.2,1);
}

#bottom-bar button:hover {
  transform: scale(1.08);
}

#bottom-bar button:active {
  transform: scale(0.92);
}

#bottom-bar button .material-symbols-outlined {
  font-size: 28px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  transition: color 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

#bottom-bar button .button-label {
  font-size: 12px;
  margin-top: 3px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  transition: color 0.3s cubic-bezier(0.4,0,0.2,1);
  text-align: center;
  line-height: 1;
}

#bottom-bar button:hover .material-symbols-outlined {
  transform: translateY(-2px);
}

#bottom-bar button.active .material-symbols-outlined {
  color: rgba(255, 0, 0, 0.95);
  animation: iconSpin 0.5s cubic-bezier(0.34,1.56,0.64,1) forwards;
}

#bottom-bar button.active .button-label {
  color: rgba(255, 0, 0, 0.95);
}

@keyframes iconSpin {
  0% {
    transform: rotate(0deg) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

#bottom-bar button::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 30px;
  background: rgba(255,0,0,0.3);
  transform: scale(0);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.4,0,0.2,1), opacity 0.5s cubic-bezier(0.4,0,0.2,1);
}

#bottom-bar button:active::before {
  transform: scale(2);
  opacity: 0;
  transition: transform 0.6s cubic-bezier(0.4,0,0.2,1), opacity 0.6s cubic-bezier(0.4,0,0.2,1);
}





@media (hover: hover) {
  #bottom-bar button:not(.active):hover {
    background: rgba(226, 226, 226, 0.1);
  }
}

body.light-mode #bottom-bar {
  background: rgba(239, 68, 68, 0.15);
  border: 2px solid rgba(239, 68, 68, 0.35);
}

body.light-mode #bottom-bar::after {
  background: rgba(239, 68, 68, 0.25);
  box-shadow: inset 0 0 12px rgba(239, 68, 68, 0.35);
}

body.light-mode #bottom-bar button .material-symbols-outlined {
  color: rgba(0, 0, 0, 0.95);
}

body.light-mode #bottom-bar button .button-label {
  color: rgba(0, 0, 0, 0.85);
}

body.light-mode #bottom-bar button.active .material-symbols-outlined {
  color: rgba(255, 0, 0, 0.95);
}

body.light-mode #bottom-bar button.active .button-label {
  color: rgba(255, 0, 0, 0.95);
}