/* FreightEx.EU - Modern Navigation 2025 */
/* Extracted from ui.php and enhanced for mobile */

/* CSS Variables */
:root {
  --accent: #2563eb;
  --accent-hover: #1e4fd8;
  --danger: #e63946;
  --danger-hover: #d62839;
  --bg: #f5f6f8;
  --fg: #0b0f16;
  --card: #fff;
  --border: rgba(0,0,0,.08);
  --shadow: 0 8px 24px rgba(0,0,0,.08);
}

/* Base Styles */
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

body {
  padding-top: 70px; /* Space for fixed header */
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.section {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 14px;
  padding: 16px;
  margin-top: 16px;
}

/* Navigation Container */
.cover {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cover.scrolled {
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.08);
}

/* Navigation Bar */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 16px 8px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: 70px;
  gap: 20px;
}

/* Brand Section */
.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #0b0f16;
  font-weight: 700;
  transition: all 0.3s ease;
  z-index: 1001;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: -15px;
}

.brand:hover {
  transform: translateY(-1px);
}

.mark {
  width: 40px;
  height: 40px;
  margin-right: 12px;
  transition: transform 0.3s ease;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  font-size: 18px;
}

.brand:hover .mark {
  transform: rotate(5deg) scale(1.05);
}

.word {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.w1 { color: #0b0f16; }
.w2 { color: #2563eb; }
.wdot { color: #e63946; }
.w3 { color: #0b0f16; }

/* Desktop Menu Bar */
.desktop-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

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

/* Desktop specific styles */
@media (min-width: 769px) {
  .mobile-menu-toggle {
    display: none !important;
  }

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

  .desktop-menu {
    display: flex;
  }

  /* Hide language code on desktop, show only flag */
  .desktop-lang .lang-btn .code {
    display: none;
  }

  /* Hide mobile profile on desktop */
  .mobile-profile-top {
    display: none !important;
  }

  /* Desktop Profile button styling */
  .desktop-menu .pill[href*="profile"] {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    border: none !important;
  }

  .desktop-menu .pill[href*="profile"]:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3) !important;
  }

  .desktop-menu .pill[href*="profile"] .icon {
    color: white;
  }

  /* Desktop Profile dropdown */
  .desktop-profile {
    position: relative;
  }

  .desktop-profile .profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 8px;
    min-width: 160px;
    display: none;
    z-index: 1001;
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .desktop-profile .profile-menu.open {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  .desktop-profile .profile-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 12px;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: var(--fg);
  }

  .desktop-profile .profile-item:hover {
    background: rgba(16, 185, 129, 0.1);
  }
}

/* Navigation Pills */
.pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 50px;
  color: #1e40af;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(16, 185, 129, 0.05));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.pill:hover::before {
  opacity: 1;
}

.pill:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.15);
  color: #1e3a8a;
}

.pill.active {
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
}

.pill.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.pill .icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  transition: transform 0.3s ease;
}

.pill:hover .icon {
  transform: scale(1.1);
}

/* Auth Pills */
.pill.auth-pill {
  background: linear-gradient(135deg, #e63946, #d62828);
  color: white;
  border-color: transparent;
  font-weight: 700;
}

.pill.auth-pill:hover {
  background: linear-gradient(135deg, #d62828, #c53030);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(230, 57, 70, 0.3);
}

.pill.auth-pill.outline {
  background: transparent;
  color: #e63946;
  border-color: rgba(230, 57, 70, 0.3);
}

.pill.auth-pill.outline:hover {
  background: rgba(230, 57, 70, 0.08);
  border-color: rgba(230, 57, 70, 0.5);
}

/* Logout Button */
.logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #e63946, #d62828);
  border: 1px solid transparent;
  border-radius: 50px;
  color: white;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  white-space: nowrap;
}

.logout:hover {
  background: linear-gradient(135deg, #d62828, #c53030);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(230, 57, 70, 0.3);
}

.logout .icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

/* Language Dropdown */
.lang {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(107, 114, 128, 0.08);
  border: 1px solid rgba(107, 114, 128, 0.12);
  border-radius: 50px;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.lang-btn:hover {
  background: rgba(107, 114, 128, 0.12);
  border-color: rgba(107, 114, 128, 0.2);
  transform: translateY(-1px);
}

.lang-btn .flag {
  display: flex;
  align-items: center;
  margin-right: 4px;
}

.flag-icon {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
}

.lang-btn .flag img {
  border-radius: 2px;
  object-fit: cover;
}

.lang-btn .arrow {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.lang-btn.open .arrow {
  transform: rotate(180deg);
}

/* Language Menu */
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 8px;
  min-width: 180px;
  display: none;
  z-index: 1001;
  backdrop-filter: blur(20px);
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lang-menu.open {
  display: block;
  opacity: 1;
  transform: translateY(0) scale(1);
}



.lang-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  border-radius: 12px;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.lang-item:hover {
  background: rgba(37, 99, 235, 0.08);
  color: #1e40af;
}

.lang-item.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(16, 185, 129, 0.05));
  color: #1e40af;
  font-weight: 600;
}

.lang-item .flag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}

.lang-item .flag img {
  border-radius: 2px;
  object-fit: cover;
}

/* Language Grid */
.lang-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  border-radius: 12px;
  transition: all 0.3s ease;
  min-width: auto;
  font-size: 13px;
}

.mobile-menu-toggle:hover {
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mobile-menu-toggle span {
  width: 18px;
  height: 2px;
  background: #374151;
  border-radius: 1px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}

.mobile-menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* Desktop Language Dropdown */
.lang {
  position: relative;
  display: flex;
  align-items: center;
}

/* Hide mobile language dropdown on desktop */
.mobile-lang,
.mobile-lang-top {
  display: none;
}

/* Mobile Navigation */
@media (max-width: 768px) {
  body {
    padding-top: 72px; /* Smaller space for mobile header */
  }

  .bar {
    display: flex;
    padding: 12px 20px;
    min-height: 60px;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
  }

  /* Hide desktop language dropdown on mobile */
  .lang:not(.mobile-lang):not(.mobile-lang-top) {
    display: none;
  }

  /* Show mobile profile dropdown */
  .mobile-profile-top {
    display: block;
    order: 2;
  }

  /* Show mobile language dropdown in top bar */
  .mobile-lang-top {
    display: block;
    order: 3;
  }

  /* Hide hamburger menu language dropdown */
  .mobile-lang {
    display: none;
  }

  .brand {
    order: 1;
    flex-shrink: 0;
  }

  .mobile-menu-toggle {
    display: flex !important;
    order: 4;
    flex-shrink: 0;
    margin-left: auto;
  }

  /* Mobile language button styling */
  .mobile-lang-top {
    position: relative;
    flex-shrink: 0;
  }

  .mobile-lang-top .lang-btn {
    padding: 8px 12px;
    font-size: 13px;
    min-width: auto;
  }

  .mobile-lang-top .lang-btn .code {
    display: none; /* Hide text on very small screens */
  }

  /* Hide Profile text on mobile to save space */
  .mobile-profile-top .profile-pill span,
  .mobile-profile-top.profile-pill span {
    display: none;
  }

  /* Mobile language menu positioning */
  .mobile-lang-top .lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1002;
    min-width: 160px;
    background: white !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
  }

  .mobile-lang-top .lang-menu.open {
    opacity: 1 !important;
  }

  /* Mobile profile button styling */
  .mobile-profile-top {
    position: relative;
    flex-shrink: 0;
  }

  .mobile-profile-top .profile-pill,
  .mobile-profile-top.profile-pill {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: white !important;
    border: none !important;
    padding: 8px 12px;
    font-size: 13px;
    min-width: auto;
    text-decoration: none;
  }

  .mobile-profile-top .profile-pill:hover,
  .mobile-profile-top.profile-pill:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3) !important;
  }

  .mobile-profile-top .profile-pill .icon,
  .mobile-profile-top.profile-pill .icon {
    color: white;
  }

  /* Mobile profile dropdown menu */
  .mobile-profile-top .profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1002;
    min-width: 160px;
    background: white !important;
    backdrop-filter: none !important;
    opacity: 0;
    display: none;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 8px;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .mobile-profile-top .profile-menu.open {
    opacity: 1 !important;
    display: block;
    transform: translateY(0) scale(1);
  }

  .mobile-profile-top .profile-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 12px;
    transition: background-color 0.2s ease;
    font-size: 14px;
    color: var(--fg);
  }

  .mobile-profile-top .profile-item:hover {
    background: rgba(16, 185, 129, 0.1);
  }

  .brand {
    margin-left: 0;
  }

  .brand .word {
    font-size: 18px;
  }

  .mark {
    width: 32px;
    height: 32px;
    font-size: 14px;
    margin-right: 8px;
  }

  .desktop-menu {
    display: none !important;
  }

  .mobile-menu {
    display: flex;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    padding: 20px;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }

  .mobile-menu.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .pill {
    justify-content: center;
    padding: 16px 24px;
    font-size: 16px;
    border-radius: 12px;
  }

  .lang {
    order: 1;
    margin-left: auto;
  }

  .lang-btn {
    justify-content: center;
    padding: 16px 24px;
    font-size: 16px;
    border-radius: 12px;
  }

  .lang-menu {
    position: static;
    box-shadow: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 8px;
    background: rgba(248, 250, 252, 0.8);
  }
}

@media (max-width: 480px) {
  .bar {
    padding: 10px 16px;
    justify-content: space-between;
  }

  .brand {
    margin-left: 0;
  }

  .brand .word {
    font-size: 16px;
  }

  .mark {
    width: 28px;
    height: 28px;
    font-size: 12px;
    margin-right: 6px;
  }

  .pill {
    padding: 14px 20px;
    font-size: 15px;
  }

  .lang-btn {
    padding: 14px 20px;
    font-size: 15px;
  }

  /* Even smaller mobile language button */
  .mobile-lang-top .lang-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .mobile-lang-top .lang-btn .flag {
    margin-right: 0;
  }

  /* Even smaller mobile profile button */
  .mobile-profile-top .profile-pill,
  .mobile-profile-top.profile-pill {
    padding: 6px 10px !important;
    font-size: 12px !important;
  }

  .mobile-profile-top .profile-pill span,
  .mobile-profile-top.profile-pill span {
    display: none; /* Hide "Profile" text on very small screens */
  }
}

/* Smooth Scrolling Offset for Fixed Header */
html {
  scroll-padding-top: 80px;
}

@media (max-width: 768px) {
  html {
    scroll-padding-top: 70px;
  }
}

/* Navigation Accessibility */
.pill:focus,
.lang-btn:focus,
.lang-item:focus,
.mobile-menu-toggle:focus {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .cover {
    background: white;
    border-bottom: 2px solid #000;
  }
  
  .pill {
    border-width: 2px;
  }
  
  .lang-btn {
    border-width: 2px;
  }
}

/* Flag Icon Styles */
.flag-icon {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  display: inline-block;
  vertical-align: middle;
}

.lang-btn .flag-icon {
  margin-right: 6px;
}

.lang-item .flag-icon {
  margin-right: 8px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .pill,
  .lang-btn,
  .mobile-menu-toggle span,
  .brand,
  .mark {
    transition: none;
  }
  
  .lang-menu {
    animation: none;
  }
}

/* Print Styles */
@media print {
  .cover {
    position: static;
    background: white;
    box-shadow: none;
    border-bottom: 1px solid #000;
  }
  
  .mobile-menu-toggle {
    display: none;
  }
  
  .menu-bar {
    display: flex !important;
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
  }
}