/* =========================================================
   1. ISOLATION & RESET
   Ensures host page CSS doesn't bleed into the navbar.
   ========================================================= */
#connectly-navbar-system {
  font-family: Arial, sans-serif;
  font-size: 16px;
  line-height: normal;
  letter-spacing: normal;
  isolation: isolate;
  z-index:9999;
}

#connectly-navbar-system * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Clear default link styles bleeding in from the page */
#connectly-navbar-system a {
  text-decoration: none;
  color: inherit;
}

/* =========================================================
   2. MAIN NAVBAR STYLES
   ========================================================= */
#connectly-navbar-system .floating-navbar {
  position: fixed !important;
  top: 80%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  padding: 0.8rem 1.2rem;
  box-shadow: 0 4px 12px rgba(118, 117, 117, 0.1);
  border-radius: 2rem;
  display: none;
  justify-content: space-between;
  align-items: center;
  z-index: 9999;
  cursor: move;
  transition: background-color 0.3s, color 0.3s;
}

#connectly-navbar-system .floating-navbar.show {
  display: flex;
}

#connectly-navbar-system .floating-navbar.dark {
  background-color: #111827;
  color: #f9fafb;
}

#connectly-navbar-system .floating-navbar.light {
  background-color: #ffffff;
  color: #111827;
}

/* Navbar Links and Buttons */
#connectly-navbar-system .floating-navbar a,
#connectly-navbar-system .floating-navbar button {
  background: none;
  border: none;
  color: inherit; /* Now inherits directly from dark/light state */
  font-size: 1.3rem;
  cursor: pointer;
  padding: 8px;
  transition: color 0.2s, transform 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Hover Effects */
#connectly-navbar-system .floating-navbar a:hover,
#connectly-navbar-system .floating-navbar button:hover {
  color: #3b82f6;
  transform: scale(1.1);
}

/* Draggable State */
#connectly-navbar-system .floating-navbar.draggable {
  cursor: move;
}

/* =========================================================
   3. HAMBURGER BUTTON
   ========================================================= */
#connectly-navbar-system .navbar-hamburger {
  background: linear-gradient(135deg, #3b82f6, #9333ea);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  font-size: 2rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.2s, background 0.2s;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99999;
}

/* =========================================================
   4. POPUPS & OVERLAY
   ========================================================= */
#connectly-navbar-system .overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 150;
}

#connectly-navbar-system .popup {
  display: none;
  position: fixed !important;
  border-radius: 1rem;
  padding: 8rem 4rem;
  z-index: 200;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.95rem;
  transition: background-color 0.3s, color 0.3s;
}

#connectly-navbar-system #moreMenu {
  top: 50%;
  left: 50%;
  align-content:center;
  height: 300px;
  justify-content: center;
  transform: translate(-50%, -50%);
}


/* Ensure Navbar is above EVERYTHING (Max 32-bit Integer Z-Index) */
#connectly-navbar-system .floating-navbar,
#connectly-navbar-system .navbar-hamburger {
  z-index: 2147483647 !important;
}

#connectly-navbar-system .notif-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  font-weight: bold;
}

#connectly-navbar-system .notif-close-btn {
  background: none !important;
  border: none !important;
  font-size: 24px !important;
  line-height: 1 !important;
  padding: 0 !important;
  cursor: pointer;
  color: inherit;
  z-index:9999;
}

#connectly-navbar-system #notifListContainer {
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}



/* base notification menu styling (positioning managed by navbar component) */
#connectly-navbar-system #notifMenu {
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 400px;
  padding: 1rem;
  overflow: hidden;
  display: none;
  z-index:99999;
  flex-direction: column;
}

/* Dark/Light Mode Popups (Fixed Sibling Target) */
#connectly-navbar-system #floating-navbar.dark ~ .popup {
  background-color: #1f2937;
  color: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

#connectly-navbar-system #floating-navbar.light ~ .popup {
  background-color: #ffffff;
  color: #111827;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Fullscreen mode for the popup */
#connectly-navbar-system .popup.fullscreen {
  top: 0 !important;
  left: 0 !important;
  transform: none !important;
  width: 100vw !important;
  height: 100vh !important;
  border-radius: 0 !important;
  padding: 1rem !important;
}

/* Popup Buttons */
#connectly-navbar-system .popup button {
  background-color: #f3f4f6;
  border: none;
  padding: 0.7rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
}

#connectly-navbar-system .popup button:hover {
  background-color: #e5e7eb;
}

#connectly-navbar-system .more-menu-button {
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  text-align: center;
  font-weight: 500;
  width: 100%;
  padding: 0.7rem 1rem;
  display: block;
}

/* Fixed theme logic for more-menu buttons */
#connectly-navbar-system #floating-navbar.light ~ .popup .more-menu-button {
  border: 1px solid #1f2937;
  color: #1f2937;
  background-color: transparent;
}

#connectly-navbar-system #floating-navbar.dark ~ .popup .more-menu-button {
  background-color: #374151;
  border: 1px solid #fdfefe;
  color: white;
}

/* =========================================================
   5. NOTIFICATIONS
   ========================================================= */
/* General Notification Item Style */
#connectly-navbar-system .notif-item {
  padding: 0.7rem;
  border-radius: 0.5rem;
  margin-bottom: 8px;
  font-size: 0.9rem;
  transition: background 0.2s, transform 0.1s;
  border-left: 4px solid #3b82f6;
  background: rgba(155, 155, 155, 0.1);
  cursor: pointer;
  display: block;
  width: 100%;
}

/* 2. Dark mode adjustments for item background */
#connectly-navbar-system #floating-navbar.dark ~ #notifMenu .notif-item {
  background: rgba(255, 255, 255, 0.05);
  color: #f9fafb;
}

/* 3. Light mode adjustments for item background */
#connectly-navbar-system #floating-navbar.light ~ #notifMenu .notif-item {
  background: rgba(0, 0, 0, 0.05);
  color: #111827;
}

/* 4. Hover effect for individual items */
#connectly-navbar-system .notif-item:hover {
  background: rgba(59, 130, 246, 0.15);
  transform: translateX(4px);
}

#connectly-navbar-system #floating-navbar.dark ~ #notifMenu .notif-item {
  background-color: #374151;
  color: #f9fafb;
}

/* =========================================================
   6. ICONS AND BADGES
   ========================================================= */
#connectly-navbar-system .nav-icon {
  position: relative;
  display: inline-block;
}
/* Container for the static header area */
#connectly-navbar-system .notif-header-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 12px 16px;
  background: inherit;
  border-bottom: 1px solid rgba(128, 128, 128, 0.2);
  z-index: 10;
}

#connectly-navbar-system .notif-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 10px;
}

#connectly-navbar-system .notif-actions-row {
  display: flex;
  gap: 8px;
}

#connectly-navbar-system .action-btn {
  font-size: 0.75rem !important;
  padding: 4px 10px !important;
  border-radius: 4px !important;
  background: rgba(59, 130, 246, 0.2) !important;
  color: #3b82f6 !important;
  width: auto !important;
  text-align: center !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

#connectly-navbar-system .clear-btn {
  background: rgba(239, 68, 68, 0.1) !important;
  color: #ef4444 !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
}

/* Updated List Container to scroll below the header */
#connectly-navbar-system #notifListContainer {
  margin-top: 85px; /* Pushes list below the header */
  overflow-y: auto;
  flex: 1;
  padding: 10px;
}

/* Close button style */
#connectly-navbar-system .notif-close-btn {
  background: none !important;
  border: none !important;
  font-size: 24px !important;
  line-height: 1 !important;
  cursor: pointer;
  color: inherit;
}
#connectly-navbar-system .badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: red;
  color: white;
  font-size: 0.65rem;
  font-weight: bold;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  line-height: 16px;
}

#connectly-navbar-system .popup-expand-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: none;
  color: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s;
}

#connectly-navbar-system .popup-expand-btn:hover {
  transform: scale(1.2);
}

/* =========================================================
   7. LOGOUT POPUP
   ========================================================= */
#connectly-navbar-system .connectly-logout-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

#connectly-navbar-system .connectly-logout-popup-content {
  background: #111827;
  color: #f9fafb;
  padding: 2rem;
  border-radius: 1rem;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  animation: connectlyPopupFade 0.3s ease-out;
}

@keyframes connectlyPopupFade {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#connectly-navbar-system .connectly-logout-buttons {
  margin-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

#connectly-navbar-system .connectly-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 0.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
}

#connectly-navbar-system .connectly-btn.cancel-btn {
  background: #6b7280;
  color: #f9fafb;
}

#connectly-navbar-system .connectly-btn.cancel-btn:hover {
  background: #4b5563;
}

#connectly-navbar-system .connectly-btn.confirm-btn {
  background: #ef4444;
  color: #f9fafb;
}

#connectly-navbar-system .connectly-btn.confirm-btn:hover {
  background: #b91c1c;
}

/* =========================================================
   8. MEDIA QUERIES
   ========================================================= */
@media (max-width: 600px) {
  #connectly-navbar-system .navbar-hamburger {
    top: 0.7rem;
    right: 0.7rem;
    bottom: auto;
    width: 44px;
    height: 44px;
    font-size: 1.7rem;
  }
  
  #connectly-navbar-system .floating-navbar {
    font-size: 1.1rem;
  }
  #connectly-navbar-system #notifMenu {
  height: 450px;
  right: auto;
  top:0;
  transform: none;
  padding: 1rem; 
  width: 100%;
  border-radius:0;
  z-index:99999;
}

  #connectly-navbar-system #moreMenu{
    width: 60%;
    height:50%;
  }
  #connectly-navbar-system .more-menu-button{
    width:100px;
    height:100%;
     font-size: 0.75rem;
  }
}

#connectly-navbar-system .navbar-hamburger.raise-for-chat {
  /* This moves it up 10% of the screen height relative to its current spot */
  transform: translateY(-5vh) !important; 
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
/* Add this to your navbar CSS or a global stylesheet */
.caller-avatar.is-talking {
  box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7);
  animation: pulse-green 1.2s infinite;
  border: 3px solid #00ff88 !important;
}

@keyframes pulse-green {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 255, 136, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(0, 255, 136, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 255, 136, 0); }
}
.notif-item {
    transition: background 0.3s;
    border-left: 3px solid transparent;
}

.notif-item.unread-style {
    background-color: rgba(0, 123, 255, 0.08); /* Light blue highlight */
    border-left: 3px solid #007bff;
    font-weight: 500;
}

.notif-item:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

body.dark-mode .notif-item.unread-style {
    background-color: rgba(255, 255, 255, 0.05);
    border-left-color: #3b82f6;
}
/* Header inside the popup */
.notif-header-actions {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(0,0,0,0.03);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    font-size: 0.75rem;
    font-weight: bold;
    color: #007bff;
}

.notif-header-actions span {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.notif-header-actions span:hover {
    background: rgba(0,123,255,0.1);
}

/* Icon Box Colors */
.notif-icon-box {
    width: 35px; height: 35px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.notif-icon-box.missed_call { background: #ffe5e5; color: #ff4d4d; }
.notif-icon-box.like { background: #ffe5f0; color: #e91e63; }
.notif-icon-box.follow { background: #e5f2ff; color: #007bff; }
.notif-icon-box.login_alert { background: #fff4e5; color: #ffa000; }

.notif-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: gray;
    font-style: italic;
}