/* ============================================================
   TOP BAR / SITE HEADER - v2.5.0
   Modern header with 3-column layout (Logo+Nav | Search | Icons)
   Added: Search clear button, improved quick search dropdown
   ============================================================ */

/* Base Header */
.site-header{
  position:relative;
  background:linear-gradient(180deg, rgba(10,10,15,0.95) 0%, rgba(5,5,8,0.9) 100%);
  /* border-bottom:1px solid rgba(75,85,99,0.3); */
  box-shadow:0 4px 12px rgba(0,0,0,0.3);
  z-index:100;
  transition:transform 0.3s ease, opacity 0.3s ease;
}

/* Decorative bottom edge - disabled for subtle shadow look
.site-header::after{
  content:'';
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  height:1px;
  background:linear-gradient(90deg,
    transparent 0%,
    rgba(168,85,247,0.3) 20%,
    rgba(34,211,238,0.3) 50%,
    rgba(249,115,22,0.3) 80%,
    transparent 100%
  );
}
*/

/* Header Content Grid - Full Width with True Center */
.header-content{
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  gap:1rem;
  width:100%;
  padding:0.75rem 1.5rem;
}

@media (min-width:1280px){
  .header-content{
    padding:0.75rem 2.5rem;
  }
}

@media (min-width:1536px){
  .header-content{
    padding:0.75rem 3rem;
  }
}

/* ============================================================
   LEFT: Logo + Clock + Navigation
   ============================================================ */

.header-left{
  display:flex;
  align-items:center;
  gap:1rem;
  justify-self:start;
}

.header-logo{
  display:flex;
  align-items:center;
  text-decoration:none;
  transition:opacity 0.2s ease;
}

.header-logo:hover{
  opacity:0.85;
}

.header-logo img{
  height:36px;
  width:auto;
}

@media (min-width:768px){
  .header-logo img{
    height:42px;
  }
}

.header-clock{
  display:none;
  align-items:center;
  font-size:0.875rem;
  color:#9ca3af;
}

@media (min-width:1024px){
  .header-clock{
    display:flex;
  }
}

/* ============================================================
   CENTER: Search (truly centered)
   ============================================================ */

.header-center{
  display:none;
  align-items:center;
  justify-content:center;
  justify-self:center;
}

@media (min-width:768px){
  .header-center{
    display:flex;
  }
}

/* Navigation Links (in header-left) */
.header-nav{
  display:none;
  align-items:center;
  gap:0.25rem;
}

@media (min-width:1024px){
  .header-nav{
    display:flex;
  }
}

.header-nav a{
  padding:0.5rem 0.875rem;
  font-size:0.8125rem;
  font-weight:500;
  text-transform:uppercase;
  letter-spacing:0.05em;
  color:#d1d5db;
  text-decoration:none;
  border-radius:0.375rem;
  transition:all 0.15s ease;
}

.header-nav a:hover{
  color:#fff;
  background:rgba(255,255,255,0.05);
}

.header-nav a:focus{
  outline:none;
  color:#c084fc;
}

/* Search Bar */
.header-search{
  position:relative;
  display:flex;
  align-items:center;
  width:24rem;
}

@media (min-width:1024px){
  .header-search{
    width:28rem;
  }
}

@media (min-width:1280px){
  .header-search{
    width:32rem;
  }
}

@media (min-width:1536px){
  .header-search{
    width:36rem;
  }
}

.header-search .search-icon{
  position:absolute;
  left:0.875rem;
  color:#6b7280;
  font-size:0.875rem;
  pointer-events:none;
}

.header-search input{
  width:100%;
  padding:0.5rem 4.5rem 0.5rem 2.5rem;
  font-size:0.875rem;
  color:#e5e7eb;
  background:rgba(31,41,55,0.6);
  border:1px solid rgba(75,85,99,0.4);
  border-radius:9999px;
  outline:none;
  transition:all 0.2s ease;
}

.header-search input::placeholder{
  color:#6b7280;
}

.header-search input:hover{
  border-color:rgba(75,85,99,0.6);
}

.header-search input:focus{
  background:rgba(31,41,55,0.8);
  border-color:rgba(56,189,248,0.5);
  box-shadow:0 0 0 3px rgba(56,189,248,0.1);
}

.header-search .search-clear{
  position:absolute;
  right:2.5rem;
  display:none;
  align-items:center;
  justify-content:center;
  width:1.5rem;
  height:1.5rem;
  color:#6b7280;
  background:transparent;
  border:none;
  border-radius:9999px;
  cursor:pointer;
  transition:all 0.15s ease;
}

.header-search input:not(:placeholder-shown) ~ .search-clear{
  display:flex;
}

.header-search .search-clear:hover{
  color:#f87171;
  background:rgba(248,113,113,0.1);
}

.header-search .search-btn{
  position:absolute;
  right:0.25rem;
  display:none;
  align-items:center;
  justify-content:center;
  width:2rem;
  height:2rem;
  color:#9ca3af;
  background:rgba(56,189,248,0.1);
  border:none;
  border-radius:9999px;
  cursor:pointer;
  transition:all 0.15s ease;
}

.header-search input:not(:placeholder-shown) ~ .search-btn{
  display:flex;
}

.header-search .search-btn:hover{
  color:#fff;
  background:rgba(56,189,248,0.2);
}

/* Quick Search Dropdown */
.header-search .quick-search-dropdown{
  position:absolute;
  top:100%;
  left:0;
  right:0;
  margin-top:0.5rem;
  background:linear-gradient(165deg, rgba(20,20,28,0.98) 0%, rgba(12,12,18,0.99) 100%);
  border:1px solid rgba(56,189,248,0.15);
  border-radius:0.75rem;
  box-shadow:0 20px 50px rgba(0,0,0,0.5), 0 0 1px rgba(56,189,248,0.3);
  backdrop-filter:blur(12px);
  overflow:hidden;
  z-index:160;
}

.header-search .quick-search-dropdown a{
  display:flex;
  align-items:center;
  gap:0.5rem;
  padding:0.5rem 0.75rem;
  color:#d1d5db;
  text-decoration:none;
  transition:background 0.15s ease;
}

.header-search .quick-search-dropdown a:hover{
  background:rgba(56,189,248,0.1);
  color:#fff;
}

.header-search .quick-search-dropdown img{
  width:2.5rem;
  height:2.5rem;
  object-fit:cover;
  border-radius:0.375rem;
}

.header-search .quick-search-dropdown .qs-section-label{
  padding:0.375rem 0.75rem;
  font-size:0.75rem;
  color:#6b7280;
  border-top:1px solid rgba(75,85,99,0.3);
}

.header-search .quick-search-dropdown .qs-search-all{
  display:block;
  padding:0.625rem 0.75rem;
  text-align:center;
  font-size:0.875rem;
  font-weight:500;
  color:#38bdf8;
  background:linear-gradient(180deg, rgba(56,189,248,0.08) 0%, rgba(56,189,248,0.04) 100%);
  border-top:1px solid rgba(56,189,248,0.15);
  transition:all 0.15s ease;
}

.header-search .quick-search-dropdown .qs-search-all:hover{
  color:#7dd3fc;
  background:linear-gradient(180deg, rgba(56,189,248,0.15) 0%, rgba(56,189,248,0.08) 100%);
}

/* ============================================================
   RIGHT: Icon Actions
   ============================================================ */

.header-right{
  display:flex;
  align-items:center;
  gap:0.5rem;
  justify-self:end;
}

/* Burger Menu (Mobile) */
.header-burger{
  display:flex;
  align-items:center;
  justify-content:center;
  width:2.5rem;
  height:2.5rem;
  color:#d1d5db;
  background:transparent;
  border:none;
  border-radius:0.5rem;
  cursor:pointer;
  transition:all 0.15s ease;
}

.header-burger:hover{
  color:#fff;
  background:rgba(255,255,255,0.05);
}

@media (min-width:768px){
  .header-burger{
    display:none;
  }
}

/* Desktop Icons */
.header-icons{
  display:none;
  align-items:center;
  gap:0.375rem;
}

@media (min-width:768px){
  .header-icons{
    display:flex;
  }
}

.header-icon{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width:2.25rem;
  height:2.25rem;
  color:#9ca3af;
  background:transparent;
  border:none;
  border-radius:0.5rem;
  text-decoration:none;
  cursor:pointer;
  transition:all 0.15s ease;
}

.header-icon:hover{
  color:#38bdf8;
  background:rgba(56,189,248,0.1);
}

.header-icon:focus{
  outline:2px solid rgba(192,132,252,0.5);
  outline-offset:2px;
}

.header-icon i{
  font-size:1.125rem;
}

/* Logout Icon - Red on hover */
.header-icon-logout:hover{
  color:#f87171;
  background:rgba(248,113,113,0.1);
}

/* User Avatar in Header */
.header-avatar{
  overflow:hidden;
  border-radius:9999px;
}

.header-avatar .avatar-img{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:9999px;
  box-shadow:0 0 0 2px rgba(255,255,255,0.12), 0 2px 8px rgba(0,0,0,0.3);
  transition:transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.header-avatar:hover .avatar-img{
  transform:scale(1.08);
  filter:brightness(1.1);
  box-shadow:0 0 0 2px rgba(56,189,248,0.4), 0 4px 12px rgba(0,0,0,0.4);
}

/* Notification Badge */
.header-badge{
  position:absolute;
  top:0.25rem;
  right:0.25rem;
  width:0.5rem;
  height:0.5rem;
  background:#a855f7;
  border-radius:9999px;
}

/* Logout Form */
.header-logout-form{
  display:flex;
  margin:0;
}

/* ============================================================
   AUTO-HIDE NAVIGATION
   ============================================================ */

@media (min-width:640px){
  [data-auto-hide-nav="1"] .site-header{
    position:fixed;
    top:0;
    left:0;
    right:0;
    width:100%;
  }

  .site-header.nav-hidden{
    transform:translateY(-100%);
  }
}

/* Mobile Sticky */
@media (max-width:639px){
  .site-header.mobile-sticky{
    position:fixed;
    top:0;
    left:0;
    right:0;
    width:100%;
  }
}

/* ============================================================
   MOBILE NAV OVERLAY
   ============================================================ */

#mobile-nav{
  height:100vh;
  overflow-y:auto;
  z-index:160;
}

/* Mobile Avatar */
.mobile-avatar-link{
  display:flex !important;
  align-items:center;
  gap:0.75rem;
}

.mobile-avatar-img{
  width:2rem;
  height:2rem;
  border-radius:9999px;
  object-fit:cover;
  box-shadow:0 0 0 2px rgba(255,255,255,0.12);
}

/* ============================================================
   PROFILE DROPDOWN - v1.0.0
   Sleek dropdown menu for profile/logout
   ============================================================ */

.profile-dropdown{
  position:relative;
}

.profile-dropdown-trigger{
  cursor:pointer;
  transition:all 0.2s ease;
}

.profile-dropdown-trigger[aria-expanded="true"]{
  transform:scale(1.05);
}

.profile-dropdown-trigger[aria-expanded="true"] .avatar-img{
  box-shadow:0 0 0 2px rgba(56,189,248,0.6), 0 0 16px rgba(56,189,248,0.3);
}

/* Dropdown Menu */
.profile-dropdown-menu{
  position:absolute;
  top:calc(100% + 0.75rem);
  right:0;
  min-width:220px;
  background:linear-gradient(
    165deg,
    rgba(20,20,28,0.97) 0%,
    rgba(12,12,18,0.98) 100%
  );
  border:1px solid rgba(56,189,248,0.15);
  border-radius:1rem;
  box-shadow:
    0 20px 50px rgba(0,0,0,0.5),
    0 0 1px rgba(56,189,248,0.3),
    inset 0 1px 0 rgba(255,255,255,0.05);
  backdrop-filter:blur(12px);
  opacity:0;
  visibility:hidden;
  transform:translateY(-10px) scale(0.95);
  transform-origin:top right;
  transition:all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index:200;
  overflow:hidden;
}

/* Arrow/Pointer */
.profile-dropdown-menu::before{
  content:'';
  position:absolute;
  top:-6px;
  right:12px;
  width:12px;
  height:12px;
  background:linear-gradient(135deg, #1e3a5f 0%, #0f2744 100%);
  border-left:1px solid rgba(56,189,248,0.4);
  border-top:1px solid rgba(56,189,248,0.4);
  transform:rotate(45deg);
  box-shadow:0 0 8px rgba(56,189,248,0.2);
}

/* Open State */
.profile-dropdown.open .profile-dropdown-menu{
  opacity:1;
  visibility:visible;
  transform:translateY(0) scale(1);
}

/* Dropdown Header */
.profile-dropdown-header{
  display:flex;
  align-items:center;
  gap:0.75rem;
  padding:1rem 1rem 0.875rem;
  background:linear-gradient(
    180deg,
    rgba(56,189,248,0.08) 0%,
    transparent 100%
  );
}

.profile-dropdown-avatar{
  width:2.5rem;
  height:2.5rem;
  border-radius:9999px;
  object-fit:cover;
  box-shadow:0 0 0 2px rgba(56,189,248,0.3);
}

.profile-dropdown-name{
  font-size:0.9375rem;
  font-weight:500;
  color:#e5e7eb;
  letter-spacing:0.01em;
  max-width:140px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

/* Divider */
.profile-dropdown-divider{
  height:1px;
  margin:0.5rem 0.75rem;
  background:linear-gradient(
    90deg,
    transparent 0%,
    rgba(75,85,99,0.4) 20%,
    rgba(75,85,99,0.4) 80%,
    transparent 100%
  );
}

/* Menu Items */
.profile-dropdown-item{
  display:flex;
  align-items:center;
  gap:0.75rem;
  width:100%;
  padding:0.75rem 1rem;
  font-size:0.875rem;
  color:#d1d5db;
  text-decoration:none;
  background:transparent;
  border:none;
  cursor:pointer;
  transition:all 0.15s ease;
  text-align:left;
}

.profile-dropdown-item i{
  width:1.25rem;
  text-align:center;
  font-size:1rem;
  color:#9ca3af;
  transition:color 0.15s ease, transform 0.15s ease;
}

.profile-dropdown-item:hover{
  background:rgba(56,189,248,0.1);
  color:#fff;
}

.profile-dropdown-item:hover i{
  color:#38bdf8;
  transform:translateX(2px);
}

.profile-dropdown-item:focus{
  outline:none;
  background:rgba(56,189,248,0.15);
}

/* Logout Item */
.profile-dropdown-logout{
  margin-top:0.25rem;
  margin-bottom:0.5rem;
  border-radius:0.5rem;
  margin-left:0.5rem;
  margin-right:0.5rem;
  width:calc(100% - 1rem);
}

.profile-dropdown-logout:hover{
  background:rgba(248,113,113,0.15);
  color:#fca5a5;
}

.profile-dropdown-logout:hover i{
  color:#f87171;
}

.profile-dropdown-logout-form{
  display:block;
}

/* Notification badge on avatar */
.profile-dropdown-badge{
  position:absolute;
  top:2px;
  right:2px;
  width:10px;
  height:10px;
  background:linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  border:2px solid rgba(10,10,15,0.9);
  border-radius:9999px;
  animation:badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse{
  0%, 100%{ transform:scale(1); box-shadow:0 0 0 0 rgba(168,85,247,0.4); }
  50%{ transform:scale(1.1); box-shadow:0 0 0 4px rgba(168,85,247,0); }
}

/* Unread count in dropdown */
.profile-dropdown-unread{
  margin-left:auto;
  padding:0.125rem 0.5rem;
  font-size:0.75rem;
  font-weight:600;
  color:#fff;
  background:linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
  border-radius:9999px;
  min-width:1.25rem;
  text-align:center;
}

/* Admin/Portal item */
.profile-dropdown-admin{
  color:#c4b5fd;
}

.profile-dropdown-admin i{
  color:#a78bfa;
}

.profile-dropdown-admin:hover{
  background:rgba(167,139,250,0.15);
  color:#e9d5ff;
}

.profile-dropdown-admin:hover i{
  color:#c4b5fd;
}

/* Subtle glow effect on open */
.profile-dropdown.open .profile-dropdown-trigger::after{
  content:'';
  position:absolute;
  inset:-4px;
  border-radius:9999px;
  background:radial-gradient(circle, rgba(56,189,248,0.2) 0%, transparent 70%);
  z-index:-1;
  animation:pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow{
  0%, 100%{ opacity:0.5; transform:scale(1); }
  50%{ opacity:1; transform:scale(1.1); }
}
