/* Category Grid Layout */
.cat-grid-wrapper {
    max-width: 1520px;
    margin: 40px auto;
    padding: 0 20px;
    min-height: 60vh;
}
.cat-grid-header {
    margin-bottom: 30px;
    text-align: left;
}
.cat-grid-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}
.cat-grid-header p {
    color: #64748b;
    font-size: 1.1rem;
    margin: 0;
}

/* Original Responsive Grid Architecture */
.cat-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.modern-category-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 25px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
    aspect-ratio: 3/4;
    overflow: hidden; /* Prevent spill over borders */
    position: relative;
    transform: translateZ(0); /* Fixes WebKit transform clipping bug */
}
.modern-category-card:hover {
    transform: translateY(-4px) scale(1.03) translateZ(0); /* Scale the entire card */
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.1), 0 8px 15px -12px rgba(0,0,0,0.05);
    border-color: #cbd5e1;
}
.modern-category-card .img-box {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}
.modern-category-card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
    transition: transform 0.3s;
}
.modern-category-card:hover .cat-name {
    color: #0ea5e9;
}
.modern-category-card .cat-name {
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
    text-align: center;
    line-height: 1.3;
    margin: 0;
    width: 100%;
}

@media (max-width: 767px) {
    .modern-category-card {
        padding: 15px 10px;
        border-radius: 10px;
    }
    .modern-category-card .img-box {
        margin-bottom: 12px;
    }
    .modern-category-card .cat-name {
        font-size: 13px;
    }
}

/* Hierarchy Back Button */
.btn-back-cat {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    margin-bottom: 30px;
    padding: 8px 18px;
    border-radius: 40px;
    background: #f1f5f9;
    transition: all 0.2s;
}
.btn-back-cat:hover {
    color: #0f172a;
    background: #e2e8f0;
}

@media (max-width: 991px) {
    .cat-grid-wrapper { margin: 20px auto; }
    .cat-grid-header h1 { font-size: 1.8rem; }
    .btn-back-cat { margin-bottom: 20px; }
    .cat-grid-container { gap: 16px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
