.header {
  background-color: #2b2f33;
  height: 56px; /* Reduced from 64px */
  display: flex;
  align-items: center;
  padding: 0 12px; /* Reduced padding */
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 3px;
  position: relative;
}

.nav-left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-link {
  margin-right: 0px;
}

.brand-name {
  font-size: 18px; /* Reduced from 20px */
  font-weight: bold;
  color: #007bff;
  margin-right: 10px;
  text-decoration: none;
  transition: color 0.2s ease;
}

.brand-name:hover {
  color: #0056b3;
}

.nav-link {
  color: #dfe6ea;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 500;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
}

.home-icon {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  filter: invert(1);
}

.nav-center {
  display: flex;
  justify-content: center;
  flex: 1;
}

.search-container {
  position: relative;
  width: 80%; /* Increased from 70% */
  max-width: 700px; /* Increased from 600px */
  min-width: 200px;
  display: flex;
  gap: 0px;
}

.search-type-dropdown .Select {
  margin: 0 !important;
}

.search-type-dropdown .Select-control {
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 18px !important;
  color: #fff !important;
  font-size: 11px !important;
  min-width: 70px !important; /* Ensure control is wide enough for selected text */
  width: auto !important;
}

.search-type-dropdown .Select-value-label {
  color: #fff !important;
  font-weight: 500 !important;
}

.search-type-dropdown .Select-arrow {
  border-color: rgba(255, 255, 255, 0.7) transparent transparent !important;
}

  .search-type-dropdown .Select-menu-outer {
  background: #f8f9fa !important;
  border: 1px solid #ddd !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
  z-index: 1002 !important;
  /* Allow the dropdown to size automatically but ensure it's not too narrow on desktop */
  width: auto !important;
  min-width: 240px !important;
  max-width: 700px !important;
}


#search-type-dropdown, .dash-dropdown {
  margin: 0 !important;
  padding: 0 !important; 
}

.search-type-dropdown .Select-menu {
  background: #f8f9fa !important;
  color: #333 !important;
  font-size: 11px !important;
  /* Prevent option text from wrapping/truncating unexpectedly */
  white-space: nowrap;
}

/* Modern Dash dropdown menu styling */
.search-type-dropdown .dropdown-menu {
  background: #f8f9fa !important;
  font-size: 11px !important;
  color: #333 !important;
  border: 1px solid #ddd !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

.search-type-dropdown .Select-option {
  color: #333 !important;
  font-size: 11px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-type-dropdown .Select-option:hover {
  background-color: #e9ecef !important;
  color: #333 !important;
}

/* Also ensure other dropdown constructs inherit a sensible min width */
.search-type-dropdown .dropdown-menu,
.search-type-dropdown .dropdown-content {
  min-width: 90px !important;
  width: auto !important;
  white-space: nowrap;
}

/* Desktop-specific safety: on larger screens, keep dropdown wide enough */
@media (min-width: 769px) {
  .search-type-dropdown .Select-menu-outer {
    min-width: 90px !important;
  }
}

@media (max-width: 769px) {
  .search-type-dropdown .Select-menu-outer {
    min-width: 60px !important;
  }
}

.search-type-dropdown .Select-option.is-focused {
  background-color: #e9ecef !important;
  color: #333 !important;
}

/* Additional selectors for Dash dropdown */
.search-type-dropdown .dropdown-option {
  color: #333 !important;
}

.search-type-dropdown .dropdown-option:hover {
  color: #333 !important;
  background-color: #e9ecef !important;
}

/* More specific selectors for modern Dash versions */
.search-type-dropdown div[role="option"] {
  color: #333 !important;
}

.search-type-dropdown div[role="option"]:hover {
  color: #333 !important;
  background-color: #e9ecef !important;
}

.search-type-dropdown .dash-dropdown-option {
  color: #333 !important;
}

.search-type-dropdown .dash-dropdown-option:hover {
  color: #333 !important;
  background-color: #e9ecef !important;
}

/* Global dropdown text color fix */
.search-type-dropdown * {
  color: inherit;
}

.search-type-dropdown [data-dash-is-loading="true"] {
  color: #333 !important;
}

/* Ensure all dropdown text is visible */
.search-type-dropdown .dropdown-content {
  background: #f8f9fa !important;
}

.search-type-dropdown .dropdown-content * {
  color: #333 !important;
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: #fff;
  font-size: inherit;
  font-weight: 500;
}
.search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1001;
  margin-top: 4px;
  max-height: 400px;
  overflow-y: auto;
}

.search-container:focus-within .search-results {
  display: block !important;
}

.search-user-link {
  display: block;
  padding: 12px 16px;
  transition: background-color 0.2s;
}

.search-user-link:last-child {
  border-bottom: none;
}

.search-user-link:hover {
  background-color: #f8f9fa;
}

.search-user-item {
  display: flex;
  align-items: center;
  color: #333;
}

.search-username {
  font-weight: 500;
}

.search-no-results,
.search-error {
  padding: 12px 16px;
  color: #666;
  font-style: italic;
}

/* New search result styles for books and authors */
.search-section-header {
  padding: 8px 16px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  color: #666;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.search-separator {
  margin: 0;
  border: none;
  border-top: 1px solid #e9ecef;
}

.search-book-item,
.search-author-item {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
  cursor: pointer;
}

.search-book-item:hover,
.search-author-item:hover {
  background-color: #f8f9fa;
}

.search-book-title,
.search-author-name {
  font-weight: 500;
  color: #333;
  margin-bottom: 2px;
}

.search-book-author,
.search-author-works {
  font-size: 12px;
  color: #666;
}

.nav-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.profile-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.profile-img {
  width: 95%;
  height: 95%;
  object-fit: cover;
  display: block;
  padding: 1px;
}

.settings-img {
  width: 28px;
  height: 28px;
  background: transparent;
  display: block;
  filter: invert(1);
  cursor: pointer;
}

.bookshelf-img {
  width: 28px;
  height: 28px;
  background: transparent;
  display: block;
  filter: invert(1);
  cursor: pointer;
}

/* Settings Dropdown Menu */
.settings-menu-container {
  position: relative;
  display: inline-block;
}

.settings-menu-container:hover .settings-dropdown,
.settings-dropdown:hover {
  display: block !important;
  pointer-events: auto;
}

.settings-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 120px;
  display: none;
  margin-top: 2px;
  pointer-events: auto;
}

/* Invisible bridge to prevent hover from breaking */
.settings-dropdown::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 6px;
  background: transparent;
}

.dropdown-item {
  display: block;
  padding: 8px 16px;
  color: #333;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}

.dropdown-item:hover {
  background-color: #f8f9fa;
}

.logout-item {
  color: #dc3545 !important;
  font-weight: 500;
}

.logout-item:hover {
  background-color: #fff5f5 !important;
}

/* Notifications styles */
.notifications-container {
  position: relative;
  display: inline-block;
}

.notifications-img {
  width: 28px;
  height: 28px;
  background: transparent;
  display: block;
  filter: invert(1);
  cursor: pointer;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 12px;
  text-align: center;
  line-height: 18px;
  font-weight: bold;
}

.hamburger-container {
    position: relative;
    display: inline-block;
}

.mobile-notification-badge {
  position: absolute;
  top: 6px;
  left: 28px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 9px;
  text-align: center;
  line-height: 14px;
  font-weight: bold;
}

/* Hide mobile notification badge on desktop */
@media (min-width: 769px) {
  .mobile-notification-badge {
    display: none !important;
  }
}

.notifications-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    min-width: 350px;
    max-width: 400px;
    margin-top: 2px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    pointer-events: auto;
    padding: 8px 0;
}.notifications-container:hover .notifications-dropdown,
.notifications-dropdown:hover {
  display: block !important;
  pointer-events: auto;
}

.notifications-container:focus-within .notifications-dropdown {
  display: block !important;
  pointer-events: auto;
}

.notifications-dropdown::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 6px;
  background: transparent;
}

.notification-item {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.btn-accept:hover {
    background: #218838 !important;
}

.btn-decline:hover {
    background: #c82333 !important;
}

.no-notifications,
.notification-error {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

.notification-status-message {
    background-color: #f8f9fa;
    border-radius: 4px;
    margin: 4px 0;
}

.notification-status-accepted {
    border-left: 4px solid #28a745;
}

.notification-status-declined {
    border-left: 4px solid #dc3545;
}

/* User level badge in header */
.user-level {
    margin-right: 8px;
}

.level-badge {
    background: linear-gradient(135deg, var(--link-color), var(--link-hover));
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: help;
}

.level-badge.level-5 {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.level-badge.level-10 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
}

.mobile-level-badge {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    cursor: help;
    margin-left: 8px;
}

.mobile-level-badge.level-5 {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.mobile-level-badge.level-10 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
}

/* Hamburger Menu */
.hamburger-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: none;
}

.hamburger-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger-icon {
    width: 24px;
    height: 24px;
    filter: invert(1);
}

/* Mobile Menu */
.mobile-menu {
    display: none;
}

.mobile-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    cursor: pointer;
}

.mobile-menu-content {
    position: absolute;
    top: 56px;
    right: 0;
    width: 280px;
    background: #2b2f33;
    border: 1px solid #444;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 2001;
    max-height: calc(100vh - 56px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mobile-menu-header {
    position: relative;
    min-height: 44px;
    height: auto;
    border-bottom: 1px solid #444;
    background: #2b2f33;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    padding: 0 8px;
    gap: 8px;
}

.mobile-header-link {
    color: #dfe6ea !important;
    text-decoration: none !important;
    padding: 6px 8px !important;
    border-radius: 6px !important;
    margin: 0 !important;
    margin-right: auto !important;
    display: flex !important;
    align-items: center !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    white-space: nowrap !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
    cursor: pointer !important;
    pointer-events: auto !important;
}

.mobile-header-link:hover {
    background: rgba(255, 255, 255, 0.1) !important;
}

.mobile-header-link .mobile-menu-icon {
    width: 18px !important;
    height: 18px !important;
    margin-right: 6px !important;
    filter: invert(1) !important;
    flex-shrink: 0 !important;
}

.home-nav-link {
    margin-right: 12px;
    display: flex !important;
    align-items: center !important;
}

.home-nav-link .home-icon {
    width: 16px !important;
    height: 16px !important;
    margin-right: 6px !important;
}

/* Hide home nav link on mobile since it's in the mobile menu header */
@media (max-width: 768px) {
    .home-nav-link {
        display: none !important;
    }
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    color: #dfe6ea;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 4px;
    transition: background-color 0.2s;
    position: relative;
}

.mobile-menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    filter: invert(1);
}

.mobile-menu-profile-img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.mobile-menu-divider {
    border: none;
    border-top: 1px solid #444;
    margin: 12px 0;
}

.mobile-menu-logout {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    font-size: 14px;
    font-weight: 500;
}

.mobile-menu-logout:hover {
    background: #c82333;
}

.mobile-menu-login {
    background: #007bff;
    color: white;
    padding: 12px 16px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-block;
    width: 100%;
    text-align: center;
    font-weight: 500;
}

.mobile-menu-login:hover {
    background: #0056b3;
    color: white;
}

.close-mobile-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
    border-radius: 4px;
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.close-mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.close-icon {
    width: 18px;
    height: 18px;
    filter: invert(1);
}

/* Mobile/Tablet Responsive Styles */
@media (max-width: 768px) {
    .header {
        padding: 0 12px;
    }
    
    .nav {
        gap: 3px;
    }
    
    .brand-link .brand-name {
        font-size: 18px !important; /* Much smaller on mobile */
        margin-right: 0px; /* Reduced from 20px for mobile */
    }
    
    
    .nav-left .nav-link {
        display: none;
    }
    
    .nav-center {
        position: static;
        transform: none;
        flex: 1;
        margin: 0;
    }
    
    .search-container {
        width: 100%;
        max-width: none;
        min-width: 120px;
        display: flex;
        gap: 0;
        height: 100%;
    }
    
    .search-type-dropdown .Select-control, .Select-option {
        font-size: 11px !important;
        width: 45px !important;
    }
    
    .search-input {
        font-size: 11px !important;
        height: 36px !important;
        padding: 6px 12px !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
        background: rgba(255, 255, 255, 0.1) !important;
        box-sizing: border-box !important;
        width: 80px;
    }
    
    .search-type-dropdown {
        margin-right: 0px !important;
    }
    
    .search-type-dropdown .Select {
        margin: 0 !important;
    }
    
    .search-type-dropdown .Select-value {
        margin-right: 0px !important;
    }
    
    .nav-right .nav-link,
    .nav-right .user-level,
    .nav-right .bookshelf-img,
    .nav-right .profile-circle,
    .nav-right .notifications-container,
    .nav-right .settings-menu-container,
    .nav-right .login-signup-btn {
        display: none !important;
    }
    
    .hamburger-menu-btn {
        display: block !important;
    }
    
    .mobile-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 2000;
        display: none;
    }
    
    .mobile-menu-content {
        position: absolute;
        top: 56px;
        right: 8px;
        width: 280px;
    max-height: calc(100vh - 56px);
        z-index: 2001;
    }
}

/* For larger screens (desktop / larger tablets) keep a slightly narrower search box
   when available. This ruleset now applies only to screens >=1025px and <=1280px.
   It prevents overlapping rules with the mobile/tablet breakpoint above. */
@media (min-width: 769px) and (max-width: 1024px) {
  .search-container {
    width: 50%;
    max-width: 400px;
  }
}
