/* ==========================================================================
   LAYOUT.CSS - Header, Footer, Sidebar, Main Container
   ========================================================================== */


* {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* ==========================================================================
   CSS VARIABLES
   ========================================================================== */

:root {
  --blue: #3b82f6;
  --green: #10b981;
  --green-deep: #059669;
  --text: #111827;
  --text-muted: #6b7280;
  --bg: #ffffff;
  --bg-soft: #f8fafc;
  --panel: #f9fafb;
  --border: #e2e8f0;
  --border-mid: #d1d5db;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 8px 25px rgba(0,0,0,.10);
  --radius: 8px;
  --drawer-w: 16rem;

  /* Z-index scale */
  --z-main-content: 20;
  --z-header: 90;
  --z-dropdown: 100;
  --z-tabs: 101;
  --z-sidebar: 100;
  --z-sidebar-overlay: 110;
  --z-sidebar-drawer: 120;
  --z-sidebar-toggle: 150;
  --z-modal: 10000;
}

/* ==========================================================================
   SCROLLBAR
   ========================================================================== */

html {
  overflow-y: scroll !important;
  scrollbar-width: auto;
  scrollbar-color: #94a3b8 #f1f5f9;
}

::-webkit-scrollbar {
  width: 12px;
  background: #e2e8f0;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 6px;
  border: 2px solid #f1f5f9;
}

::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.site-header .container {
  display: block !important;
  max-width: 100% !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 0 24px !important;
  box-sizing: border-box !important;
}

.header-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 24px;
  max-width: 1355px;
  margin: 0 auto;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo img {
  height: 32px;
  width: auto;
  display: block;
}

.header-nav-wrapper {
  display: flex;
  align-items: center;
  gap: 32px;
}

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

.nav-link {
  color: #1e293b;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover {
  color: #3b82f6;
}

.nav-item {
  position: relative;
}

.nav-item button.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.nav-item button.nav-link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s;
}

.nav-item:hover button.nav-link svg {
  transform: rotate(180deg);
}

.submenu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  min-width: 200px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s;
  z-index: 100;
}

.nav-item:hover .submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.submenu a {
  display: block;
  padding: 10px 16px;
  color: #64748b;
  font-size: 14px;
  text-decoration: none;
  transition: all 0.2s;
}

.submenu a:hover {
  background: #f8fafc;
  color: #3b82f6;
  padding-left: 20px;
}

.phone-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #3b82f6;
  border-radius: 999px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.phone-pill:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.phone-pill svg {
  width: 18px;
  height: 18px;
}

/* Mobile Menu Toggle */
.header-mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.header-mobile-toggle span {
  display: block;
  width: 25px;
  height: 3px;
  background: #1e293b;
  border-radius: 3px;
  transition: all 0.3s;
}

.mobile-menu {
  display: none;
  background: white;
  border-bottom: 1px solid #e5e7eb;
}

.mobile-menu.open {
  display: block;
}

.mobile-menu > a {
  display: block;
  padding: 12px 24px;
  color: #1e293b;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid #f1f5f9;
  transition: all 0.2s;
}

.mobile-menu > a:hover {
  background: #f8fafc;
  color: #3b82f6;
}

.mobile-subgroup {
  border-bottom: 1px solid #f1f5f9;
}

.industries-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 24px;
  background: none;
  border: none;
  color: #1e293b;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s;
}

.industries-heading:hover {
  background: #f8fafc;
}

.industries-heading svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
}

.industries-heading.expanded svg {
  transform: rotate(180deg);
}

.mobile-industries-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.mobile-industries-list.expanded {
  max-height: 50vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-industries-list a {
  display: block;
  padding: 10px 24px 10px 40px;
  color: #64748b;
  font-size: 15px;
  text-decoration: none;
  transition: all 0.2s;
}

.mobile-industries-list a:hover {
  background: #f8fafc;
  color: #3b82f6;
  padding-left: 44px;
}

.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
  display: block;
  opacity: 1;
}

@media (max-width: 1024px) {
  .header-nav-wrapper {
    display: none;
  }
  .header-mobile-toggle {
    display: flex;
  }
  .site-header .container {
    padding: 0 16px !important;
  }
  .header-wrap {
    padding: 12px 0;
  }
  .header-logo img {
    height: 28px;
  }
}

/* ==========================================================================
   MAIN CONTAINER
   ========================================================================== */

main.container {
  display: flex;
  flex-direction: column;
  max-width: 1400px;
  margin: 1rem auto;
  margin-top: 2rem;
  padding: 0 1rem;
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.main-content {
  padding: 0;
  flex: 1;
  z-index: 20;
  width: 100%;
}

@media (min-width: 470px) {
  main.container {
    display: flex !important;
    flex-direction: row !important;
    gap: 1rem;
    align-items: flex-start !important;
  }
  .main-content {
    flex: 1 !important;
    min-width: 0 !important;
  }
}

@media (max-width: 470px) {
  main.container {
    margin-top: 0 !important;
    padding: 0 !important;
  }
  .main-content {
    padding: 0 !important;
  }
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */

.sidebar-container {
  width: 100%;
  z-index: 100;
}

.sidebar {
  background: var(--panel);
  padding: 1.5rem;
  border-radius: .5rem;
  box-shadow: var(--shadow-sm);
}

/* Desktop: Static sidebar (921px and up) */
@media (min-width: 921px) {
  main.container {
    display: flex !important;
    flex-direction: row !important;
    gap: 1rem !important;
    align-items: flex-start !important;
  }
  .main-content {
    flex: 1 !important;
    min-width: 0 !important;
  }
  .sidebar-container {
    position: static !important;
    top: auto !important;
    width: 20rem !important;
    flex-shrink: 0 !important;
    align-self: flex-start !important;
    z-index: 100 !important;
    display: block !important;
  }
  .sidebar {
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 1.5rem !important;
    border-radius: 0.5rem !important;
    box-shadow: var(--shadow-md) !important;
    background: var(--panel) !important;
    max-height: none !important;
    overflow-y: visible !important;
    height: auto !important;
    transform: none !important;
  }
  .overlay,
  .toggle-button,
  #sidebarToggle {
    display: none !important;
  }
}

/* Tablet: Collapsible sidebar (470px - 920px) */
@media (min-width: 470px) and (max-width: 920px) {
  main.container {
    display: block !important;
    padding: 0 1rem !important;
  }
  .main-content {
    width: 100% !important;
    position: relative !important;
    z-index: 1 !important;
  }
  .sidebar-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 0 !important;
    overflow: visible !important;
    z-index: 100 !important;
    pointer-events: none !important;
  }
  .sidebar-container:not(.closed) {
    pointer-events: auto !important;
  }
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    z-index: 120 !important;
    width: 18rem !important;
    height: 100% !important;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
    transition: transform .3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
    will-change: transform !important;
    border-radius: 0 !important;
    padding: 1.25rem !important;
    background: var(--panel) !important;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15) !important;
  }
  /* Slide sidebar off-screen when closed */
  .sidebar-container.closed .sidebar {
    transform: translateX(-100%) !important;
    will-change: auto !important;
  }
  .sidebar-container:not(.closed) .sidebar {
    transform: translateX(0) !important;
  }
  .overlay {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0,0,0,.5) !important;
    z-index: 110 !important;
    display: none !important;
    pointer-events: none !important;
    transition: opacity .3s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  }
  .overlay.active {
    display: block !important;
    pointer-events: auto !important;
    opacity: 1 !important;
  }
  #sidebarToggle {
    display: flex !important;
    pointer-events: auto !important;
  }
  #sidebarContainer.closed #sidebarToggle {
    transform: translateY(-50%) translateX(0) !important;
  }
  #sidebarContainer:not(.closed) #sidebarToggle {
    transform: translateY(-50%) translateX(18rem) !important;
  }
}

@media (max-width: 469px) {
  .sidebar-container {
    position: fixed;
    inset: 0;
    overflow: visible;
    z-index: 100;
  }
  .sidebar-container.closed {
    width: 0;
    pointer-events: none;
  }
  .sidebar {
    position: fixed;
    inset-y: 0;
    left: 0;
    z-index: 120;
    width: 16rem;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    transition: transform .3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    margin-bottom: 1rem;
  }
  .sidebar-container.closed .sidebar {
    will-change: auto;
  }
  .overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 110;
    display: none;
    pointer-events: none;
    transition: opacity .3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
  .overlay.active {
    display: block;
    pointer-events: auto;
    opacity: 1;
  }
  .site-header {
    z-index: 90 !important;
  }
  #sidebarToggle {
    display: flex !important;
    pointer-events: auto !important;
    background-color: hsl(120,100%,40%) !important;
    animation: colorChange 10s infinite linear !important;
  }
}

/* Sidebar Toggle Button */
#sidebarToggle {
  /* Reset button styles */
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  font: inherit;
  color: inherit;
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px !important;
  height: 80px !important;
  border-radius: 0 .5rem .5rem 0;
  cursor: pointer;
  z-index: var(--z-sidebar-toggle) !important;
  transition: transform .3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: auto !important;
  background-color: hsl(120,100%,40%);
  animation: colorChange 10s infinite linear;
  border: 1px solid var(--border-mid);
  border-left: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#sidebarToggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

#sidebarToggle.pressing {
  transform: translateY(-50%) scale(0.92);
  transition: transform 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#sidebarContainer.closed #sidebarToggle.pressing {
  transform: translateY(-50%) translateX(0) scale(0.92);
}

#sidebarContainer:not(.closed) #sidebarToggle.pressing {
  transform: translateY(-50%) translateX(var(--drawer-w)) scale(0.92);
}

#sidebarContainer.closed #sidebarToggle {
  transform: translateY(-50%) translateX(0);
}

#sidebarContainer:not(.closed) #sidebarToggle {
  transform: translateY(-50%) translateX(var(--drawer-w));
}

@media (min-width: 921px) {
  #sidebarToggle {
    display: none !important;
  }
}

#sidebarToggle svg {
  width: 20px !important;
  height: 20px !important;
}

@keyframes colorChange {
  0%   { background-color: hsl(120, 100%, 40%); }
  25%  { background-color: hsl(200, 100%, 50%); }
  50%  { background-color: hsl(280, 100%, 50%); }
  75%  { background-color: hsl(40, 100%, 50%); }
  100% { background-color: hsl(120, 100%, 40%); }
}

/* Sidebar Content */
.sidebar * {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.sidebar input,
.sidebar select,
.sidebar textarea {
  user-select: auto;
  -webkit-user-select: auto;
}

.sidebar-container,
#sidebarOverlay {
  z-index: var(--z-sidebar) !important;
}
.sidebar {
  z-index: var(--z-sidebar-drawer) !important;
}
#sidebarToggle {
  z-index: var(--z-sidebar-toggle) !important;
}

/* Location Details */
.location-details {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  box-shadow: var(--shadow-sm);
}

.location-details h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.edit-zip {
  margin-left: .5rem;
  cursor: pointer;
  color: #22c55e;
  transition: transform .2s;
}

.edit-zip:hover {
  transform: scale(1.1);
}

#edit-zip-header {
  pointer-events: auto;
  position: relative;
  z-index: 50;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  width: 20px !important;
  height: 20px !important;
  vertical-align: middle;
  margin-bottom: 6px;
}

#edit-zip-header:active {
  transform: scale(0.95);
}

#zip-modal {
  z-index: var(--z-modal) !important;
  position: fixed !important;
}

/* Supplier Options */
.supplier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.supplier-header label {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.all-providers-link {
  font-size: 0.875rem;
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s ease;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.all-providers-link:hover {
  color: #2563eb;
}

.all-providers-link:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

#supplier-options-text {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-left: -0.5rem;
}

.supplier-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 8rem;
  height: 8rem;
  overflow: hidden;
  margin: 0 auto;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 10px;
  background-color: var(--bg-soft);
  transition: background-color .2s ease, border-color .2s ease, transform .1s ease;
  padding: 0;
}

.supplier-logo-container:hover {
  transform: scale(1.05);
  background-color: #e0f2fe;
  border-color: #bfdbfe;
}

.supplier-logo-container.selected {
  border-color: var(--blue);
  background-color: #DBEAFE;
}

.supplier-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (min-width: 471px) {
  .supplier-logo-container {
    width: 6.5rem;
    height: 6.5rem;
  }
  #supplier-options-text {
    gap: 0.75rem;
  }
}

@media (max-width: 470px) {
  .supplier-logo-container {
    width: 5.5rem;
    height: 5.5rem;
  }
  #supplier-options-text {
    gap: 0.5rem;
  }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

footer.site-footer {
  margin-top: 80px;
  padding: 48px 24px 32px;
  background: #1e293b;
  color: #fff;
}

footer.site-footer .container {
  max-width: 1200px;
  margin: 0 auto;
  display: block !important;
  padding: 0 24px;
}

footer.site-footer a {
  color: #fff;
  text-decoration: none;
  opacity: .95;
}

footer.site-footer a:hover {
  opacity: 1;
}

.footer-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  text-align: center;
  padding-bottom: 32px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.footer-nav a {
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: nowrap;
}

.footer-legal {
  color: #94a3b8;
  font-size: 12px;
  flex: 1;
}

.footer-phone {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}

.footer-phone svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 470px) {
  footer.site-footer {
    margin-top: 48px;
    padding: 32px 16px 24px;
  }

  footer.site-footer .footer-top {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 24px;
  }

  footer.site-footer .footer-nav {
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    flex-wrap: wrap;
  }

  .footer-legal {
    white-space: normal;
  }

  .footer-phone {
    margin-left: 0;
  }
}

@media (min-width: 471px) {
  footer.site-footer .footer-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    gap: 24px;
  }

  footer.site-footer .footer-nav {
    flex-direction: row;
    align-items: center;
    gap: 24px;
  }
}

/* ==========================================================================
   GLOBAL SVG & MISC
   ========================================================================== */

/* SVG sizing scoped to sidebar to avoid affecting all SVGs globally */
.sidebar svg {
  max-width: 3rem;
  max-height: 3rem;
}

#results {
  display: none !important;
}

#term-selector-buttons,
#term-selector {
  display: none !important;
}

#sidebar-utility:empty::after,
#sidebar-zone:empty::after,
#sidebar-start-month:empty::after {
  content: "Loading...";
  color: #9ca3af;
}

/* Mobile animation performance override
   NOTE: The authoritative copy of this block lives in the inline <style>
   in product-results.html <head> so it loads before any CSS files.
   This CSS file copy is kept in sync as a fallback for other pages
   that load layout.css without the inline style. */
@media (max-width: 1024px) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .animate-enabled,
  .green-toggle-container,
  .toggle-switch,
  .green-toggle-input,
  #sidebar,
  #sidebarOverlay,
  #sidebarToggle,
  .toggle-tab,
  .mobile-menu,
  .mobile-industries-list,
  .mobile-menu-overlay,
  .industries-heading {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
  }
}

#sidebar {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#sidebarOverlay {
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#sidebarToggle,
.toggle-tab {
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
  z-index: var(--z-sidebar-toggle) !important;
}
