/* ==========================================================================
   ALM.care Components CSS
   Header Navbar, Bottom Navigation, Listing Cards, Modals & Footer
   ========================================================================== */

/* Header Navbar */
.alm-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(8, 11, 17, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(229, 169, 60, 0.18);
  z-index: 100;
  display: flex;
  align-items: center;
}

.alm-nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
}

/* Brand Logo */
.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  border-radius: 4px;
  object-fit: contain;
}

.brand-text-block {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.1;
}

.brand-slogan {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-light);
  opacity: 0.88;
}

/* Location Selector */
.location-selector {
  position: relative;
}

.location-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.location-btn:hover {
  border-color: var(--border-gold);
  color: var(--gold-bright);
}
.location-btn i.fa-location-dot {
  color: var(--gold-primary);
}

.location-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 260px;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 10px;
  display: none;
  z-index: 200;
}
.location-dropdown.show {
  display: block;
}

.location-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background var(--transition-fast);
}
.location-item:hover {
  background: var(--bg-surface-hover);
  color: var(--gold-bright);
}
.location-item.active {
  background: var(--gold-surface);
  color: var(--gold-bright);
  font-weight: 700;
}

/* Nav Global Search */
.nav-search-form {
  flex: 1;
  max-width: 480px;
  position: relative;
  display: flex;
  align-items: center;
}

.nav-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  padding: 9px 44px 9px 18px;
  color: var(--text-primary);
  font-size: 0.92rem;
  transition: all var(--transition-fast);
}
.nav-search-input:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 16px rgba(229, 169, 60, 0.2);
  background: var(--bg-surface-elevated);
}

.nav-search-btn {
  position: absolute;
  right: 6px;
  background: var(--gold-gradient);
  border: none;
  border-radius: var(--radius-full);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #080B11;
  cursor: pointer;
  font-size: 0.85rem;
  transition: transform var(--transition-fast);
}
.nav-search-btn:hover {
  transform: scale(1.08);
}

/* Nav Actions Right */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 1.05rem;
  transition: all var(--transition-fast);
}
.nav-icon-link:hover {
  color: var(--gold-bright);
  border-color: var(--border-gold);
  background: var(--bg-surface-hover);
}

.nav-badge-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--gold-primary);
  color: #080B11;
  font-size: 0.68rem;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 8px rgba(229, 169, 60, 0.6);
}

/* User Account Trigger */
.user-menu-wrapper {
  position: relative;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 14px 4px 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.user-menu-btn:hover {
  border-color: var(--border-gold);
}

.user-avatar-mini {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 1.5px solid var(--gold-primary);
}

.user-menu-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 250px;
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - var(--header-height) - var(--bottom-nav-height) - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), var(--shadow-gold);
  padding: 8px;
  display: none;
  z-index: 1100;
}
.user-dropdown.show {
  display: block;
}

.user-dropdown::-webkit-scrollbar {
  width: 5px;
}
.user-dropdown::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-full);
}
.user-dropdown::-webkit-scrollbar-thumb {
  background: var(--border-gold);
  border-radius: var(--radius-full);
}
.user-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--gold-primary);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.user-dropdown-item:hover {
  background: var(--bg-surface-hover);
  color: var(--gold-bright);
}
.user-dropdown-item i {
  width: 18px;
  color: var(--gold-primary);
}

.user-dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

/* Mobile Bottom Navigation Bar */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(11, 15, 23, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(229, 169, 60, 0.25);
  display: none;
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
}

@media (max-width: 768px) {
  .alm-header {
    height: 62px;
  }

  .alm-nav-container {
    padding-left: 12px;
    padding-right: 12px;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .brand-link {
    gap: 8px;
    flex-shrink: 0;
    min-width: 0;
  }

  .brand-logo-img {
    height: 38px;
    width: auto;
    flex-shrink: 0;
  }

  .brand-name {
    font-size: 1.15rem;
    line-height: 1;
  }

  .brand-slogan {
    font-size: 0.58rem;
    letter-spacing: 0.08em;
    white-space: nowrap;
  }

  /* CRITICAL: Hide duplicate Post an Ad button on mobile (bottom nav has the dedicated floating Sell button) */
  #btn-post-ad-header,
  .btn-header-post-ad {
    display: none !important;
  }

  /* In auth buttons, hide Create Account button to fit header cleanly on mobile */
  #nav-btn-signup,
  .btn-header-signup {
    display: none !important;
  }

  #nav-btn-login {
    padding: 6px 12px !important;
    font-size: 0.82rem !important;
    white-space: nowrap;
    border-radius: var(--radius-full);
  }

  /* User menu trigger on mobile */
  .user-menu-btn {
    padding: 3px 8px 3px 3px;
    gap: 6px;
  }
  .user-menu-name {
    font-size: 0.8rem;
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* User dropdown scrollable on mobile */
  .user-dropdown {
    position: fixed;
    top: 66px;
    right: 10px;
    width: 255px;
    max-width: calc(100vw - 20px);
    max-height: calc(100vh - 66px - var(--bottom-nav-height) - 18px - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    z-index: 1100;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(229, 169, 60, 0.25);
  }

  #nav-btn-logout {
    border-top: 1px solid rgba(239, 68, 68, 0.2) !important;
    margin-top: 4px;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  /* Bottom nav enhancements */
  .bottom-nav {
    display: flex;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 1000;
    box-sizing: border-box;
  }

  .nav-search-form {
    display: none;
  }
  .location-selector {
    display: none;
  }
  .nav-actions .nav-icon-link {
    display: none;
  }
}

@media (max-width: 480px) {
  .brand-slogan {
    display: none; /* Hide tagline on narrow phones so brand logo and name fit with zero collision */
  }
  .brand-name {
    font-size: 1.05rem;
  }
  .brand-logo-img {
    height: 34px;
  }
}


.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  position: relative;
  transition: color var(--transition-fast);
}
.bottom-nav-item i {
  font-size: 1.15rem;
}
.bottom-nav-item.active {
  color: var(--gold-bright);
}

.bottom-nav-sell-btn {
  background: var(--gold-gradient);
  color: #080B11 !important;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-top: -18px;
  box-shadow: 0 4px 15px rgba(229, 169, 60, 0.5);
  border: 2px solid #080B11;
}

/* Listing Card (Grid & List View) */
.listing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all var(--transition-normal);
  text-decoration: none;
  color: inherit;
}
.listing-card:hover {
  transform: translateY(-4px);
  border-color: rgba(229, 169, 60, 0.45);
  box-shadow: var(--shadow-gold);
}
.listing-card.featured-card {
  border: 1.5px solid var(--gold-primary);
  background: linear-gradient(180deg, rgba(229, 169, 60, 0.05) 0%, var(--bg-surface) 100%);
}

.listing-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0D131F;
}

.listing-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.listing-card:hover .listing-card-img {
  transform: scale(1.05);
}

.card-badges-top {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  z-index: 2;
}

.btn-fav-card {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: rgba(8, 11, 17, 0.7);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: all var(--transition-fast);
}
.btn-fav-card:hover, .btn-fav-card.active {
  background: rgba(239, 68, 68, 0.9);
  color: #FFF;
  border-color: var(--urgent-red);
  transform: scale(1.1);
}

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-specs-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.card-spec-pill {
  font-size: 0.78rem;
  background: var(--bg-surface-elevated);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  color: #E2E8F0;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.card-footer-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  color: #CBD5E1;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

.card-location {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #CBD5E1;
  font-weight: 500;
}

/* Horizontal Card layout for search list view */
.listing-card-list-mode {
  flex-direction: row;
}
.listing-card-list-mode .listing-card-media {
  width: 260px;
  min-width: 260px;
  aspect-ratio: auto;
  height: 100%;
}
@media (max-width: 640px) {
  .listing-card-list-mode {
    flex-direction: column;
  }
  .listing-card-list-mode .listing-card-media {
    width: 100%;
    aspect-ratio: 16 / 10;
  }
}

/* Footer */
.alm-footer {
  background: #05080E;
  border-top: 1px solid rgba(229, 169, 60, 0.2);
  padding: 60px 0 30px;
  margin-top: auto;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr);
  gap: 40px;
  margin-bottom: 50px;
}

@media (max-width: 1024px) {
  .footer-top {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .footer-top {
    grid-template-columns: 1fr;
  }
}

.footer-col-brand p {
  margin-top: 14px;
  font-size: 0.92rem;
  line-height: 1.6;
  max-width: 320px;
}

.footer-col-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.88rem;
  transition: color var(--transition-fast);
}
.footer-links a:hover {
  color: var(--gold-bright);
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-socials {
  display: flex;
  gap: 12px;
}
.footer-social-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}
.footer-social-btn:hover {
  color: var(--gold-bright);
  border-color: var(--gold-primary);
  transform: translateY(-2px);
}
