/* ============================
   DESKTOP DEFAULT
============================ */
.header-desktop{ display: block; }
.header-mobile,
.sm-mobile-drawer{ display: none; }

/* ============================
   MOBILE VIEW
============================ */
@media (max-width: 991.98px){

  .header-desktop{ display: none !important; }
  .header-mobile{ display: block !important; }

  /* MAIN MOBILE HEADER WRAPPER */
  .sm-mobile-header{
    background: #8B1E1E;
    padding: 4px 6px 1px;
    border-radius: 0 !important;
    color: white;
  }

  /* Generic row layout */
  .sm-mobile-row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }

  /* Brand */
  .sm-mobile-brand{
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .sm-mobile-logo{
    height: 52px;
    width: 52px;
    border-radius: 50%;
    object-fit: cover;
  }

  .sm-mobile-title{
    font-size: 20px;
    font-weight: 700;
    color: white;
  }

  /* Menu */
  .sm-mobile-menu-btn{
    font-size: 28px;
    background: none;
    border: none;
    color: white;
    padding: 0;
    margin: 0;
  }

  /* Status */
  .status-badge{
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
  }
  .status-badge.open{ background: #2ECC71; }
  .status-badge.closed{ background: #C0392B; }

  /* Move the OPEN/CLOSED badge slightly right */
  .status-row .status-badge{
    margin-top: -15px;
    margin-left: 60px;
  }

  /* Mobile closed note under status badge */
  .mobile-closed-note{
  margin-top: -6px;
  margin-left: 60px;              /* ✅ match your badge left shift */
  text-align: left;               /* ✅ reads nicer under the badge */
  max-width: calc(100% - 60px);   /* prevents wrapping weirdly */
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.92);
}


  /* Search + Cart Row */
  .search-cart-row{ gap: 10px; }

  /* Actions on right */
  .sm-mobile-actions{
    margin-left: auto;
    display: flex;
    align-items: stretch;
    gap: 12px;
  }

  /* Cart + Search button base */
  .sm-mobile-cart-btn{
    background: #FFC107 !important;
    padding: 12px 14px;
    border-radius: 12px;
    color: black;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none !important;
  }
  
  
  /* ✅ FIX: stop search icon shrink/expand on refresh (lock sizes in CSS) */
.sm-mobile-actions .sm-mobile-cart-btn,
.sm-mobile-actions .sm-mobile-search-btn{
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;

  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  line-height: 1 !important;
  flex: 0 0 48px !important;
}

/* Keep the icons stable */
.sm-mobile-actions .sm-mobile-cart-btn svg,
.sm-mobile-actions .sm-mobile-search-btn svg{
  width: 22px !important;
  height: 22px !important;
  display: block !important;
}

/* Cart count must NOT affect button size */
.sm-mobile-actions .sm-mobile-cart-btn{
  position: relative;
}
.sm-mobile-actions .sm-mobile-cart-btn .cart-count{
  position: absolute;
  top: 5px;
  right: 5px;
  line-height: 1;
}

  .sm-mobile-cart-btn *{ text-decoration: none !important; }

  /* Search button behaves like cart but square */
  .sm-mobile-search-btn{
    border: 0;
    padding: 0 !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
  }
  .sm-mobile-search-btn svg{
    width: 22px;
    height: 22px;
    color: #fff;
    stroke: currentColor;
  }

  /* Cart icon + count */
  .cart-icon{ stroke: #fff; }

  .cart-count{
    background: #ff9800;
    color: #fff;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: bold;
  }

  /* Drawer */
  .sm-mobile-drawer{
    display: block;
    position: fixed;
    top: 0;
    right: -100%;
    width: 75%;
    height: 100%;
    background: white;
    z-index: 9999;
    padding: 20px;
    box-shadow: -4px 0 14px rgba(0,0,0,0.25);
    transition: right 0.3s;
  }
  .sm-mobile-drawer.open{ right: 0; }

  .sm-mobile-drawer .close{
    background: none;
    border: none;
    font-size: 32px;
    float: right;
  }

  .drawer-logo{
    height: 70px;
    width: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin: 40px auto 10px;
    display: block;
  }

  .sm-mobile-drawer h2{
    text-align: center;
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 700;
  }

  .sm-mobile-drawer a{
    display: block;
    padding: 12px 0;
    font-size: 18px;
    border-bottom: 1px solid #eee;
    color: #222;
    text-decoration: none;
  }

  /* Remove underline from brand link in ALL states */
  a.sm-mobile-brand,
  a.sm-mobile-brand:link,
  a.sm-mobile-brand:visited,
  a.sm-mobile-brand:hover,
  a.sm-mobile-brand:focus,
  a.sm-mobile-brand:active{
    text-decoration: none !important;
    color: inherit !important;
    -webkit-tap-highlight-color: transparent;
  }
}

/* ============================
   MOBILE CATEGORY BAR
============================ */
.category-bar{
  background: #8B1E1E !important;
  padding: 6px 0;
  position: -webkit-sticky !important;
  position: sticky !important;
  top: calc(var(--mobileHeaderH, 0px) + var(--mobileHeaderGap, 0px)) !important;
  z-index: 1025 !important;
}

/* Remove Bootstrap container padding ONLY for category bar */
.category-bar .container{
    max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

@media (max-width: 991.98px){

  /* Scrollable row (MOBILE ONLY) */
  .category-scroll{
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden !important;
    scroll-behavior: smooth;
    padding: 6px 12px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }

  .category-scroll::-webkit-scrollbar{ display: none; }

  .category-bar{ margin-top: -5px !important; }
}


/* Category pill style (INACTIVE = yellow) */
.category-pill{
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: 30px !important;
  padding: 6px 14px !important;
  font-size: 14px !important;

  background: #FFC107 !important;
  border: 2px solid #FFB300 !important;
  color: #111 !important;

  font-weight: 600 !important;
  transition: 0.2s;
}

/* Highlighted pill for selected category (ACTIVE = white) */
.category-pill.btn-warning{
  background: #fff !important;
  border-color: #fff !important;
  color: #111 !important;
  font-weight: 800 !important;
}

/* ============================
   MOBILE SEARCH POPUP (Modal)
============================ */
@media (max-width: 991.98px){
  .mobile-search-dialog{
    max-width: 520px;
    width: calc(100% - 24px);
    margin: 0 auto;
      transform: translateY(-40px);
    height: auto;
  }
  
  @media (max-width: 576px){
  #mobileSearchModal .mobile-search-dialog{
    transform: translateY(-40px);
  }
}


  .mobile-search-content{
    border-radius: 18px;
    min-height: auto;
  }

  .mobile-search-content .modal-header{
    padding-top: 14px;
    padding-bottom: 8px;
  }

  .mobile-search-content .modal-body{
    padding-top: 10px;
    padding-bottom: 16px;
  }
}

.modal-search-btn{
  background: #F6A623 !important;
  border: 0 !important;
  color: #111 !important;
  font-weight: 800;
  border-radius: 12px;
  padding: 12px 14px;
}
.modal-search-btn:active{ transform: scale(.99); }

.mobile-search-form-modal{ position: relative; }

.mobile-search-input{
  width: 100%;
  border-radius: 12px;
  padding: 12px 12px;
  border: 1px solid rgba(0,0,0,.12);
  outline: none;
  color: #111;
  background: #fff;
  caret-color: #111;
}

/* ============================
   AUTOCOMPLETE (mobile modal)
============================ */
.autocomplete-wrap{
  position: relative;
  width: 100%;
}

.autocomplete-list{
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;

  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;

  margin-top: 6px;
  padding: 8px 0;

  max-height: 300px;
  overflow-y: auto;

  box-shadow: 0 5px 18px rgba(0,0,0,0.20);

  z-index: 9999;
  display: none;
}

.autocomplete-item{
  padding: 12px 18px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.autocomplete-item:hover,
.autocomplete-item.active{
  background: #f4f4f4;
}

.autocomplete-item .name{
  font-size: 16px;
  color: #111;
}

/* ============================
   CLEAR BUTTON (used in modal + desktop too)
============================ */
.has-clear{
  padding-right: 52px !important;
}

.search-clear-btn{
  position: absolute !important;
  right: 1px !important;
  top: 50% !important;
  transform: translateY(-50%) translateY(1px) !important;

  width: 38px !important;
  height: 38px !important;
  border: 0 !important;
  border-radius: 10px !important;

  background: #f1f3f5 !important;
  color: #111 !important;

  display: none;
  align-items: center !important;
  justify-content: center !important;

  padding: 0 !important;
  line-height: 0 !important;

  cursor: pointer !important;
}

.search-clear-btn:active{
  transform: translateY(-50%) translateY(1px) scale(.97) !important;
}

/* ============================
   STICKY HEADER (mobile)
============================ */
.header-mobile{
  position: -webkit-sticky !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 1030 !important;
  background: transparent;
}

/* ============================
   DESKTOP: Category bar should NOT be sticky
============================ */
@media (min-width: 992px){
  .category-bar{
    position: relative !important;
    top: auto !important;
    z-index: 50 !important;
  }
}

/* Mobile: 1px white line between header and category bar */
@media (max-width: 991.98px){
  .header-mobile{
    border-bottom: 2px solid #fff;
  }
}

/* Mobile LANDSCAPE: disable sticky header + sticky category bar */
@media (max-width: 991.98px) and (orientation: landscape){
  .header-mobile{
    position: relative !important; /* was sticky */
    top: auto !important;
  }

  .category-bar{
    position: relative !important; /* was sticky */
    top: auto !important;
  }
}

/* If you forced mobile header on tablets via (hover:none)/(pointer:coarse),
   this makes sure landscape tablets also lose sticky */
@media (orientation: landscape) and (hover: none) and (pointer: coarse){
  .header-mobile{
    position: relative !important;
    top: auto !important;
  }

  .category-bar{
    position: relative !important;
    top: auto !important;
  }
}

/* ✅ Move the mobile search popup up (reliable override) */
@media (max-width: 991.98px){
  #mobileSearchModal .mobile-search-content{
    transform: translateY(-30px) !important;
  }
}

/* ============================
   FIX: iOS bottom pull / footer expand breaks sticky
   Use FIXED header only on MOBILE PORTRAIT
============================ */
@media (max-width: 991.98px) and (orientation: portrait){

  /* HEADER fixed */
  .header-mobile{
    position: fixed !important;
    top: 0 !important;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1030 !important;
  }

  /* CATEGORY BAR fixed under header */
  .category-bar{
    position: fixed !important;
    left: 0;
    right: 0;
    top: var(--mobileHeaderH, 0px) !important;
    z-index: 1029 !important;
    margin-top: 0 !important;   /* important */
  }

  /* Push page content below fixed header + fixed category bar */
  body{
    padding-top: calc(var(--mobileHeaderH, 0px) + var(--mobileCatBarH, 0px)) !important;
  }
}
