/**
 * Corvanta - Modern Responsive Navbar
 * Fully responsive navigation with mobile menu, account dropdown
 * and optimized for all device sizes
 */

/* ============================================
   Variables & Base Styles
   ============================================ */
:root {
  --navbar-height: 70px;
  --navbar-bg: #ffffff;
  --navbar-border: #e5e7eb;
  --navbar-text: #1f2937;
  --navbar-text-hover: #2563eb;
  --navbar-mobile-bg: #ffffff;
  --navbar-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  --navbar-z-index: 1000;
  --navbar-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Header & Container
   ============================================ */
header {
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--navbar-border);
  position: sticky;
  top: 0;
  z-index: var(--navbar-z-index);
  box-shadow: var(--navbar-shadow);
  transition: var(--navbar-transition);
}

header.scrolled {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Navbar Structure
   ============================================ */
.navbar {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: var(--navbar-height);
  position: relative;
}

@media (min-width: 1400px) {
  .navbar {
    max-width: 1600px;
  }
}

@media (min-width: 1920px) {
  .navbar {
    max-width: 1800px;
  }
}

/* ============================================
   Logo
   ============================================ */
.navbar-logo {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--navbar-text-hover);
  text-decoration: none;
  transition: var(--navbar-transition);
  z-index: 1001;
  letter-spacing: -0.5px;
}

.navbar-logo:hover {
  opacity: 0.8;
  transform: scale(1.02);
}

.navbar-logo span {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   Mobile Menu Toggle
   ============================================ */
.navbar-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  position: relative;
}

.navbar-toggle span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--navbar-text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.navbar-toggle.active span:nth-child(1) {
  transform: translateY(9.5px) rotate(45deg);
}

.navbar-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-20px);
}

.navbar-toggle.active span:nth-child(3) {
  transform: translateY(-9.5px) rotate(-45deg);
}

/* ============================================
   Navigation Menu
   ============================================ */
.navbar-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.navbar-menu a {
  color: var(--navbar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  padding: 8px 4px;
  position: relative;
  transition: var(--navbar-transition);
  white-space: nowrap;
}

.navbar-menu a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  transition: width 0.3s ease;
}

.navbar-menu a:hover,
.navbar-menu a.active {
  color: var(--navbar-text-hover);
}

.navbar-menu a:hover::after,
.navbar-menu a.active::after {
  width: 100%;
}

/* ============================================
   Navbar Actions
   ============================================ */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ============================================
   Buttons
   ============================================ */
.btn-login {
  color: var(--navbar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  padding: 10px 20px;
  border-radius: 8px;
  transition: var(--navbar-transition);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.btn-login:hover {
  background: #f3f4f6;
  color: var(--navbar-text-hover);
}

.cta-btn,
.btn-dashboard {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--navbar-transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.cta-btn:hover,
.btn-dashboard:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.cta-btn:active,
.btn-dashboard:active {
  transform: translateY(0);
}

.btn-logout {
  color: #dc2626;
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  padding: 10px 20px;
  border: 2px solid #dc2626;
  border-radius: 8px;
  transition: var(--navbar-transition);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.btn-logout:hover {
  background: #dc2626;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}

/* ============================================
   Account Menu
   ============================================ */
.account-menu {
  position: relative;
  display: inline-block;
}

.account-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--navbar-transition);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  white-space: nowrap;
  position: relative;
}

/* Notification counter badge on account button */
.account-toggle .notification-counter {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #dc3545;
  border-radius: 10px;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.4);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.account-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.account-toggle:active {
  transform: translateY(0);
}

.account-toggle .user-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.account-toggle .chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.account-menu.open .account-toggle .chevron {
  transform: rotate(180deg);
}

.account-name {
  font-size: 14px;
  font-weight: 600;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   Account Dropdown
   ============================================ */
.account-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 280px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1002;
  overflow: hidden;
}

.account-menu.open .account-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.account-header {
  padding: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.account-info strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.account-email,
.account-company {
  display: block;
  font-size: 13px;
  opacity: 0.95;
  margin-top: 3px;
  word-break: break-word;
}

.account-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 8px 0;
}

.account-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: #1f2937;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
}

.account-item:hover {
  background: #f3f4f6;
  color: #667eea;
}

.account-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.notification-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #dc2626;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  margin-left: auto;
  line-height: 1;
}

.logout-item {
  color: #dc2626;
}

.logout-item:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ============================================
   Responsive Design - Tablet
   ============================================ */
@media (max-width: 1024px) {
  .navbar {
    padding: 0 1.5rem;
  }

  .navbar-menu {
    gap: 1.5rem;
  }

  .navbar-menu a {
    font-size: 14px;
  }

  .btn-login,
  .cta-btn,
  .btn-dashboard,
  .btn-logout {
    font-size: 14px;
    padding: 8px 16px;
  }
}

/* ============================================
   Responsive Design - Mobile
   ============================================ */
@media (max-width: 768px) {
  :root {
    --navbar-height: 60px;
  }

  .navbar {
    padding: 0 1rem;
  }

  /* Reorder navbar items on mobile */
  .navbar-logo {
    order: 1;
  }

  .navbar-actions {
    order: 2;
  }

  .navbar-toggle {
    order: 3;
    margin-left: 0.75rem;
  }

  /* Show mobile toggle */
  .navbar-toggle {
    display: flex;
  }

  /* Mobile Menu */
  .navbar-menu {
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--navbar-height));
    background: var(--navbar-mobile-bg);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 1rem 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
  }

  .navbar-menu.active {
    transform: translateX(0);
  }

  .navbar-menu a {
    width: 100%;
    padding: 16px 1.5rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 16px;
    display: flex;
    align-items: center;
  }

  .navbar-menu a::after {
    display: none;
  }

  .navbar-menu a:hover,
  .navbar-menu a.active {
    background: #f9fafb;
    color: var(--navbar-text-hover);
  }

  /* Mobile Actions - Keep visible */
  .navbar-actions {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    margin-left: auto;
  }

  /* Mobile button styling */
  .btn-login,
  .cta-btn,
  .btn-dashboard,
  .btn-logout {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
  }

  .cta-btn {
    padding: 8px 16px;
  }

  /* Account Menu Mobile */
  .account-toggle {
    padding: 8px 12px;
    font-size: 13px;
  }

  .account-name {
    display: none;
  }

  .account-toggle .chevron {
    margin-left: 0;
  }

  .account-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    bottom: auto;
    left: auto;
    right: 0;
    width: 280px;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - var(--navbar-height) - 3rem);
    border-radius: 12px;
    transform: translateY(-10px);
    overflow-y: auto;
  }

  .account-menu.open .account-dropdown {
    transform: translateY(0);
  }

  .account-dropdown::before {
    display: none;
  }

  /* Overlay when mobile menu is open */
  body.nav-open {
    overflow: hidden;
  }

  body.nav-open::before {
    content: '';
    position: fixed;
    top: var(--navbar-height);
    left: 0;
    width: 100%;
    height: calc(100vh - var(--navbar-height));
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: fadeIn 0.3s ease;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
}

/* ============================================
   Responsive Design - Small Mobile
   ============================================ */
@media (max-width: 480px) {
  .navbar-logo {
    font-size: 1.25rem;
  }

  .navbar-toggle {
    width: 24px;
    height: 18px;
  }

  .navbar-toggle span {
    height: 2px;
  }

  .navbar-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .navbar-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .account-dropdown {
    width: 260px;
    max-width: calc(100vw - 1rem);
    right: 0.5rem;
  }
}

/* ============================================
   Accessibility
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard navigation */
.navbar-menu a:focus-visible,
.btn-login:focus-visible,
.cta-btn:focus-visible,
.btn-dashboard:focus-visible,
.btn-logout:focus-visible,
.account-toggle:focus-visible,
.navbar-toggle:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  header {
    position: relative;
    box-shadow: none;
  }

  .navbar-toggle,
  .navbar-actions {
    display: none;
  }
}
