/* /css/nav.css - Ambient Pixels v2.3 Refreshed */

/* --- General Nav Styles --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2000;
  background: rgba(7, 16, 25, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo img {
  height: 40px;
  width: auto;
}

.nav-logo-text h1 {
  font-size: 1.5em;
  font-weight: 500;
}

.nav-subheading {
  font-size: 0.9em;
  color: #aaa;
}

.nav-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* --- Navigation Links --- */
.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  font-size: 1em;
  gap: 8px;
  white-space: nowrap;
  padding: 6px 4px;
  transition: background 0.2s ease;
}

.nav-links .link-text {
  display: inline;
}

.nav-links i {
  font-size: 1.2em;
}

/* --- Theme Toggle --- */
.nav-utility {
  display: flex;
  align-items: center;
  gap: 10px;
}

#theme-toggle {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: inherit;
}

/* Auth Buttons: Login/Logout */
.nav-auth-btn {
  color: #fff !important;
  background: none;
  border: none;
  font-size: 1em;
  font-family: inherit;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.nav-auth-btn:hover, .nav-auth-btn:focus {
  background: rgba(255,255,255,0.08);
  color: #fff;
  outline: none;
}


/* --- Mobile Toggle Button --- */
.nav-toggle {
  display: none;
  font-size: 1.5em;
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
}

/* --- Mobile Nav Overlay --- */
.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1999;
}

.nav-overlay.active {
  display: block;
}

/* --- Mobile Styles (768px and below) --- */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-content {
    flex-grow: 1;
    justify-content: flex-end;
  }

  .nav-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    position: fixed;
    top: 50px;
    left: -100%;
    width: 100%;
    height: auto;
    min-height: 100%;
    background: rgba(7, 16, 25, 0.98);
    padding: 10px;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.4);
    transition: left 0.3s ease;
    z-index: 2001;
    overflow-y: auto;
    align-content: start;
    margin-top: 63px;
  }

  .nav-links.active {
    left: 0;
  }

  .nav-links li {
    margin: 0;
    width: 100%;
  }

  .nav-links a {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    text-align: center;
    min-height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
  }
  
  .nav-links a:hover {
    background: rgba(255, 255, 255, 0.1);
  }
  
  /* User Profile Dropdown - Mobile */
  .user-profile-container {
    position: relative;
    display: none; /* Hidden by default, shown via JS when authenticated */
  }
  
  .user-profile-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    transition: background 0.2s;
  }
  
  .user-profile-button:hover {
    background: rgba(255, 255, 255, 0.1);
  }
  
  .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
  }
  
  .user-avatar i {
    font-size: 1.5em;
    color: #fff;
  }
  
  .user-display-name {
    font-size: 0.9em;
    font-weight: 500;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .user-profile-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    margin-top: 8px;
    display: none;
    z-index: 1000;
  }
  
  .dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
  }
  
  .dropdown-user-name {
    display: block;
    font-weight: 600;
    color: #333;
  }
  
  .dropdown-user-email {
    display: block;
    font-size: 0.8em;
    color: #666;
    margin-top: 2px;
  }
  
  .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: #333;
    text-decoration: none;
    transition: background 0.2s;
  }
  
  .dropdown-item:hover {
    background: #f5f5f5;
  }
  
  .dropdown-item i {
    width: 20px;
    text-align: center;
    color: #666;
  }
  
  .nav-links .fas {
    margin-bottom: 4px;
  }
}

/* --- Tablet Styles (769px to 920px) --- */
@media (min-width: 769px) and (max-width: 920px) {
  .nav-links a {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .nav-links .link-text {
    font-size: 0.9em;
  }
}

/* --- User Profile Dropdown (Global) --- */
.user-profile-container {
  position: relative;
  display: none; /* Hidden by default, shown via JS when authenticated */
}

.user-profile-button {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 20px;
  transition: background 0.2s;
}

.user-profile-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
}

.user-avatar i {
  font-size: 1.5em;
  color: #fff;
}

.user-display-name {
  font-size: 0.9em;
  font-weight: 500;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-profile-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  margin-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1000;
}

.user-profile-dropdown:not(.dropdown-hidden) {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-hidden {
  display: none !important;
}

.dropdown-header {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
}

.dropdown-user-name {
  display: block;
  font-weight: 600;
  color: #333;
}

.dropdown-user-email {
  display: block;
  font-size: 0.8em;
  color: #666;
  margin-top: 2px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: #333;
  text-decoration: none;
  transition: background 0.2s;
}

.dropdown-item:hover {
  background: #f5f5f5;
}

.dropdown-item i {
  width: 20px;
  text-align: center;
  color: #666;
}

/* --- Desktop Styles (921px and above) --- */
@media (min-width: 921px) {
  .nav-links {
    position: relative;
    transition: transform 0.3s cubic-bezier(.6,.2,.2,1);
  }


  .nav-links .link-text {
    display: inline-block;
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    vertical-align: middle;
    transition: max-width 0.35s cubic-bezier(.6,.2,.2,1), opacity 0.3s cubic-bezier(.6,.2,.2,1);
    white-space: nowrap;
  }

  .nav-links a {
    gap: 0; /* Remove gap when text is hidden */
    padding: 6px 10px; /* Adjust padding for icon-only view */
    transition: padding 0.35s cubic-bezier(.6,.2,.2,1);
    padding-right: 10px;
  }

  .nav-links a:hover .link-text, .nav-links a:focus .link-text {
    max-width: 160px;
    opacity: 1;
  }

  .nav-links a:hover, .nav-links a:focus {
    padding-right: 18px;
  }

  .nav-links a:hover {
    gap: 8px; /* Restore gap on hover */
  }
}
