/* =========================
   Header / Navbar
========================= */

.site-header {
  /* position: sticky;
  top: 0; */
  z-index: 1000;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: #111827;
}

.brand-logo {
  width: 62px;
  height: 62px;
  flex-shrink: 0;
  overflow: hidden;
  background-color: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 1rem;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

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

.brand-name {
  color: #111827;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.04em;
}

.brand-subtitle {
  margin-top: 0.2rem;
  color: #6b7280;
  font-size: 0.8rem;
}

/* =========================
   Header Search
========================= */

.search-box {
  display: flex;
  align-items: center;
  padding: 0.35rem;
  background-color: #f8fafc;
  border: 1px solid #dbe3ef;
  border-radius: 999px;
}

.search-input {
  min-width: 0;
  padding-left: 1rem;
  background-color: transparent;
  border: 0;
  box-shadow: none;
}

.search-input:focus {
  background-color: transparent;
  box-shadow: none;
}

.search-button {
  padding-right: 1.1rem;
  padding-left: 1.1rem;
  color: #ffffff;
  font-weight: 700;
  background-color: #2563eb;
  border-radius: 999px;
}

.search-button:hover,
.search-button:focus {
  color: #ffffff;
  background-color: #1d4ed8;
}

/* =========================
   Header Account Actions
========================= */

.header-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

.header-action-link {
  color: #111827;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.header-action-link:hover,
.header-action-link:focus {
  color: #2563eb;
}

.header-user-label {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.header-user-label strong {
  color: #0f172a;
  font-weight: 800;
}

.header-logout-button {
  padding: 0;
  color: #111827;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: 0;
}

.header-logout-button:hover,
.header-logout-button:focus {
  color: #2563eb;
}

/* =========================
   Store Navigation
========================= */

.category-nav {
  position: relative;
  background-color: #ffffff;
}

.category-nav-scroll {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  overflow: visible;
}

.category-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 1rem 0;
  color: #111827;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.category-nav-link:hover,
.category-nav-link:focus {
  color: #2563eb;
}

.category-nav-link::after {
  position: absolute;
  bottom: 0.65rem;
  left: 0;
  width: 0;
  height: 2px;
  background-color: #2563eb;
  content: "";
  transition: width 0.2s ease;
}

.category-nav-link:hover::after,
.category-nav-link:focus::after {
  width: 100%;
}

/* =========================
   Category Dropdown
========================= */

.category-dropdown {
  position: relative;
}

.category-dropdown-button {
  gap: 0.4rem;
  cursor: pointer;
  background: transparent;
  border: 0;
}

.category-dropdown-arrow {
  position: relative;
  top: -1px;
  flex-shrink: 0;
  font-size: 0.8rem;
  transition: transform 0.2s ease;
}

.category-dropdown-button[aria-expanded="true"] .category-dropdown-arrow {
  transform: rotate(180deg);
}

.category-dropdown-menu {
  min-width: 250px;
  max-height: 360px;
  padding: 0.65rem;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.14);
}

.category-dropdown-item {
  padding: 0.65rem 0.8rem;
  color: #334155;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: 0.65rem;
}

.category-dropdown-item:hover,
.category-dropdown-item:focus {
  color: #1d4ed8;
  background-color: #eff6ff;
}

.category-dropdown-empty {
  color: #94a3b8;
  font-size: 0.82rem;
  font-style: italic;
}

/* =========================
   Medium Desktop
========================= */

@media (max-width: 1199.98px) {
  .header-actions {
    gap: 0.75rem;
  }

  .header-action-link,
  .header-logout-button {
    font-size: 0.9rem;
  }

  .category-nav-scroll {
    gap: 1.2rem;
  }

  .category-nav-link {
    font-size: 0.88rem;
  }
}

/* =========================
   Tablet / Mobile Header
========================= */

@media (max-width: 991.98px) {
  /*
   * The complete mobile header is fairly tall, so it should
   * scroll away instead of covering most of the phone screen.
   */

  .site-header > .container {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }

  .site-header > .container > .row {
    gap: 1rem 0;
  }

  .brand-area {
    justify-content: flex-start;
  }

  .search-input {
    min-width: 0;
  }

  /* Account buttons */

  .header-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .header-actions > .header-action-link,
  .header-actions > a.btn,
  .header-actions > form .header-logout-button {
    display: inline-flex;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.8rem;
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    border-radius: 0.8rem;
  }

  .header-actions > .header-action-link {
    color: #1d4ed8;
    background-color: #ffffff;
    border: 1px solid #93c5fd;
  }

  .header-actions > .header-action-link:hover,
  .header-actions > .header-action-link:focus {
    color: #ffffff;
    background-color: #2563eb;
    border-color: #2563eb;
  }

  .header-actions > a.btn {
    border-radius: 0.8rem;
  }

  .header-actions > form {
    width: 100%;
  }

  .header-actions > form .header-logout-button {
    color: #991b1b;
    background-color: #fff1f2;
    border: 1px solid #fecaca;
  }

  .header-actions > form .header-logout-button:hover,
  .header-actions > form .header-logout-button:focus {
    color: #ffffff;
    background-color: #dc2626;
    border-color: #dc2626;
  }

  /* Always-visible, single-line mobile navigation */

  .category-nav,
  .category-nav .container {
    overflow: visible;
  }

  .category-nav-scroll {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: clamp(0.45rem, 1.4vw, 1.25rem);
    overflow: visible;
    white-space: nowrap;
  }

  .category-nav-link {
    flex: 0 1 auto;
    min-width: 0;
    padding: 0.9rem 0;
    color: #111827;
    font-size: clamp(0.72rem, 1.75vw, 0.88rem);
    font-weight: 600;
    background-color: transparent;
    border: 0;
    border-radius: 0;
  }

  .category-nav-link:hover,
  .category-nav-link:focus {
    color: #2563eb;
    background-color: transparent;
  }

  .category-nav-link::after {
    display: block;
  }

  .category-dropdown {
    position: relative;
    flex: 0 1 auto;
  }

  .category-dropdown-menu {
    z-index: 1100;
  }

  /* Logged-in customer actions use one row */

  .header-actions:has(.header-customer-action) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* Logged-in admin actions */

  .header-actions:has(.header-admin-action) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .header-actions:has(.header-customer-action) .header-action-link,
  .header-actions:has(.header-customer-action) .header-logout-button,
  .header-actions:has(.header-admin-action) .header-action-link,
  .header-actions:has(.header-admin-action) .header-logout-button {
    padding-right: 0.45rem;
    padding-left: 0.45rem;
    font-size: 0.78rem;
  }
}

/* =========================
   Small Mobile
========================= */

@media (max-width: 575.98px) {
  .brand-logo {
    width: 52px;
    height: 52px;
  }

  .brand-name {
    font-size: 1.05rem;
  }

  .brand-subtitle {
    font-size: 0.72rem;
  }

  .header-actions {
    gap: 0.55rem;
  }

  .category-nav-scroll {
    gap: 0.4rem;
  }

  .category-nav-link {
    padding: 0.8rem 0;
    font-size: clamp(0.66rem, 2.7vw, 0.78rem);
  }

  .category-dropdown-button {
    gap: 0.2rem;
  }

  .category-dropdown-menu {
    min-width: 210px;
    max-width: calc(100vw - 2rem);
  }

  .header-actions:has(.header-customer-action),
  .header-actions:has(.header-admin-action) {
    gap: 0.35rem;
  }

  .header-actions:has(.header-customer-action) .header-action-link,
  .header-actions:has(.header-customer-action) .header-logout-button,
  .header-actions:has(.header-admin-action) .header-action-link,
  .header-actions:has(.header-admin-action) .header-logout-button {
    min-height: 42px;
    padding-right: 0.2rem;
    padding-left: 0.2rem;
    font-size: 0.68rem;
    white-space: nowrap;
  }
}
