/* =========================
   INVENTORY PAGE WRAPPER
   ========================= */

.inventory-page {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px;
  border-radius: 20px;

  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  box-sizing: border-box;
}


/* =========================
   CATEGORY NAV SHORTCODE
   [itworks_inventory_nav]
   ========================= */

.itworks-inventory-nav,
.inventory-nav {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto 24px;

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.itworks-inventory-nav a,
.inventory-nav a {
  display: block;
  text-align: center;

  padding: 13px 16px;
  border-radius: 12px;

  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);

  color: #e2e8f0;
  text-decoration: none;
  font-weight: 700;

  transition: all 0.2s ease;
}

.itworks-inventory-nav a:hover,
.inventory-nav a:hover {
  background: rgba(255, 255, 255, 0.20);
  color: #ffffff;
  transform: translateY(-2px);
}


/* =========================
   FILTER SHORTCODE
   [itworks_inventory_filter]
   ========================= */

.inventory-filter-wrap {
  width: 100%;
  max-width: 420px;
  margin: 0 auto 30px;

  text-align: center;
  color: #ffffff;
}

.inventory-filter-wrap label {
  display: block;
  margin-bottom: 8px;

  font-weight: 700;
  color: #e2e8f0;
}

.itworks-inventory-filter,
#itworksInventoryFilter,
#categoryFilter {
  width: 100%;
  max-width: 320px;

  padding: 11px 14px;
  border-radius: 10px;

  border: 1px solid rgba(255, 255, 255, 0.25);
  background: #ffffff;
  color: #111827;

  font-size: 1rem;
}


/* =========================
   CARDS SHORTCODE
   [itworks_inventory_cards]
   ========================= */

.itworks-inventory-cards,
.inventory-grid-wrapper {
  width: 100%;
  margin: 0 auto;
}


/* =========================
   CATEGORY SECTIONS
   ========================= */

.category-box {
  width: fit-content auto;
  align-items: center;;
  margin: 42px auto;
  scroll-margin-top: 100px;
  border: 2px solid #ffffff;
  padding: 5px;  
}

.category-title {
  color: #ffffff;
  font-size: 2rem;
  font-weight: 800;

  text-align: center;
  margin: 0 0 18px;
}


/* =========================
   RESPONSIVE PRODUCT GRID
   ========================= */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 340px));
  justify-content: center;
  justify-items: center;
  gap: 22px;

  width: 100%;
}


/* =========================
   PRODUCT CARDS
   ========================= */

.card {
  width: 100%;
  max-width: 340px;

  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;

  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.20);
}

.card img {
  width: 100%;
  height: 220px;

  display: block;
  object-fit: cover;
  background: #f1f5f9;
}

.card h3 {
  margin: 16px 16px 10px;

  font-size: 1.2rem;
  line-height: 1.25;
  color: #0f172a;
}

.card p {
  margin: 7px 16px;

  color: #334155;
  line-height: 1.35;
}

.card p:last-child {
  margin-bottom: 18px;

  font-size: 1.15rem;
  color: #0f172a;
}


/* =========================
   ERROR MESSAGE
   ========================= */

.inventory-error {
  text-align: center;
  color: #ffffff;
  font-weight: 700;
}


/* =========================
   TABLET
   ========================= */

@media (max-width: 1024px) {
  .inventory-page {
    padding: 24px;
  }

  .grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}


/* =========================
   MOBILE
   ========================= */

@media (max-width: 767px) {
  .inventory-page {
    padding: 18px;
    border-radius: 14px;
    align-items: center;
  
  }

  .itworks-inventory-nav,
  .inventory-nav {
    grid-template-columns: 1fr;
  }

  .category-title {
    font-size: 1.55rem;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .card {
    max-width: 100%;
  }

  .card img {
    height: 200px;
  }
}

/* Desktop category buttons */
.itworks-inventory-nav {
    display: grid;
}

/* Filter normally visible */
.inventory-mobile-filter,
.inventory-filter-wrap,
.itworks-inventory-filter {
    display: block;
}

/* Mobile inventory navigation */
@media (max-width: 767px) {

    /* Remove View Desktops / View Laptops */
    .itworks-inventory-nav,
    .inventory-nav {
        display: none !important;
    }

    /* Force filter shortcode and Elementor container visible */
    .inventory-mobile-filter,
    .inventory-mobile-filter .elementor-widget,
    .inventory-mobile-filter .elementor-widget-container,
    .inventory-filter-wrap {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
    }

    .inventory-filter-wrap {
        max-width: none;
        margin: 0 auto 24px;
        text-align: center;
    }

    .inventory-filter-wrap label {
        display: block !important;
        margin-bottom: 8px;
        color: #ffffff;
        font-weight: 700;
    }

    select.itworks-inventory-filter {
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        max-width: none !important;
        min-height: 48px;

        padding: 12px 14px;
        border: 1px solid #cbd5e1;
        border-radius: 10px;

        background: #ffffff !important;
        color: #0f172a !important;

        font-size: 16px;
        box-sizing: border-box;
        appearance: auto;

        text-align:center;
    }
}

/* =========================
   CATEGORY HEADER
   ========================= */

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    width: 100%;
    margin: 0 0 18px;
}

.category-header .category-title {
    margin: 0;
    text-align: left;
}


/* =========================
   BACK TO TOP BUTTON
   ========================= */

.back-to-top {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;
    flex: 0 0 42px;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);

    color: #ffffff;
    text-decoration: none;

    font-size: 24px;
    font-weight: 700;
    line-height: 1;

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.back-to-top:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    transform: translateY(-2px);
}

.inventory-top-anchor {
    scroll-margin-top: 100px;
}

html {
    scroll-behavior: smooth;
}


/* Mobile */

@media (max-width: 767px) {
    .back-to-top {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        font-size: 21px;
    }
}

/* =========================
   DESKTOP / MOBILE CATEGORY CONTROLS
   Desktop: category buttons
   Mobile: dropdown above first category
   ========================= */

/* Desktop default */
.itworks-inventory-nav,
.inventory-nav {
    display: grid !important;
}

.inventory-filter-wrap {
    display: none !important;
}


/* Mobile layout */
@media (max-width: 767px) {

    /* Hide desktop View Category buttons */
    .itworks-inventory-nav,
    .inventory-nav {
        display: none !important;
    }

    /* Show dropdown filter directly above inventory cards */
    .inventory-filter-wrap {
        display: block !important;
        width: 100%;
        max-width: 420px;
        margin: 0 auto 24px;
        padding: 0;
        text-align: center;
    }

    .inventory-filter-wrap label {
        display: block !important;
        margin-bottom: 8px;
        color: #ffffff;
        font-weight: 700;
        font-size: 0.95rem;
    }

    .itworks-inventory-filter,
    #itworksInventoryFilter,
    #categoryFilter {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        min-height: 48px;

        padding: 12px 14px;
        border-radius: 10px;
        border: 1px solid #cbd5e1;

        background: #ffffff !important;
        color: #0f172a !important;

        font-size: 16px;
        font-weight: 600;
        box-sizing: border-box;
        appearance: auto;
    }
}

/* Desktop: show category buttons, hide dropdown */
.itworks-inventory-nav,
.inventory-nav {
    display: grid !important;
}

.inventory-filter-wrap {
    display: none !important;
}

/* Mobile: hide category buttons, show dropdown above first category */
@media (max-width: 767px) {

    .itworks-inventory-nav,
    .inventory-nav {
        display: none !important;
    }

    .inventory-filter-wrap {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;

        width: 100% !important;
        max-width: 420px !important;

        margin: 0 auto 24px !important;
        padding: 0 !important;

        text-align: center !important;
        z-index: 50;
        position: relative;
    }

    .inventory-filter-wrap label {
        display: block !important;
        margin-bottom: 8px;
        color: #ffffff;
        font-weight: 700;
    }

    .inventory-filter-wrap select,
    select.itworks-inventory-filter,
    #itworksInventoryFilter,
    #categoryFilter {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;

        width: 100% !important;
        max-width: 100% !important;
        min-height: 48px !important;

        padding: 12px 14px !important;

        background: #ffffff !important;
        color: #0f172a !important;

        border: 1px solid #cbd5e1 !important;
        border-radius: 10px !important;

        font-size: 16px !important;
        font-weight: 600 !important;

        box-sizing: border-box !important;
        appearance: auto !important;
        -webkit-appearance: menulist !important;
    }
}

/* =========================
   DESKTOP / MOBILE CATEGORY SWITCH
   ========================= */

/* Desktop */
.itworks-inventory-nav {
    display: grid !important;
}

.itworks-mobile-filter-wrap {
    display: none !important;
}


/* Mobile */
@media (max-width: 767px) {

    .itworks-inventory-nav {
        display: none !important;
    }

    .itworks-mobile-filter-wrap {
        display: block !important;
        width: 100%;
        max-width: 420px;
        margin: 0 auto 24px;
        text-align: center;
    }

    .itworks-mobile-filter-wrap label {
        display: block;
        margin-bottom: 8px;
        color: #ffffff;
        font-weight: 700;
    }

    .itworks-mobile-inventory-filter {
        display: block !important;
        width: 100% !important;
        min-height: 48px;

        padding: 12px 14px;

        background: #ffffff !important;
        color: #0f172a !important;

        border: 1px solid #cbd5e1 !important;
        border-radius: 10px !important;

        font-size: 16px;
        font-weight: 600;

        box-sizing: border-box;
        appearance: auto;
        -webkit-appearance: menulist;
    }
}

#inventoryTop {
    scroll-margin-top: 100px;
}

/* =========================
   MOBILE COMPACT CARD GRID
   ========================= */

@media (max-width: 767px) {

    .grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 12px !important;
        justify-items: stretch !important;
    }

    .card {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        border-radius: 12px;
    }

    .card img {
        height: 130px !important;
        width: 100% !important;
        object-fit: cover !important;
    }

    .card h3 {
        font-size: 0.95rem;
        margin: 10px 10px 6px;
        line-height: 1.2;
    }

    .card p {
        font-size: 0.82rem;
        margin: 5px 10px;
        line-height: 1.25;
    }

    .card p:last-child {
        margin-bottom: 10px;
        font-size: 0.95rem;
    }
}

/* =========================
   INVENTORY CONTACT STRIP
   ========================= */

.inventory-contact-strip {
    max-width: 900px;
    margin: 0 auto 28px;
    padding: 18px 20px;

    text-align: center;

    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;

    align-items: center;
    justify-content: center;

    color: #e2e8f0;
}

.inventory-contact-strip p {
    margin: 0 0 14px;
    font-weight: 600;
}

.inventory-contact-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.inventory-contact-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 10px 14px;
    border-radius: 10px;

    background: #ffffff;
    color: #0f172a;

    text-decoration: none;
    font-weight: 700;

    transition: transform 0.2s ease, background 0.2s ease;
}

.inventory-contact-actions a:hover {
    background: #dbeafe;
    transform: translateY(-2px);
}

@media (max-width: 767px) {
    .inventory-contact-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .inventory-contact-actions a {
        width: 100%;
    }
}

/* =========================
   MOBILE CONTACT BUTTON CENTER FIX
   ========================= */

@media (max-width: 767px) {

    .inventory-contact-actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        justify-items: center !important;
        align-items: center;
        width: 100%;
    }

    .inventory-contact-actions a {
        width: 100%;
        max-width: 180px;
        text-align: center;
        justify-content: center;
        margin: 0 auto;
    }

    /* Make the final Contact Page button centered */
    .inventory-contact-actions a:last-child {
        grid-column: 1 / -1;
        justify-self: center !important;
        max-width: 220px;
    }
}