/* ===== UNIVERSAL NAVIGATION RESPONSIVE CSS ===== */
/* Apply this to ALL pages for consistent navbar and sidebar mobile behavior */

/* ===== TABLET RESPONSIVE (769px - 1024px) ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  
  /* ===== NAVBAR TABLET ===== */
  #navbar {
    position: fixed;
    top: 0;
    left: 0; /* Full width navbar */
    right: 0;
    height: 80px;
    padding: 0 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }
  
  /* Search bar responsive */
  #ClientSearch {
    flex: 1 1 200px;
    max-width: 300px;
    margin: 0 12px;
  }
  
  /* Button container */
  #navbarbttns {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    align-items: center;
  }
  
  /* ===== SIDEBAR TABLET ===== */
  #websitecontainer > div:first-child {
    position: static;
    width: 100%;
    margin-top: 100px;
    display: flex;
    flex-direction: column;
  }
  
  #sidebar {
    position: static !important;
    width: 100% !important;
    height: 60px !important;
    padding: 0 !important;
    top: auto !important;
    display: flex !important;
    flex-direction: row !important; /* FORCE HORIZONTAL */
    justify-content: space-evenly !important;
    align-items: stretch !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    flex-wrap: nowrap !important;
  }
  
  #sidebar > div {
    flex: 1 1 0 !important;
    min-width: 120px !important;
    display: flex !important;
    height: 100% !important;
  }
  
  #sidebar > div > a {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
  }
  
  #sidebar > div > a > button {
    width: 100% !important;
    height: 100% !important;
    padding: 8px 12px !important;
    font-size: 16px !important;
    white-space: normal !important;
     word-wrap: break-word !important;  
    text-align: center !important;
    border-radius: 0 !important;
    margin: 0 !important;
    border: none !important;
    border-right: 1px solid rgba(255,255,255,0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  #sidebar > div:last-child > a > button {
    border-right: none;
  }
  
  /* ===== MAIN CONTENT TABLET ===== */
  #rightsidepagecontainer {
    position: static;
    left: 0;
    top: 0;
    margin-top: 0;
    padding: 20px;
    height: auto;
  }
}

/* ===== MOBILE RESPONSIVE (max-width: 768px) ===== */
/* FIXED: Changed to 768px to eliminate gap */
@media (max-width: 768px) {
  
  /* ===== NAVBAR MOBILE ===== */
  #navbar {
    position: fixed;
    top: 0;
    left: 0; /* Full width navbar */
    right: 0;
    height: 70px;
    padding: 0 12px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
  }
  
  /* Logo compact */
  #navbarimg {
    flex: 0 0 auto;
  }
  
  #navbarimg img {
    height: 32px;
  }
  
  /* Search bar compact */
  #ClientSearch {
    flex: 1 1 120px;
    min-width: 100px;
    max-width: 180px;
    margin: 0 4px;
  }
  
  #ClientSearch input {
    padding: 8px 12px;
    font-size: 16px; /* Prevent iOS zoom */
    border-radius: 20px;
  }
  
  /* Buttons compact */
  #navbarbttns {
    flex: 0 0 auto;
    display: flex;
    gap: 6px;
    align-items: center;
  }
  
  /* Create button smaller */
  #create-dropdown-container > button {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  /* Account button - hide name */
  .account-btn span {
    display: none;
  }
  
  .account-btn {
    padding: 6px 8px !important;
  }
  
  .account-btn .account-avatar {
    width: 28px !important;
    height: 28px !important;
  }
  
  /* ===== SIDEBAR MOBILE ===== */
  #websitecontainer {
    display: block;
  }
  
  #websitecontainer > div:first-child {
    position: static;
    width: 100%;
    margin-top: 70px;
    margin-bottom: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  
  #sidebar {
    position: static !important;
    width: 100% !important;
    height: 60px !important; /* Compact height */
    padding-top: 10px;
    
    top: auto !important;
    display: flex !important;
    flex-direction: row !important; /* FORCE HORIZONTAL */
    justify-content: space-between !important;
    align-items: stretch !important;
    overflow-x: hidden !important;
    overflow-y: visible !important;
    background: linear-gradient(90deg, var(--primary-green) 0%, var(--primary-green-dark) 100%) !important;
    gap: 1px !important;
    box-sizing: border-box !important;
    flex-wrap: nowrap !important;
  }
  
  #sidebar > div {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    display: flex !important;
    height: 100% !important;
  }
  
  #sidebar > div > a {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
  }
  
  #sidebar > div > a > button {
    width: 100% !important;
    height: 100% !important;
    font-size: 16px !important;
    padding: 2px 1px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    text-align: center !important;
    line-height: 1.0 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: transparent !important;
    color: white !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  
  #sidebar > div > a > button:hover {
    background: rgba(255,255,255,0.15);
    transform: none;
  }
  
  /* ===== MAIN CONTENT MOBILE ===== */
  #rightsidepagecontainer {
    position: static;
    left: 0;
    top: 0;
    margin-top: 0;
    padding: 12px;
    height: auto;
  }
}

/* ===== SMALL PHONES (max-width: 480px) ===== */
@media (max-width: 480px) {
  
  /* Ultra compact navbar */
  #navbar {
    height: 60px;
    padding: 0 8px;
  }
  
  #navbarimg img {
    height: 28px;
  }
  
  #ClientSearch {
    max-width: 140px;
  }
  
  #create-dropdown-container > button {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  
  /* Ultra compact sidebar */
  #websitecontainer > div:first-child {
    margin-top: 60px !important;
  }
  
  #sidebar > div > a > button {
    font-size: 12px !important;
    padding: 1px !important;
    line-height: 0.9 !important;
  }
}

/* ===== LANDSCAPE ORIENTATION ===== */
@media screen and (orientation: landscape) and (max-height: 500px) {
  #navbar {
    height: 50px !important;
  }
  
  #sidebar {
    height: 35px !important;
  }
  
  #websitecontainer > div:first-child {
    margin-top: 50px !important;
  }
}

/* ===== iOS SAFE AREA SUPPORT ===== */
@supports (padding: max(0px)) {
  @media (max-width: 1024px) {
    #navbar {
      padding-left: max(12px, env(safe-area-inset-left));
      padding-right: max(12px, env(safe-area-inset-right));
    }
    
    #rightsidepagecontainer {
      padding-left: max(12px, env(safe-area-inset-left));
      padding-right: max(12px, env(safe-area-inset-right));
    }
  }
}

/* ===== PREVENT iOS INPUT ZOOM ===== */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  input[type="text"],
  input[type="search"] {
    font-size: 16px !important;
  }
}

/* ===== FIXED DROPDOWN MENU FUNCTIONALITY (UNIVERSAL) ===== */

/* Ensure dropdown containers have proper positioning on ALL screen sizes */
.account-dropdown-container,
#create-dropdown-container {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  z-index: 1001 !important;
}

/* Account and Create dropdown menus - FIXED POSITIONING */
#accountDropdown,
#createDropdownMenu,
.account-dropdown-container .dropdown-menu {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: 0 !important;
  min-width: 180px !important;
  background: white !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
  padding: 8px 0 !important;
  z-index: 10000 !important; /* Very high z-index to ensure visibility */
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  transition: all 0.3s ease !important;
  pointer-events: auto !important;
}

/* Hidden state for dropdowns */
#accountDropdown.hidden,
#createDropdownMenu.hidden,
.account-dropdown-container .dropdown-menu.hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateY(-10px) !important;
  pointer-events: none !important;
}

/* Dropdown header styling */
.dropdown-header {
  padding: 16px 20px !important;
  border-bottom: 1px solid #e2e8f0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  background: #f8fafc !important;
  margin: 0 !important;
}

.dropdown-avatar {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: white !important;
  font-weight: bold !important;
  font-size: 16px !important;
}

/* Dropdown items styling */
.dropdown-item {
  display: block !important;
  padding: 12px 20px !important;
  color: #374151 !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
  border: none !important;
  background: none !important;
  width: 100% !important;
  text-align: left !important;
  cursor: pointer !important;
  font-size: 14px !important;
}

.dropdown-item:hover {
  background: #f3f4f6 !important;
  color: var(--primary-green) !important;
  padding-left: 24px !important;
}

/* Create dropdown items styling */
#createDropdownMenu div {
  padding: 12px 16px !important;
  cursor: pointer !important;
  transition: background-color 0.2s ease !important;
  font-size: 14px !important;
  color: #374151 !important;
}

#createDropdownMenu div:hover {
  background: #f3f4f6 !important;
  color: var(--primary-green) !important;
}

/* Responsive dropdown sizing */
@media (max-width: 768px) {
  #accountDropdown,
  #createDropdownMenu,
  .account-dropdown-container .dropdown-menu {
    min-width: 160px !important;
    right: 0 !important;
  }
  
  .dropdown-item {
    padding: 10px 16px !important;
    font-size: 13px !important;
  }
  
  #createDropdownMenu div {
    padding: 10px 14px !important;
    font-size: 13px !important;
  }
}

@media (max-width: 600px) {
  #accountDropdown,
  #createDropdownMenu,
  .account-dropdown-container .dropdown-menu {
    min-width: 140px !important;
    right: 0 !important;
    font-size: 12px !important;
  }
  
  .dropdown-item {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
  
  .dropdown-header {
    padding: 12px 16px !important;
  }
  
  .dropdown-avatar {
    width: 32px !important;
    height: 32px !important;
    font-size: 14px !important;
  }
  
  #createDropdownMenu div {
    padding: 8px 12px !important;
    font-size: 12px !important;
  }


}/* ── Override for the two long labels ── */
#sidebarRefferedEmailBttn,
#sidebaremailrefferedBttn {
  /* allow the text to wrap inside the flex-button */
  display: flex !important;
  flex-wrap: wrap !important;
  /* break the “words” if there’s no natural space */
  overflow-wrap: break-word !important;
  word-break: break-word !important;

  /* tighten them up a bit (optional) */
  font-size: 14px !important;
  line-height: 1.2 !important;
  padding: 6px 8px !important;
  
  /* center the wrapped text */
  
 
}
