/**
 * Product Page Styles for CRC Credit Bureau
 * Modern, responsive design following CRC brand guidelines
 */

/* Product Page Layout */
.product-page {
    background-color: var(--light, #F8F9FA);
    min-height: 100vh;
}

/* Product header - uses page-banner styles for consistency */
.product-header {
    background: linear-gradient(135deg, var(--primary, #0A84C7) 0%, var(--primary-dark, #1E3A5F) 100%);
    color: white !important;
    padding: 4rem 0 2rem;
    margin-bottom: 2rem;
}

.product-header h1,
.product-header .h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: white !important;
}

.product-header p,
.product-header .lead {
    color: white !important;
}

.product-header .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.product-header .breadcrumb-item {
    color: rgba(255, 255, 255, 0.8) !important;
}

.product-header .breadcrumb-item a {
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none;
}

.product-header .breadcrumb-item a:hover {
    color: rgba(255, 255, 255, 1) !important;
    text-decoration: underline;
}

.product-header .breadcrumb-item.active {
    color: white !important;
}

.product-header .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(255, 255, 255, 0.6);
    content: ">";
}

/* Comprehensive banner text styling - ensure all text is white */
.product-header * {
    color: white !important;
}

/* Specific overrides for links and interactive elements */
.product-header .breadcrumb-item a:hover {
    color: rgba(255, 255, 255, 1) !important;
    text-decoration: underline;
}

.product-header .fas,
.product-header .fa,
.product-header i {
    color: white !important;
}

/* Additional safety rules for any nested elements */
.product-header span,
.product-header div,
.product-header nav {
    color: inherit !important;
}

/* Search and Filter Section */
.product-controls {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow, 0 4px 20px rgba(10, 132, 199, 0.08));
    margin-bottom: 2rem;
}

.product-controls h6 {
    color: var(--dark, #1E3A5F);
    font-weight: 600;
    margin-bottom: 0;
}

/* Filter tags */
.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--medium-gray, #E9ECEF);
}

.filter-tag {
    background: var(--primary, #0A84C7);
    color: var(--white, #FFFFFF);
    border: 2px solid var(--medium-gray, #E9ECEF);
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.filter-tag:hover {
    background: var(--primary, #0A84C7);
    color: white;
    border-color: var(--primary, #0A84C7);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(10, 132, 199, 0.3);
}

.filter-tag.active {
    background: var(--primary, #0A84C7);
    color: white;
    border-color: var(--primary, #0A84C7);
    box-shadow: 0 2px 8px rgba(10, 132, 199, 0.2);
}

.filter-tag.reset-filter {
    background: var(--danger, #DC3545);
    color: white;
    border-color: var(--danger, #DC3545);
}

.filter-tag.reset-filter:hover {
    background: #c82333;
    border-color: #c82333;
    transform: scale(1.05);
}

/* Sort Controls */
.sort-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sort-select {
    border: 2px solid var(--medium-gray, #E9ECEF);
    border-radius: 6px;
    padding: 8px 12px;
    background: white;
    color: var(--dark, #1E3A5F);
    font-size: 14px;
}

.sort-select:focus {
    border-color: var(--primary, #0A84C7);
    outline: none;
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow, 0 4px 20px rgba(10, 132, 199, 0.08));
    transition: all 0.3s ease;
    border: 1px solid var(--medium-gray, #E9ECEF);
    /* Equal-height setup */
    display: flex;
    flex-direction: column;
    min-height: 470px; /* ensures consistent height across a row */
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover, 0 6px 25px rgba(10, 132, 199, 0.12));
}

.product-card-image {
    position: relative;
    height: 200px;
    background: var(--light-gray, #F8F9FA);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover .product-card-image img {
    transform: scale(1.05);
}

.product-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--primary, #0A84C7);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.product-badge.popular {
    background: var(--warning, #FFC107);
    color: var(--dark, #1E3A5F);
}

.product-badge.new {
    background: var(--success, #28A745);
}

.product-card-content {
    padding: 1.5rem;
    /* Equal-height support: grow to fill, stack content */
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    overflow: hidden;
}

.product-category {
    color: var(--primary, #0A84C7);
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.product-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark, #1E3A5F);
    margin-bottom: 0.75rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-description {
    color: var(--dark-gray, #6C757D);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-features {
    margin-bottom: 1.5rem;
}

.product-features-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark, #1E3A5F);
    margin-bottom: 0.5rem;
}

.product-features-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-features-list li {
    font-size: 13px;
    color: var(--dark-gray, #6C757D);
    margin-bottom: 0.25rem;
    padding-left: 1rem;
    position: relative;
}

.product-features-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success, #28A745);
    font-weight: bold;
}

.product-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.price-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary, #0A84C7);
}

.price-duration {
    font-size: 12px;
    color: var(--dark-gray, #6C757D);
    text-align: right;
}

.product-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: auto; /* stick actions to bottom for equal visual height */
}

/* Product button styles - ensure consistent sizing */
.btn-add-cart,
.btn-view-details,
.btn-view-cart {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
}

.btn-add-cart {
    background: var(--primary);
    border: 2px solid var(--primary);
    color: white;
}

.btn-add-cart:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
}

.btn-view-details {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-view-details:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-1px);
    text-decoration: none;
}

/* View Cart button inherits Bootstrap .btn-success colors from style.css; no additional color overrides here */

/* Loading States */
.products-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
    font-size: 18px;
    color: var(--dark-gray, #6C757D);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-gray, #F8F9FA);
    border-left-color: var(--primary, #0A84C7);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 15px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.products-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6rem 2rem;
    min-height: 400px;
    color: var(--dark-gray, #6C757D);
}

.products-empty-icon {
    font-size: 4rem;
    color: var(--medium-gray, #E9ECEF);
    margin-bottom: 1.5rem;
}

.products-empty h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--dark-gray, #6C757D);
}

.products-empty p {
    font-size: 1rem;
    margin-bottom: 2rem;
    color: var(--dark-gray, #6C757D);
}

/* Pagination */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

.pagination {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: var(--shadow, 0 4px 20px rgba(10, 132, 199, 0.08));
}

.pagination .page-link {
    color: var(--primary, #0A84C7);
    border: 1px solid var(--medium-gray, #E9ECEF);
    padding: 10px 15px;
    margin: 0 2px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background: var(--primary, #0A84C7);
    color: white;
    border-color: var(--primary, #0A84C7);
}

.pagination .page-item.active .page-link {
    background: var(--primary, #0A84C7);
    border-color: var(--primary, #0A84C7);
    color: white;
}

/* Shopping Cart Sidebar */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 1050;
    overflow-y: auto;
}

.cart-sidebar.open {
    right: 0;
}

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1049;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Team Member Card Enhancements */
.member-card .product-title {
    font-weight: 700; /* Make names bold as requested */
    color: var(--dark, #1E3A5F);
}

.member-card .product-category {
    font-weight: 600;
    text-transform: capitalize;
}

.member-card .product-badge {
    font-weight: 600;
}

.member-card .btn-view-details {
    background: var(--primary, #0A84C7);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    border: 2px solid var(--primary, #0A84C7);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.member-card .btn-view-details:hover {
    background: white;
    color: var(--primary, #0A84C7);
    text-decoration: none;
}

.member-card .btn-view-details i {
    margin-right: 8px;
}

/* Team Detail Page Enhancements */
.product-detail-page .member-badge {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.product-detail-page #memberName {
    font-weight: 700; /* Bold member names in detail page */
}

.product-detail-page #memberPosition {
    font-weight: 600;
    line-height: 1.4;
}

.product-detail-page .feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-detail-page .feature-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--medium-gray, #E9ECEF);
    position: relative;
    padding-left: 25px;
}

.product-detail-page .feature-list li:last-child {
    border-bottom: none;
}

.product-detail-page .feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 10px;
    color: var(--success, #28A745);
    font-weight: bold;
    font-size: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-banner,
    .product-header {
        padding: 2rem 0 1rem;
    }
    
    .page-banner h1,
    .product-header h1 {
        font-size: 2rem;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    /* Ensure member cards use full-width and nice image ratio */
    .member-card .product-card-image { height: 260px; }
    
    .product-controls {
        padding: 1.5rem;
    }
    
    .filter-tags {
        justify-content: center;
    }
    
    .sort-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    
    /* .product-actions {

    } */
    /* Reduce fixed heights on tablets */
    .product-card { min-height: 430px; }
}

@media (max-width: 576px) {
    /* Dramatically reduce header padding on mobile */
    .page-banner,
    .product-header {
        padding: 1rem 0 0.5rem;
        margin-bottom: 1rem;
    }
    
    .page-banner h1,
    .product-header h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .page-banner p,
    .product-header p {
        font-size: 0.9rem;
        margin-bottom: 0;
    }
    
    /* Make filter controls much more compact */
    .product-controls {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    /* Mobile filter toggle button */
    .product-controls .btn-outline-primary {
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    /* Compact filter tags on mobile */
    .filter-tags {
        gap: 8px;
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    .filter-tag {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 15px;
    }
    
    /* Stack products in single column with smaller gaps */
    .products-grid {
        gap: 1rem;
        grid-template-columns: 1fr;
    }
    
    /* Mobile-friendly team images */
    .member-card .product-card-image { height: 220px; }
    
    .product-card-content {
        padding: 1rem;
    }
    
    /* Allow natural height on small screens */
    .product-card { 
        min-height: 0;
        margin-bottom: 0;
    }
    
    /* Compact sort select on mobile */
    .form-select {
        font-size: 14px;
        padding: 8px 12px;
    }
}

/* ===== Equal heights for Team (Management/Board) cards ===== */
/* Team pages reuse .product-card markup with .member-card modifier */
.member-card {
    min-height: 400px; /* slightly shorter than product card */
}

@media (max-width: 768px) {
    .member-card { min-height: 360px; }
}

@media (max-width: 576px) {
    .member-card { min-height: 0; }
}

@media (max-width: 768px) {
    .member-card .product-title {
        font-size: 1.1rem;
    }
    
    .member-card .product-category {
        font-size: 12px;
    }
    
    .member-card .btn-view-details {
        padding: 8px 16px;
        font-size: 14px;
    }
}