/* ═════════════════════════════════════════════════════════════
   CM COLLECTION - Shop Archive & Product Grid (Next.js Design)
   ═════════════════════════════════════════════════════════════ */

/* Override TheGem wrapper background */
.woocommerce .site-content {
    background-color: var(--cm-bg-dark, #0b0e14) !important;
}

/* ─── Shop Layout (Sidebar + Grid) ─── */
.cm-shop-layout-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.cm-shop-sidebar {
    width: 250px;
    flex-shrink: 0;
}

.cm-sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(0, 168, 232, 0.5); /* Primary color */
}

.cm-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cm-category-list li {
    margin-bottom: 8px;
}

.cm-category-list li a {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.95rem;
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.cm-category-list li a:hover,
.cm-category-list li.current-cat > a {
    background: rgba(255, 255, 255, 0.05);
    color: #00a8e8; /* Primary */
    padding-left: 16px;
}

.cm-category-list li ul.children {
    padding-left: 15px;
    margin-top: 5px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.cm-shop-main-content {
    flex: 1;
    min-width: 0; /* Prevents flex blowout */
}

@media (max-width: 991px) {
    .cm-shop-layout-wrapper {
        flex-direction: column;
    }
    .cm-shop-sidebar {
        width: 100%;
        margin-bottom: 30px;
    }
}

/* ─── Product Card (Grid Item) ─── */
.cm-product-card {
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.05); /* bg-muted/10 equivalent */
    border: 1px solid rgba(255, 255, 255, 0.05); /* border-white/5 */
    border-radius: 0.5rem; /* rounded-lg */
    overflow: hidden;
    position: relative;
    transition: all 0.5s ease;
    height: 100%;
}

.cm-product-card:hover {
    border-color: rgba(0, 168, 232, 0.5); /* hover:border-primary/50 */
    box-shadow: 0 0 20px rgba(217, 158, 33, 0.1);
}

/* Image Container */
.cm-product-image-container {
    display: block;
    aspect-ratio: 3/4;
    position: relative;
    padding: 1.5rem; /* p-6 */
    background-color: transparent;
    cursor: pointer;
    overflow: hidden;
}

.cm-product-image-container img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease-in-out;
}

.cm-product-card:hover .cm-product-image-container img {
    transform: scale(1.1); /* group-hover/img:scale-110 */
}

/* Hover Overlay for Image */
.cm-image-overlay {
    position: absolute;
    inset: 0;
    background-color: transparent;
    transition: background-color 0.5s ease;
    z-index: 10;
}

.cm-product-card:hover .cm-image-overlay {
    background-color: rgba(0, 0, 0, 0.1);
}

/* Card Content (Info Box) */
.cm-product-info-box {
    padding: 1.25rem; /* p-5 */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: linear-gradient(to top, var(--cm-bg-dark, #0b0e14), rgba(255, 255, 255, 0.05)); /* bg-gradient-to-t from-background to-muted/20 */
    position: relative;
    z-index: 20;
    flex: 1;
}

.cm-product-title-v2 {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5rem;
}

.cm-product-card:hover .cm-product-title-v2 {
    color: var(--cm-primary, #00a8e8);
}

.cm-product-sku-v2 {
    font-size: 0.75rem;
    color: #9ca3af; /* text-gray-400 */
    margin-bottom: 1.5rem;
    font-family: monospace;
    letter-spacing: 0.1em;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    width: 100%;
}

/* Actions Wrapper */
.cm-product-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
}

/* Buttons */
.cm-btn-details {
    width: 100%;
    padding: 0.625rem 0;
    background-color: transparent;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.125rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    text-decoration: none !important;
}

.cm-btn-details:hover {
    background-color: #ffffff;
    color: #000000;
}

.cm-btn-quote-modal {
    width: 100%;
    padding: 0.625rem 0;
    background: linear-gradient(to right, #00a8e8, #2563eb);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    text-align: center;
    border: none;
    border-radius: 0.125rem;
    box-shadow: 0 0 15px rgba(0, 168, 232, 0.4);
    transition: all 0.3s ease;
    cursor: pointer;
}

.cm-btn-quote-modal:hover {
    box-shadow: 0 0 25px rgba(0, 168, 232, 0.6);
    transform: translateY(-2px);
}

/* Override TheGem grid layout to use CSS Grid */
.products.columns-4 {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 24px !important;
}

.products.columns-4::before,
.products.columns-4::after {
    display: none !important;
}

.products.columns-4 .product {
    width: 100% !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
}

/* Responsive Grid */
@media (max-width: 1199px) {
    .products.columns-4 {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 991px) {
    .products.columns-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }
}

@media (max-width: 575px) {
    .products.columns-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }
    
    .cm-product-title-v2 {
        font-size: 0.625rem; /* text-[10px] */
    }
    
    .cm-product-sku-v2 {
        font-size: 0.625rem;
        margin-bottom: 0.75rem;
        padding-top: 0.5rem;
    }
    
    .cm-btn-details, .cm-btn-quote-modal {
        font-size: 0.5625rem; /* text-[9px] */
        padding: 0.375rem 0;
    }
}
