@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


body {
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    background-color: #f9f9f9;
}

nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px; /* FIXED HEIGHT is crucial for sticky math */
    padding: 0 5%;
    background-color: rgba(211, 4, 48, 1);
    backdrop-filter: blur(15px);
    z-index: 2000;
    
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.navbar-toggle {
    z-index: 10;
    display: none;
    background: transparent;
    padding: 10px;
    border: none;
    cursor: pointer;
}
.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: rgb(255, 255, 255);
    transition: all 0.3s ease-in-out;
}
.nav-links.active {
    display: flex;
}
.navbar-toggle.active .bar {
    background-color: #000;
}
.navbar-toggle.active .bar:nth-child(2) {
    opacity: 0;
}
.navbar-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.navbar-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

.logo {
    position: static;
    left: 5%;
}
.logo img {
    height: 95px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.nav-links li a {
    position: relative;
    font-size: 1.2rem;
    font-weight: 500;
    text-decoration: none;
    color: white;
    transition: 0.3s ease;
}
.nav-links li a:hover {
    color:rgb(231, 231, 231);
}

/* Phone and tablets */
@media (max-width: 880px) {
    .nav-links {
        display: none;
        background-color: #ebebeb;
        flex-direction: column;
        align-items: flex-start;
        gap: 1.7rem;
        position: absolute;
        height: 100vh;
        width: 250px;
        top: 0;
        right: 0;
        padding: 5rem 1.5rem;
        box-shadow: 0 10 10px rgba(0,0,0,0.5);
        backdrop-filter: blur(20px);
    }
    .nav-links li a {
        color: #111;
    }
    .nav-links li a:hover {
        color: #3d3838;
    }

    .navbar-toggle {
        display: block;
    }
}

@media (min-width: 881px) {
    .nav-links {
        margin: 0 auto;
    }
}




/* =====================
   SIDEBAR
===================== */

.sidebar {
    position: -webkit-sticky;
    position: sticky;
    
    /* Start sticking exactly 120px from top (below nav) */
    top: 120px; 
    width: 300px;
    height: calc(100vh - 140px); 
    
    /* Scrollbar appears ONLY inside this box */
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    z-index: 1000;
    flex-shrink: 0;
}



/* close button */
.close-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    margin-bottom: 10px;
}

/* Design for the active item */
/* Design for the active item */
li.active-category {
    /* ADD !important HERE so it overrides the "background: none" later in the file */
    background-color: #d6002f !important; 
    
    color: #ffffff !important;
    border-radius: 6px;
    font-weight: 500;
    padding: 6px 12px !important;
    
    /* Adjusts position to account for padding */
    margin-left: -12px; 
    width: calc(100% + 24px); 
    display: block; 
}

/* 2. Force text inside buttons (like the arrows) to be white too */
li.active-category .category-toggle {
    color: #ffffff !important;
}

/* 3. Turn the arrow icon white */
li.active-category .category-toggle::after {
    filter: brightness(0) invert(1); /* CSS filter to turn black icon white */
    opacity: 1;
}

/* 4. Keep white on hover */
li.active-category:hover,
li.active-category:hover .category-toggle {
    color: #ffffff !important;
    opacity: 1;
}


/* Ensure hover doesn't turn it back to black/gray */
.active-category:hover {
    color: #ffffff !important;
    opacity: 0.9;
}

/* =====================
   SEARCH
===================== */

.search-box input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    outline: none;
}

.sidebar-title {
    margin: 25px 0 10px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =====================
   CATEGORY LIST RESET
===================== */

.category-list,
.sub-category {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list > li {
    margin-bottom: 6px;
}

.has-children.open > .sub-category {
    max-height: 2000px;
}


/* =====================
   MAIN CATEGORIES
===================== */

.category-list > li,
.category-toggle {
    display: block;
    width: 100%;

    background: none;
    border: none;

    padding: 6px 0;
    font-size: 0.9rem;
    font-weight: 600;

    color: #222;
    cursor: pointer;
    
}



/* hover */
.category-list > li:hover,
.category-toggle:hover {
    color: #000;
}

/* All products */
.all-products {
    font-weight: 600;
}

/* =====================
   DROPDOWN ARROW
===================== */

.category-toggle {
    background: none;
    border: none;               /* nukes browser button styles */
    display: flex;
    justify-content: space-between;
    align-items: center;

    width: 100%;
    cursor: pointer;

    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: 1.2;

    padding: 6px 0;           /* control spacing manually */
}

.category-toggle::after {
    content: "⌄";
    font-size: 0.75rem;
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.category-item.open > .category-toggle::after {
    transform: rotate(180deg);
}


/* =====================
   SUB CATEGORIES (DOWN ONLY)
===================== */

.sub-category {
    display: none;
    margin-top: 6px;
    padding-left: 14px; /* SINGLE indent only */
    border-left: 1px solid #e0e0e0;

    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}
.has-children.open > .sub-category {
    display: block;
}
.sub-category .category-toggle {
    font-size: 0.92rem;
}
.category-item.open > .sub-category {
    max-height: 2000px;
}

.sub-category li {
    padding: 4px 0;
    font-size: 0.85rem;
    font-weight: 400;
    color: #555;
    cursor: pointer;
}

.sub-category li:hover {
    color: #000;
}

/* =====================
   NESTED SUB-CATEGORIES
   (NO EXTRA RIGHT SHIFT)
===================== */

.sub-category .has-children {
    margin-top: 6px;
}

.sub-category .has-children > .sub-category {
    padding-left: 12px;   /* SAME indent, not cumulative */
    margin-left: 0;       /* prevent drifting right */
    border-left: 1px solid #e0e0e0;
}
/* =====================
   DIVIDER
===================== */

.divider {
    margin: 15px 0;
    border: none;
    border-top: 1px solid #e5e5e5;
}

/* =====================
   BACKDROP
===================== */

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 900;
}

.backdrop.active {
    opacity: 1;
    pointer-events: all;
}

/* =====================
   SIDEBAR TOGGLE (MOBILE)
===================== */

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    font-size: 1.4rem;
    background: #111;
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    z-index: 1100;
}

.sidebar-toggle.hidden {
    opacity: 0;
    pointer-events: none;
}

/* =====================
   MOBILE BEHAVIOR
===================== */

@media (max-width: 768px) {
    /* 1. Stack the layout so products aren't pushed right */
    .main-container {
        flex-direction: column;
        padding-top: 110px; /* Adjust based on your 100px nav */
        padding-left: 15px;
        padding-right: 15px;
        gap: 10px;
    }

    /* 2. Fix the sidebar as a mobile drawer */
    .sidebar {
        position: fixed; /* Override sticky for mobile */
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        border-radius: 0;
        transform: translateX(-100%); /* Start hidden */
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 3000; /* Above the nav */
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
    }

    .sidebar.active {
        transform: translateX(0); /* Slide in */
    }

    /* 3. Ensure the toggle button is visible */
    .sidebar-toggle {
        display: block !important;
        position: fixed;
        bottom: 20px; /* Move to bottom right for thumb-reachability */
        right: 90px;
        top: 20px;
        left: auto;
        background: #d6002f; /* Matching your theme */
        border-radius: 50%;
        width: 60px;
        height: 60px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        z-index: 2500;
    }

    .catalog {
        width: 100%;
        padding: 0;
    }

    /* 4. Adjust grid for smaller screens */
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 15px;
    }

    .close-btn {
        display: block;
    }

    .sidebar-toggle {
        display: block;
    }
}



/* catalog */

.main-container {
    display: flex;
    align-items: flex-start; /* Required for sticky */
    padding: 20px 5%;
    padding-top: 120px; /* 100px Nav + 20px Gap */
    gap: 30px;
    min-height: 100vh;
}

.catalog {
    flex-grow: 1;
    margin-left: 0; /* Remove the old fixed margin-left */
    padding: 20px;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 25px;
}

.product-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 10px 20px rgba(0,0,0,.08);
  transition: transform .2s ease, box-shadow .2s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 30px rgba(0,0,0,.12);
}

.product-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.product-card h3 {
  font-size: .95rem;
  margin: 12px 12px 6px;
}

.product-card p {
  font-size: .8rem;
  color: #555;
  margin: 0 12px 14px;
}


.site-footer {
  background: #d6002f;
  color: white;
  padding: 2.5rem 5vw;
}

.site-footer img {
  height: 150px;
  margin-bottom: -50px;
  margin-top: -30px;
}

.footer-top,
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-email {
  font-size: 0.95rem;
}

.site-footer hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.5);
  margin: 1.5rem 0;
}

.footer-bottom p {
  font-size: 0.85rem;
  line-height: 1.4;
}

.footer-socials {
  display: flex;
  gap: 1rem;
}

.footer-socials img {
  height: 28px;
  filter: brightness(0) invert(1);
}


@media (max-width: 768px) {
  .footer-top,
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}
