/* ============================================================
   TRADEHUB B2B — LAYOUT
   ============================================================ */

/* ── NAVBAR ── */
#navbar {
  position: sticky;
  top: 0;
  z-index: 800;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,251,253,0.96));
  border-bottom: 1px solid rgba(28, 109, 156, 0.10);
  height: var(--nav-height);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 32px rgba(8, 58, 92, 0.06);
}

body.mobile-menu-open {
  overflow: hidden;
}

.nav-inner {
  display: flex;
  align-items: center;
  height: var(--nav-height);
  gap: 8px;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0;
  line-height: 1;
  margin-right: auto;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 10px 14px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,251,253,0.92));
  border: 1px solid rgba(79, 163, 199, 0.16);
  box-shadow:
    0 12px 28px rgba(8, 58, 92, 0.06),
    inset 0 1px 0 rgba(255,255,255,0.88);
}

.nav-logo-image-lockup {
  height: 62px;
  width: auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(8, 58, 92, 0.08));
}

.nav-logo-wordmark {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.06em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--green) 100%);
}

.brand-logo-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand-logo-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.nav-logo-icon {
  font-size: 16px;
}

/* Nav Links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -14px;
  right: -20px;
  bottom: -18px;
  left: -20px;
}

.nav-link {
  position: relative;
  color: var(--text-muted);
  padding: 7px 13px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 4px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green) 0%, var(--primary) 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.nav-link:hover {
  color: var(--primary-dark);
  background: rgba(249, 115, 22, 0.08);
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: scaleX(1);
}

.nav-link.active {
  color: var(--green-dark);
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.12), rgba(255, 169, 77, 0.10));
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-dropdown-arrow {
  color: var(--primary);
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 244px;
  padding: 12px;
  border-radius: 22px;
  border: 1px solid rgba(79, 163, 199, 0.22);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.99), rgba(247,250,252,0.98));
  box-shadow:
    0 24px 48px rgba(8, 58, 92, 0.16),
    0 10px 24px rgba(8, 58, 92, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity var(--transition-fast),
    transform var(--transition-fast),
    visibility var(--transition-fast);
}

.nav-dropdown-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 28px;
  width: 16px;
  height: 16px;
  background: inherit;
  border-top: 1px solid rgba(79, 163, 199, 0.22);
  border-left: 1px solid rgba(79, 163, 199, 0.22);
  transform: rotate(45deg);
}

.nav-dropdown-menu::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -16px;
  height: 16px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.is-open .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-dropdown:hover .nav-dropdown-arrow,
.nav-dropdown.is-open .nav-dropdown-arrow,
.nav-dropdown:focus-within .nav-dropdown-arrow {
  color: var(--green-dark);
  transform: rotate(180deg);
}

.nav-dropdown-label {
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(10, 74, 117, 0.96), rgba(28, 109, 156, 0.92));
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 14px;
  border-radius: 16px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
  border: 1px solid transparent;
}

.nav-dropdown-item + .nav-dropdown-item {
  margin-top: 4px;
}

.nav-dropdown-item svg {
  color: var(--primary);
  flex-shrink: 0;
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.nav-dropdown-item:hover,
.nav-dropdown-item:focus-visible {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.08), rgba(79, 163, 199, 0.08));
  border-color: rgba(249, 115, 22, 0.22);
  color: var(--green-dark);
  transform: translateX(3px);
}

.nav-dropdown-item:hover svg,
.nav-dropdown-item:focus-visible svg {
  color: var(--green-dark);
  transform: translateX(3px);
}

/* Nav Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-search-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--white);
  border: 1px solid var(--gray-200);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-search-btn:hover {
  background: rgba(249, 115, 22, 0.10);
  color: var(--green-dark);
  transform: var(--hover-lift);
  box-shadow: var(--shadow-sm);
}

.nav-cart-btn {
  position: relative;
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,251,253,0.96));
  border: 1px solid rgba(79, 163, 199, 0.18);
  border-radius: var(--radius);
  padding: 8px 14px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
}

.nav-cart-btn:hover {
  background: linear-gradient(135deg, rgba(255,255,255,1), rgba(255, 241, 230, 0.82));
  border-color: rgba(249, 115, 22, 0.32);
  transform: var(--hover-lift);
  box-shadow: var(--shadow-sm);
}

.cart-badge {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-light) 100%);
  color: var(--white);
  border-radius: var(--radius-full);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  transition: transform 0.15s ease;
}

.cart-badge.bump { animation: cartBump 0.25s ease; }
@keyframes cartBump { 50% { transform: scale(1.4); } }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--green) 100%);
  color: var(--white);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-user-name {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 6px;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: all 0.25s ease;
}

.nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* Mobile Menu */
.mobile-menu {
  background: var(--white);
  border-top: 1px solid rgba(28, 109, 156, 0.10);
  padding: 8px 0;
  animation: mobileMenuIn 0.2s ease;
  max-height: calc(100vh - var(--nav-offset, var(--nav-height)));
  overflow-y: auto;
}

@keyframes mobileMenuIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mobile-nav-link {
  display: block;
  padding: 14px 24px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.mobile-nav-link:hover {
  background: var(--gray-100);
  color: var(--text);
}

.mobile-nav-group {
  padding: 4px 18px 10px;
}

.mobile-nav-link-strong {
  padding: 14px 6px 10px;
  color: var(--text);
}

.mobile-subnav-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding-top: 2px;
}

.mobile-subnav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(79, 163, 199, 0.20);
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(248,251,253,0.94));
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all var(--transition-fast);
}

.mobile-subnav-link:hover,
.mobile-subnav-link:focus-visible {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.10), rgba(255, 169, 77, 0.12));
  border-color: rgba(249, 115, 22, 0.28);
  color: var(--green-dark);
  transform: var(--hover-lift);
}

.mobile-nav-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 8px 0;
}

/* ── FOOTER ── */
#footer {
  background: var(--white);
  color: var(--text);
  padding: 64px 0 28px;
  margin-top: auto;
  border-top: 1px solid var(--gray-200);
}

.footer-info-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.footer-info-card {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}

.footer-info-card:hover {
  transform: var(--hover-lift);
  border-color: rgba(59, 130, 246, 0.28);
  box-shadow: var(--shadow-md);
}

.footer-info-kicker {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.footer-info-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 16px;
}

.footer-info-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
  margin-top: 14px;
  margin-bottom: 16px;
}

.footer-contact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-col h4 {
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-500);
  margin-bottom: 16px;
}

.footer-col a {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 10px;
  transition: color var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
}

.footer-col a:hover { color: var(--primary); }

.footer-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.footer-bottom {
  border-top: 1px solid var(--gray-200);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom p {
  color: var(--gray-500);
  font-size: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--gray-500);
  font-size: 12px;
  cursor: pointer;
  transition: color var(--transition-fast);
  text-decoration: none;
}

.footer-links a:hover { color: var(--primary); }

/* Footer Logo */
.footer-logo { margin-bottom: 0; }
.footer-logo-image {
  height: 64px;
}

.footer-logo {
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.footer-wordmark {
  font-size: 40px;
  line-height: 1;
}

.loading-brand-mark {
    width: 240px;
    height: 74px;
    border-radius: 14px;
    margin: 0 auto 12px;
}

.loading-brand-mark .brand-logo-fallback {
  font-size: 19px;
}

/* ── DASHBOARD LAYOUT ── */
.dashboard-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 32px;
  align-items: start;
}

.dash-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 20px);
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-sm);
}

.dash-nav-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-400);
  padding: 8px 12px 4px;
  margin-top: 4px;
}

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--gray-600);
  margin-bottom: 1px;
  text-decoration: none;
}

.dash-nav-item:hover {
  background: var(--gray-100);
  color: var(--text);
}

.dash-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}

.dash-nav-item .nav-icon {
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.dash-nav-item.danger { color: #EF4444; }
.dash-nav-item.danger:hover { background: var(--error-bg); }

/* ── PRODUCT LAYOUT ── */
.products-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
}

.filter-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 20px);
  height: fit-content;
}

.filter-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray-500);
  margin-bottom: 10px;
  padding: 0 4px;
}

.filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 1px;
  color: var(--text);
}

.filter-item:hover { background: var(--gray-100); }

.filter-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}

.filter-count {
  font-size: 11px;
  background: var(--gray-200);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--gray-500);
}

.filter-item.active .filter-count {
  background: rgba(37,99,235,0.14);
  color: var(--primary-dark);
}

.filter-divider { height: 1px; background: var(--gray-200); margin: 12px 0; }

/* Products Grid */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

/* Cart Layout */
.cart-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
}

/* Auth Layout */
.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - var(--nav-height));
}

.auth-panel { padding: 52px 48px; }

.auth-left {
  background:
    radial-gradient(circle at top right, rgba(37,99,235,0.18), transparent 35%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-right-inner {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}

/* Contract Layout */
.contract-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 40px;
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .footer-info-panel { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 900px) {
  .nav-links       { display: none; }
  .nav-hamburger   { display: flex; }
  #navbar          { height: auto; min-height: var(--nav-height); }
  .nav-inner       { height: auto; min-height: var(--nav-height); padding-top: 8px; padding-bottom: 8px; flex-wrap: wrap; }
  .nav-logo        { min-width: 0; font-size: 22px; }
  .nav-actions     { margin-left: auto; }
  .nav-search-btn,
  .nav-cart-btn,
  .nav-hamburger   { min-height: 42px; }
  .nav-user-name   { max-width: 108px; }
  .mobile-menu     { padding-bottom: 20px; }

  .products-layout { grid-template-columns: 1fr; }
  .filter-sidebar  { position: static; }
  .filter-sidebar  { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
  .filter-title, .filter-divider { display: none; }

  .dashboard-layout { grid-template-columns: 1fr; }
  .dash-sidebar { position: static; display: flex; gap: 4px; flex-wrap: wrap; padding: 8px; }
  .dash-nav-section { display: none; }
  .dash-nav-item { padding: 8px 12px; font-size: 13px; }

  .cart-layout { grid-template-columns: 1fr; }
  .contract-layout { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: 1fr; }
  .auth-left { display: none; }
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .section { padding: 48px 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .nav-user-name { display: none; }
}

@media (max-width: 640px) {
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .auth-panel { padding: 32px 24px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .nav-actions { gap: 6px; }
  .nav-logo { gap: 0; padding: 8px 12px; }
  .nav-logo-image-lockup { height: 52px; }
  .brand-mark { width: 30px; height: 30px; }
  .nav-search-btn,
  .nav-hamburger { width: 42px; height: 42px; }
  .nav-cart-btn {
    padding: 8px 10px;
    min-width: 42px;
    justify-content: center;
  }
  .nav-cart-btn svg + .cart-badge {
    margin-left: -2px;
  }
  .mobile-nav-link { padding-left: 20px; padding-right: 20px; }
  .mobile-nav-group { padding-left: 14px; padding-right: 14px; }
  .mobile-subnav-links { grid-template-columns: 1fr; }
  #nav-auth-btns .btn-ghost { display: none; }
  #nav-auth-btns .btn-sm {
    padding-left: 14px;
    padding-right: 14px;
  }
}

@media (max-width: 480px) {
  .nav-inner { gap: 10px; }
  .nav-logo { padding: 7px 10px; border-radius: 18px; }
  .nav-logo-image-lockup { height: 46px; }
  #nav-auth-btns .btn-sm {
    min-height: 42px;
    font-size: 13px;
  }
}
