/* Products page css */
/* --- Global Page Styles --- */
.navigation-container {
    padding: 20px 5%;
    margin-top: 20px;
}

/* Breadcrumbs */
.navigation {
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #777;
}
.navigation a { text-decoration: none; color: var(--secondary-dark); margin: 0 5px; }
.navigation span { color: #ccc; }
.navigation .current{ color: #003738; font-weight: bold;}
/* --- Main Layout Grid --- */
.main-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 30px;
    padding: 20px 5%;
    min-height: 600px;
}

/* --- Product Grid Section --- */
.products-grid {
    flex: 3; /* Takes up 3/4 of the space */
    display: grid;
    /* Responsive Grid Logic */
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

/* Card Updates for Grid View */
.product-card {
    position: relative;     /* REQUIRED: This tells the badge where (0,0) is */
    overflow: hidden;      /* REQUIRED: This clips the badge so it looks like a ribbon */
    
    background: var(--white);
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.sale-badge {
    position: absolute;
    top: 12px;             /* Adjusted for a tighter fit */
    left: -35px;           /* Adjusted to center the rotation on the corner */
    background: #f1c40f;
    color: #000;
    width: 120px;
    transform: rotate(-45deg);
    text-align: center;
    font-weight: bold;
    font-size: 0.85rem;
    z-index: 10;           /* Ensures it stays above the image */
    
    /* Ensure no hidden states exist */
    display: block;        
    opacity: 1;            
    visibility: visible;
}


.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: var(--secondary-dark);
}

.product-card img {
    width: 100%;
    height: 200px;        /* Keeps your grid beautifully aligned */
    object-fit: contain;  /* 🌟 THE FIX: Shrinks the image until 100% of it is visible, borders and all */
    border-radius: 8px;
    margin-bottom: 15px;
    background-color: var(--white); /* Blends any leftover empty space seamlessly with the card */
}

.product-card a {
    font-family: inherit;
    background: var(--primary-dark);
    color: var(--cream-bg);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: 0.3s;

    /* IMPORTANT ADDITIONS FOR ANCHOR TAGS: */
    display: block;          /* Makes it take up the full width and respect padding */
    text-decoration: none;   /* Removes the default underline */
    box-sizing: border-box;  /* Ensures padding doesn't push the width past 100% */
}

.product-card a:hover {
    background-color: var(--secondary-dark);
    color: var(--cream-bg); /* Ensures text stays white on hover */
}

.card-info {
    margin-bottom: 15px;
}

.card-info p {
    font-weight: bold;
    color: var(--primary-dark);
    margin-bottom: 5px;
}

.card-info .price {
    font-size: 0.9rem;
    color: #666;
}

/* --- Sidebar (Categories) --- */
.sidebar {
    flex: 1; /* Takes up 1/4 of the space */
    min-width: 250px;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    position: sticky; /* Sticky sidebar */
    top: 110px; /* Sticks below the navbar */
    order: -1; /* In RTL flex, order 2 puts it on the LEFT side visually? 
                 Actually in RTL: Start is Right.
                 If you want sidebar on LEFT visually: order: 2 (end).
                 If you want sidebar on RIGHT visually: order: -1 (start). 
                 Based on your comment "Left side", we keep it natural (flex-direction row).
                 In RTL, item 1 is Right, item 2 is Left. 
                 So .products-grid is Right, .sidebar is Left. Correct. */
}

.cat-header {
    background-color: var(--primary-dark);
    color: var(--cream-bg);
    padding: 15px 20px;
    font-weight: bold;
    font-size: 1.1rem;
    text-align: center;
}

.cat-body {
    list-style: none; /* Removes bullet points */
    padding: 0;
    margin: 0;
}

.cat-body li {
    border-bottom: 1px solid #eee;
}

.cat-body li a.active {
    color: var(--secondary-dark); /* Or your brand color */
    font-weight: bold;
}

.cat-body li a.active span {
    color: var(--primary-dark);
}

.cat-body li:last-child {
    border-bottom: none;
}

.cat-body a {
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: 0.3s;
}

.cat-body a span {
    background-color: #eee;
    color: #777;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

.cat-body a:hover {
    background-color: #f9f9f9;
    color: var(--secondary-dark);
    padding-right: 25px; /* Slide effect */
}

.cat-body a:hover span {
    background-color: var(--secondary-dark);
    color: var(--cream-bg);
}

/* --- Pagination --- */
.paginator {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 50px 0;
    padding-bottom: 30px;
}

.pag-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 25%; /* Circles */
    border: 2px solid var(--secondary-dark);
    color: var(--secondary-dark);
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    user-select: none;
}

.pag-btn.active, .pag-btn:hover {
    background-color: var(--secondary-dark);
    color: var(--cream-bg);
}

.pag-btn.prev, .pag-btn.next {
    width: auto;
    padding: 0 20px;
    border-radius: 20px; /* Pills for Next/Prev */
}

.paginator a.pag-btn {
    text-decoration: none; /* Removes the underline from links */
    display: flex; /* Keeps the text centered */
}

/* Ensure active/span items look the same as buttons */
.paginator .pag-btn.active {
    background-color: var(--secondary-dark);
    color: var(--cream-bg);
    cursor: default;
}

.mobile-cat-toggle, .sidebar-close {
    display: none; /* Hide toggle and close button on desktop */
}

/* --- Responsive Design --- */
@media (max-width: 900px) {
    .main-content {
        flex-direction: column; /* Stack them */
    }
    .products-grid {
        width: 100%;
    }
    .product-card{
        border-color: var(--secondary-dark);
    }
    .mobile-cat-toggle {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 40%;
        padding: 15px;
        background-color: var(--secondary-dark);
        color: white;
        border: none;
        border-radius: 8px;
        margin-bottom: 20px;
        cursor: pointer;
        order: -1;
        font-family: 'Vazirmatn', sans-serif;
        font-size: 0.7rem;
    }

    /* 2. Turn Sidebar into a sliding drawer */
    .sidebar {
        position: fixed;
        top: 0;
        right: -300px; /* Hide it off-screen to the right (RTL) */
        width: 280px;
        height: 100vh;
        background: var(--cream-bg);
        z-index: 9999 !important;
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        padding: 20px;
        border: 1px solid #002223;
        overflow: hidden;
    }

    .cat-header{
        background-color: var(--secondary-dark); /* Assuming you use this color */
        color: white;
        padding: 15px;
        margin: 0px;
        text-align: center;
        font-weight: bold;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }

    .cat-body{
        border: 1px solid #002223;
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
    }

    /* 3. Class to open the sidebar */
    .sidebar.active {
        right: 0 !important; /* Force the slide-in */
    }

    /* 4. Close button and Overlay */
    .sidebar-close {
        display: block;
        font-size: 2rem;
        text-align: left;
        cursor: pointer;
        margin-bottom: 10px;
        
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        display: none;
        z-index: 999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
}