/*
===============================================
  MODERN HEADER 2025 - STYLES
  Professional & Responsive Header Component
===============================================
*/

/* ============================================
   CSS CUSTOM PROPERTIES
   Uses colors from colors.css
   ============================================ */
:root {
  --header-height: 70px;
  --header-bg: linear-gradient(135deg, var(--header-bg-start), var(--header-bg-end));
  --header-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --header-z-index: 1000;

  /* Hover States */
  --header-hover-bg: rgba(255, 255, 255, 0.1);
  --header-active-bg: rgba(255, 255, 255, 0.15);

  /* Mobile Menu */
  --mobile-menu-width: 320px;

  /* Transitions */
  --transition-fast: 200ms ease;
  --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   HIDE OLD SIDEBAR (REPLACED BY NEW MOBILE MENU)
   ============================================ */
#sidebar,
.sidebar,
aside.sidebar {
  display: none !important;
}

.sidebar-overlay {
  display: none !important;
}

/* ============================================
   HEADER BASE
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--header-bg);
  box-shadow: var(--header-shadow);
  z-index: var(--header-z-index);
}

.header.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* Header Container */
.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 32px;
}

/* ============================================
   LEFT SECTION - BRAND/LOGO
   ============================================ */
.header-left {
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.header-brand:hover {
  opacity: 0.95;
}

.brand-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--header-link);
  line-height: 1.2;
  letter-spacing: 0.3px;
}

.brand-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.2;
  letter-spacing: 0.2px;
}

/* ============================================
   CENTER SECTION - NAVIGATION
   ============================================ */
.header-nav {
  flex: 1;
  display: none;
}

.nav-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--header-link);
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
}

.nav-link i {
  font-size: 18px;
}

.nav-link:hover {
  background: var(--header-hover-bg);
  color: var(--header-link-hover);
}

.nav-link:active,
.nav-link.active {
  background: var(--header-active-bg);
  color: var(--header-link);
}

/* ============================================
   RIGHT SECTION - ACTIONS
   ============================================ */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* User Info */
.user-info {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--header-link);
  font-size: 14px;
}

.user-info i {
  font-size: 20px;
}

.user-name,
.user-email {
  font-weight: 500;
  color: var(--header-link);
}

/* Language Switcher */
.header-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--header-link);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  white-space: nowrap;
}

.header-action-btn i {
  font-size: 18px;
}

.header-action-btn:hover {
  background: var(--header-hover-bg);
  color: var(--header-link-hover);
}

.header-action-btn .btn-text {
  display: none;
  color: inherit;
}

/* Auth Actions */
.auth-actions {
  display: none;
  align-items: center;
  gap: 8px;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
}

.header-btn i {
  font-size: 16px;
}

.header-btn.btn-outline {
  color: var(--header-text);
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
}

.header-btn.btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--header-text);
}

.header-btn.btn-solid {
  color: #4b58a0;
  background: var(--header-text);
  border: 1.5px solid var(--header-text);
}

.header-btn.btn-solid:hover {
  background: rgba(255, 255, 255, 0.95);
  
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ============================================
   MOBILE MENU TOGGLE
   ============================================ */
.mobile-menu-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: none;
  cursor: pointer;
  gap: 6px;
  position: relative;
  z-index: 1001;
}

.hamburger-line {
  width: 24px;
  height: 2px;
  background: var(--header-text);
  border-radius: 2px;
  transform-origin: center;
}

/* Hamburger Animation */
.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ============================================
   MOBILE MENU OVERLAY
   ============================================ */
.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--mobile-overlay-bg);
  opacity: 0;
  visibility: hidden;
  z-index: 999;
  backdrop-filter: blur(2px);
}

.mobile-menu-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   MOBILE MENU DRAWER
   ============================================ */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: var(--mobile-menu-width);
  max-width: 90vw;
  height: 100vh;
  background: var(--mobile-menu-bg);
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.mobile-menu.active {
  right: 0;
}

/* Mobile Menu Header */
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-brand .brand-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-brand .brand-icon img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.2)) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.12));
}

.mobile-brand .brand-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--mobile-menu-text);
}

.mobile-menu-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.mobile-menu-close i {
  font-size: 18px;
  color: var(--mobile-menu-text);
}

.mobile-menu-close:hover {
  background: #e2e8f0;
}

/* Mobile Menu Body */
.mobile-menu-body {
  flex: 1;
  padding: 24px 20px;
  overflow-y: auto;
}

/* Mobile User Info */
.mobile-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  margin-bottom: 20px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.mobile-user-info i {
  font-size: 28px;
  color: #4b58a0;
  flex-shrink: 0;
}

.mobile-user-info .user-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.mobile-user-info .user-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--mobile-menu-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-user-info .user-email {
  font-size: 13px;
  font-weight: 400;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Mobile Navigation List */
.mobile-nav-list {
  list-style: none;
  margin: 0 0 24px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--mobile-menu-text);
  text-decoration: none;
  border-radius: 10px;
}

.mobile-nav-link i {
  font-size: 20px;
  color: #64748b;
  width: 24px;
  flex-shrink: 0;
}

.mobile-nav-link:hover {
  background: #f1f5f9;
  color: #4b58a0;
}

.mobile-nav-link:hover i {
  color: #4b58a0;
}

.mobile-nav-link:active {
  background: #e2e8f0;
}

/* Mobile Auth Actions */
.mobile-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.mobile-auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
}

.mobile-auth-btn i {
  font-size: 18px;
}

.mobile-auth-btn.btn-outline {
  color: #4b58a0;
  background: transparent;
  border: 2px solid #4b58a0;
}

.mobile-auth-btn.btn-outline:hover {
  background: #4b58a0;
  color: #ffffff;
}

.mobile-auth-btn.btn-solid {
  color: #ffffff;
  background: #4b58a0;
  border: 2px solid #4b58a0;
}

.mobile-auth-btn.btn-solid:hover {
  background: #3a4580;
  border-color: #3a4580;
}

/* ============================================
   DESKTOP BREAKPOINT (1024px+)
   ============================================ */
@media (min-width: 1024px) {
  .header-container {
    padding: 0 32px;
  }

  /* Show desktop navigation */
  .header-nav {
    display: block;
  }

  /* Show desktop user info */
  .user-info {
    display: flex;
  }

  /* Show language text */
  .header-action-btn .btn-text {
    display: inline;
  }

  /* Show auth buttons */
  .auth-actions {
    display: flex;
  }

  /* Hide mobile toggle */
  .mobile-menu-toggle {
    display: none;
  }
}

/* ============================================
   TABLET BREAKPOINT (768px - 1023px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1023px) {
  .header-container {
    padding: 0 20px;
  }

  .brand-text {
    display: flex;
  }

  .header-action-btn .btn-text {
    display: inline;
  }
}

/* ============================================
   MOBILE BREAKPOINT (< 768px)
   ============================================ */
@media (max-width: 767px) {
  :root {
    --header-height: 60px;
  }

  .header-container {
    padding: 0 16px;
    gap: 16px;
  }

  .brand-icon {
    width: 40px;
    height: 40px;
  }

  .brand-icon img {
    width: 40px;
    height: 40px;
  }

  .brand-text {
    display: none;
  }

  .header-right {
    gap: 8px;
  }

  .header-action-btn {
    padding: 8px;
  }

  .header-action-btn .btn-text {
    display: none;
  }
}

/* ============================================
   RTL (RIGHT-TO-LEFT) SUPPORT
   ============================================ */
[dir="rtl"] .mobile-menu {
  right: auto;
  left: -100%;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

[dir="rtl"] .mobile-menu.active {
  right: auto;
  left: 0;
}

[dir="rtl"] .header-brand,
[dir="rtl"] .mobile-brand {
  flex-direction: row-reverse;
}

[dir="rtl"] .brand-text,
[dir="rtl"] .mobile-brand .brand-text {
  text-align: right;
}

[dir="rtl"] .nav-link,
[dir="rtl"] .mobile-nav-link,
[dir="rtl"] .header-action-btn,
[dir="rtl"] .header-btn,
[dir="rtl"] .mobile-auth-btn {
  flex-direction: row-reverse;
}

[dir="rtl"] .user-info,
[dir="rtl"] .mobile-user-info {
  flex-direction: row-reverse;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.header *:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
  border-radius: 4px;
}

.mobile-menu *:focus-visible {
  outline: 2px solid #4b58a0;
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  .header {
    position: relative;
    box-shadow: none;
  }

  .mobile-menu-toggle,
  .mobile-menu,
  .mobile-menu-overlay {
    display: none !important;
  }
}

/* ============================================
   UTILITY ANIMATIONS
   ============================================ */

  to {
    transform: translateX(0);
  }
}


  to {
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
