/* ==========================================================================
   TRENDSPICK PUBLIC HEADER & LAYOUT STYLESHEET
   Desktop: 3-Part Layout [LOGO] [SEARCH] [SIGN IN + CART (FAR RIGHT)]
   Mobile: 2-Row Architecture [☰ HAMBURGER] [CENTERED LOGO] [🛒 CART] + [FULL-WIDTH SEARCH]
   ========================================================================== */

/* ==================== 1. TOP PROMO BAR ==================== */
.tp-topbar {
  background-color: var(--brand-dark);
  color: var(--text-white);
  padding: 8px 0;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--brand-dark-border);
  overflow: hidden;
}

.tp-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.tp-topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.tp-topbar-right {
  display: none;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}

@media (min-width: 992px) {
  .tp-topbar-right {
    display: flex;
  }
}

.tp-topbar-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #E2E8F0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-topbar-item i {
  color: var(--brand-primary);
  flex-shrink: 0;
}

.tp-topbar-link {
  color: #CBD5E1;
  text-decoration: none;
  transition: color 0.15s;
  font-size: 0.8rem;
}

.tp-topbar-link:hover {
  color: var(--brand-primary);
}

.tp-topbar-divider {
  color: #475569;
}

/* ==================== 2. MAIN HEADER ==================== */
.tp-header {
  background-color: var(--brand-surface);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.tp-header-main {
  padding-top: 10px;
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

@media (min-width: 992px) {
  .tp-header-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    height: 76px;
    padding-top: 0;
    padding-bottom: 0;
    gap: var(--space-8);
  }
}

/* ==================== 2A. DESKTOP 3-PART HEADER ==================== */
/* Left: Logo */
.tp-logo-container {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.tp-logo-img {
  height: 42px;
  width: auto;
  object-fit: contain;
}

@media (min-width: 992px) {
  .tp-logo-img {
    height: 46px;
  }
}

/* Center: Flexible Growing Search */
.tp-search-container {
  width: 100%;
  position: relative;
}

@media (min-width: 992px) {
  .tp-search-container {
    flex: 1;
    max-width: 620px;
    margin: 0 auto;
  }
}

.tp-search-bar {
  display: flex;
  align-items: center;
  background-color: #F1F5F9;
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius-md);
  height: 46px;
  overflow: hidden;
  width: 100%;
  transition: all 0.15s ease;
}

.tp-search-bar:focus-within {
  border-color: var(--brand-primary);
  background-color: var(--brand-surface);
  box-shadow: 0 0 0 3px var(--brand-primary-glow);
}

.tp-search-cat-select {
  display: none;
  border: none;
  background: transparent;
  padding: 0 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  outline: none;
  cursor: pointer;
  border-right: 1px solid var(--brand-border);
  height: 100%;
  max-width: 140px;
}

@media (min-width: 992px) {
  .tp-search-cat-select {
    display: block;
  }
}

.tp-search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0 14px;
  font-size: 0.92rem;
  font-family: inherit;
  color: var(--text-primary);
  outline: none;
  min-width: 0;
}

.tp-search-btn {
  background-color: var(--brand-primary);
  color: var(--text-white);
  border: none;
  width: 48px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s;
}

.tp-search-btn:hover {
  background-color: var(--brand-primary-hover);
}

.tp-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--brand-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--brand-border);
  z-index: 150;
  max-height: 320px;
  overflow-y: auto;
}

.search-suggest-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #F1F5F9;
}

.search-suggest-item:hover {
  background-color: #F8FAFC;
}

.suggest-thumb {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--brand-border);
}

.suggest-info {
  display: flex;
  flex-direction: column;
}

.suggest-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.suggest-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Far Right: Sign In / Account + Cart (STRICTLY DOCKED TO RIGHT) */
.tp-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
  margin-left: auto; /* Guarantees extreme right docking on desktop */
}

.tp-btn-header-login {
  display: none;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1.5px solid var(--brand-border);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.tp-btn-header-login:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background-color: var(--brand-primary-light);
}

@media (min-width: 992px) {
  .tp-btn-header-login {
    display: inline-flex;
  }
}

.tp-user-menu {
  display: none;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--brand-border);
  background-color: var(--brand-surface);
  transition: all 0.15s;
}

.tp-user-menu:hover {
  border-color: var(--brand-primary);
  background-color: #FFF7ED;
}

@media (min-width: 992px) {
  .tp-user-menu {
    display: flex;
  }
}

.tp-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--brand-primary);
  color: var(--text-white);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.tp-user-info {
  display: flex;
  flex-direction: column;
}

.tp-user-greeting {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.tp-user-action {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Cart Trigger */
.tp-cart-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background-color: #F8FAFC;
  border: 1.5px solid var(--brand-border);
  transition: all 0.15s;
  white-space: nowrap;
}

.tp-cart-trigger:hover {
  border-color: var(--brand-primary);
  background-color: var(--brand-primary-light);
}

.tp-cart-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-dark);
}

.tp-cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background-color: var(--brand-primary);
  color: var(--text-white);
  font-size: 0.72rem;
  font-weight: 900;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.tp-cart-label {
  display: none;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand-dark);
}

@media (min-width: 992px) {
  .tp-cart-label {
    display: inline-block;
  }
}

/* ==================== 2B. MOBILE 2-ROW HEADER ==================== */
.tp-header-top-row {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  width: 100%;
}

@media (min-width: 992px) {
  .tp-header-top-row {
    display: contents; /* Seamlessly merges back into 3-part desktop flex layout */
  }
}

/* Mobile Hamburger Button */
.tp-hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--brand-surface);
  border: 1.5px solid var(--brand-border);
  border-radius: var(--radius-md);
  color: var(--brand-dark);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s;
}

.tp-hamburger-btn:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background-color: var(--brand-primary-light);
}

@media (min-width: 992px) {
  .tp-hamburger-btn {
    display: none;
  }
}

/* Mobile Center Logo Positioning */
@media (max-width: 991px) {
  .tp-logo-container {
    justify-content: center;
    margin: 0 auto;
  }
  .tp-header-actions {
    margin-left: 0;
    justify-content: flex-end;
  }
  .tp-cart-trigger {
    width: 44px;
    height: 44px;
    padding: 0;
  }
}

/* ==================== 3. CATEGORY NAVIGATION STRIP ==================== */
.tp-cat-nav {
  background-color: var(--brand-surface);
  border-top: 1px solid #F1F5F9;
  border-bottom: 1px solid var(--brand-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: none;
}

@media (min-width: 992px) {
  .tp-cat-nav {
    display: block;
  }
}

.tp-cat-nav::-webkit-scrollbar {
  display: none;
}

.tp-cat-nav-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: 44px;
}

.tp-cat-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.tp-cat-link:hover {
  color: var(--brand-primary);
  background-color: #FFF7ED;
}

.tp-cat-link.active {
  color: var(--brand-primary);
  font-weight: 700;
}

/* ==================== 4. MOBILE NAVIGATION DRAWER ==================== */
.tp-mobile-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(17, 20, 23, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.tp-mobile-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.tp-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 82%;
  max-width: 320px;
  background-color: var(--brand-surface);
  z-index: 1001;
  transform: translateX(-100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.tp-mobile-drawer.active {
  transform: translateX(0);
}

.tp-drawer-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--brand-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tp-drawer-logo {
  height: 36px;
  width: auto;
}

.tp-drawer-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.tp-drawer-nav {
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.tp-drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: var(--brand-dark);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
}

.tp-drawer-link:hover, .tp-drawer-link.active {
  background-color: #FFF7ED;
  color: var(--brand-primary);
}

.tp-drawer-section-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  padding: 14px 12px 6px 12px;
}

.tp-drawer-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--brand-border);
  background-color: #F8FAFC;
}

/* ==================== 5. PUBLIC FOOTER ==================== */
.tp-footer {
  background-color: var(--brand-dark);
  color: #CBD5E1;
  padding-top: var(--space-10);
  margin-top: var(--space-12);
  border-top: 4px solid var(--brand-primary);
}

.tp-footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--brand-dark-border);
}

@media (min-width: 640px) {
  .tp-footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .tp-footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
  }
}

.tp-logo-footer-card {
  display: inline-block;
  background-color: #FFFFFF;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-4);
  cursor: pointer;
}

.tp-logo-footer-img {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.tp-footer-about {
  font-size: 0.85rem;
  color: #94A3B8;
  line-height: 1.6;
}

.tp-footer-heading {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-white);
  margin-bottom: var(--space-3);
  letter-spacing: 0.02em;
}

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

.tp-footer-links a {
  color: #94A3B8;
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.15s;
}

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

.tp-payment-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tp-footer-bottom {
  padding: var(--space-5) 0;
  font-size: 0.78rem;
  color: #64748B;
}

.tp-footer-bottom-inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

@media (min-width: 768px) {
  .tp-footer-bottom-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }
}
