/*
 * Related Products Grid Styles
 * Exact copy from assets/src/scss/components/_product-grid.scss
 * This ensures 100% matching with main product-grid
 */

/* Main Container */
.related-products-section.tharwah-product-grid-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 17px;
}

/* Product Grid - Desktop Layout */
.related-products-section .product-grid.noon-style {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 0;
    margin-top: 20px;
}

@media (min-width: 1400px) {
    .related-products-section .product-grid.noon-style {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 992px) and (max-width: 1399px) {
    .related-products-section .product-grid.noon-style {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .related-products-section .product-grid.noon-style {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    .related-products-section .product-category{
        line-height: 1.5;
    }
}

@media (max-width: 767px) {
    .related-products-section .product-grid.noon-style {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Product Card - EXACT from _product-grid.scss */
.related-products-section .product-card.noon-style {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: all 0.3s ease;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.related-products-section .product-card.noon-style:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border-color: rgba(24, 127, 211, 0.15);
}

/* Compact Mode for Mobile Carousel */
.related-products-section .product-card.noon-style.compact {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.04);
    min-height: 290px;
    height: 290px;
}

.related-products-section .product-card.noon-style.compact:hover {
    transform: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.related-products-section .product-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Image Container */
.related-products-section .product-image-container {
    position: relative;
    width: 100%;
    padding-bottom: 0% !important;
    height: 250px;
    overflow: hidden;
    background: #f8f8f8;
}

.related-products-section .product-card.compact .product-image-container {
    padding-bottom: 0%;
}

.related-products-section .product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-products-section .product-card.noon-style:hover .product-image {
    transform: scale(1.05);
}

.related-products-section .product-card.compact:hover .product-image {
    transform: none;
}

/* Training Provider Logo */
.related-products-section .training-provider-logo {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 70px;
    height: 50px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    z-index: 5;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.related-products-section .training-provider-logo:hover {
    transform: scale(1.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.related-products-section .training-provider-logo img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    object-position: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.related-products-section .product-card.compact .training-provider-logo {
    top: 8px;
    right: 8px;
    width: 50px;
    height: 45px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 3px;
}

.related-products-section .product-card.compact .training-provider-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Discount Badge */
.related-products-section .discount-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff4747;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
    z-index: 2;
}

.related-products-section .product-card.compact .discount-badge {
    padding: 1px 4px;
    font-size: 8px;
    top: 4px;
    left: 4px;
}

/* Product Content */
.related-products-section .product-content {
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.related-products-section .product-card.compact .product-content {
    padding: 6px;
    gap: 3px;
    display: flex;
    flex-direction: column;
}

/* Category */
.related-products-section .product-category {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 400;
    line-height: 1;
}

.related-products-section .product-card.compact .product-category {
    font-size: 9px;
    letter-spacing: 0.3px;
    margin-top: 5px;
}

/* Title */
.related-products-section .product-title {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 34px;
}

.related-products-section .product-card.compact .product-title {
    font-size: 13px;
    line-height: 1.3;
    font-weight: 500;
    min-height: 50px;
    margin: 5px 0;
    overflow: visible;
    text-overflow: unset;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
}

/* Description */
.related-products-section .product-description {
    font-size: 11px;
    color: #666;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-products-section .product-card.compact .product-description {
    font-size: 9px;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.2;
    max-height: 22px;
    overflow: hidden;
}

/* Rating */
.related-products-section .product-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
}

.related-products-section .product-card.compact .product-rating {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    padding: 3px 6px;
    border-radius: 4px;
    gap: 2px;
    z-index: 3;
}

.related-products-section .rating-stars {
    display: inline-flex;
    align-items: center;
    line-height: 0;
    gap: 0;
}

.related-products-section .rating-stars > span {
    display: inline-flex !important;
    align-items: center;
    gap: 1px;
}

.related-products-section .rating-stars svg {
    display: inline-block;
    vertical-align: middle;
}

.related-products-section .rating-value {
    font-weight: 500;
    color: #333;
    font-size: 11px;
}

.related-products-section .product-card.compact .rating-value {
    font-size: 9px;
    color: white;
    font-weight: 500;
}

.related-products-section .review-count {
    color: #999;
    font-size: 11px;
}

.related-products-section .product-card.compact .review-count {
    font-size: 8px;
    color: rgba(255, 255, 255, 0.8);
}

/* Student Enrollment Counter */
.related-products-section .enrollment-counter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    margin: 4px 0;
}

.related-products-section .enrollment-icon {
    width: 14px;
    height: 14px;
    color: #187fd3;
    flex-shrink: 0;
}

.related-products-section .enrollment-text {
    color: #666;
    font-weight: 400;
}

.related-products-section .product-card.compact .enrollment-counter {
    font-size: 10px;
    margin: 2px 0;
}

/* Duration */
.related-products-section .product-duration {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #555;
    font-weight: 400;
    margin: 3px 0;
}

.related-products-section .product-card.compact .product-duration {
    font-size: 10px;
    gap: 3px;
    margin: 2px 0;
}

.related-products-section .duration-icon {
    width: 14px;
    height: 14px;
    color: #187fd3;
    flex-shrink: 0;
}

.related-products-section .product-card.compact .duration-icon {
    width: 12px;
    height: 12px;
}

.related-products-section .duration-text {
    letter-spacing: 0.2px;
}

/* Price Section */
.related-products-section .product-price-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-top: auto;
    padding-top: 4px;
    max-width: 100%;
    overflow: hidden;
}

.related-products-section .product-card.compact .product-price-section {
    gap: 4px;
    padding-top: 0;
    flex-direction: column;
    align-items: flex-start;
}

.related-products-section .sale-price {
    font-size: 16px;
    font-weight: 500;
    color: #187fd3;
}

.related-products-section .product-card.compact .sale-price {
    font-size: 12px;
}

.related-products-section .original-price {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
    opacity: 0.8;
}

.related-products-section .product-card.compact .original-price {
    font-size: 10px;
    margin-left: 4px;
}

.related-products-section .price-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.related-products-section .product-card.compact .price-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
}

.related-products-section .regular-price {
    font-size: 15px;
    font-weight: 500;
    color: #333;
}

.related-products-section .product-card.compact .regular-price {
    font-size: 12px;
}

/* Installment Payment */
.related-products-section .installment-text {
    font-size: 11px;
    color: #187fd3;
    font-weight: 500;
    background: rgba(24, 127, 211, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-products-section .installment-text.zero-interest {
    background: linear-gradient(135deg, rgba(16, 169, 88, 0.1) 0%, rgba(24, 127, 211, 0.1) 100%);
    border: 1px solid rgba(16, 169, 88, 0.2);
    color: #10a958;
    font-weight: 500;
    max-width: calc(100% - 10px);
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-products-section .product-card.compact .installment-text {
    font-size: 10px;
    padding: 1px 5px;
    max-width: 100%;
}

.related-products-section .product-card.compact .installment-text.zero-interest {
    font-size: 9px;
    max-width: 90%;
}

/* Action Button */
.related-products-section .product-action-btn {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, #187fd3 0%, #1569b8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    box-shadow: 0 2px 6px rgba(24, 127, 211, 0.2);
}

.related-products-section .product-action-btn:hover {
    background: linear-gradient(135deg, #1569b8 0%, #1256a0 100%);
    box-shadow: 0 4px 12px rgba(24, 127, 211, 0.35);
    transform: translateY(-2px);
}

/* Mobile List - No longer using swiper */
@media (max-width: 480px) {
    .related-products-section .product-grid.noon-style {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* RTL Support */
[dir=rtl] .related-products-section .training-provider-logo {
    left: 10px;
    right: auto;
}

[dir=rtl] .related-products-section .product-card.compact .training-provider-logo {
    left: 8px;
    right: auto;
}

[dir=rtl] .related-products-section .discount-badge {
    left: auto;
    right: 8px;
}

[dir=rtl] .related-products-section .product-card.compact .discount-badge {
    right: 4px;
    left: auto;
}

[dir=rtl] .related-products-section .product-category,
[dir=rtl] .related-products-section .product-title,
[dir=rtl] .related-products-section .product-description,
[dir=rtl] .related-products-section .product-action-btn,
[dir=rtl] .related-products-section .enrollment-text,
[dir=rtl] .related-products-section .duration-text,
[dir=rtl] .related-products-section .installment-text {
    font-family: Cairo, Tajawal, 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Enhanced Logo Styles */
.related-products-section .training-provider-logo img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.related-products-section .training-provider-logo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 60%);
    border-radius: 8px;
    z-index: -1;
}

/* Responsive Enhancements */
@media (min-width: 1200px) {
    .related-products-section .training-provider-logo {
        width: 75px;
        height: 55px;
    }

    .related-products-section .product-content {
        padding: 12px;
        gap: 6px;
    }

    .related-products-section .product-title {
        font-size: 14px;
    }

    .related-products-section .product-description {
        font-size: 12px;
    }
}

/* Focus States */
.related-products-section .product-card.noon-style:focus-within {
    outline: 2px solid #187fd3;
    outline-offset: 2px;
}

.related-products-section .product-action-btn:focus {
    outline: 2px solid #187fd3;
    outline-offset: -2px;
}

/* Disable Hover on Touch Devices */
@media (hover: none) {
    .related-products-section .product-card.noon-style:hover {
        transform: none;
    }

    .related-products-section .product-card.noon-style:hover .product-image {
        transform: none;
    }

    .related-products-section .product-action-btn:hover {
        transform: none;
    }
}

/* Popular Badge - Hidden for Related Products */
.related-products-section .popular-badge {
    display: none !important;
}

/* Override any old styles */
.related-products-section #related-products-container .program_item {
    display: none !important;
}

/* Ensure proper grid layout */
.related-products-section .container {
    max-width: 100%;
    padding: 0;
}