/* 
 * File Path: public/assets/css/frontend/pages/products.css
 * Products Page Styles - Optimized with Lazy Loading & Two-tone Headings
 */

/* ========== CSS Custom Properties ========== */
:root {
    --primary-orange: #F36D21;
    --primary-blue: #243E93;
    --text-dark: #333333;
    --text-light: #666666;
    --border-light: #e0e0e0;
    --bg-light: #f8f9fa;
    --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    --card-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Hero Section - Matching Calculators Style ========== */
.products-hero {
    background: linear-gradient(135deg, #f8f9fb 0%, #ffffff 100%);
    padding: 80px 0 60px;
    border-bottom: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    margin-top: -1px;
}

/* Subtle background pattern matching calculators */
.products-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(243, 109, 33, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(36, 62, 147, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.products-hero-content {
    text-align: center;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

/* ========== Two-tone Title Styles - Matching Calculators ========== */
.products-hero-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.2;
}

.title-primary {
    color: var(--primary-blue);
    display: inline-block;
}

.title-accent {
    color: var(--primary-orange);
    display: inline-block;
}

.products-hero-subtitle {
    font-family: 'Open Sans', sans-serif;
    font-size: 18px;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Category Titles - Two-tone */
.category-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 26px;
    font-weight: 600;
    margin: 0;
}

.category-title .title-primary {
    color: var(--primary-blue);
}

.category-title .title-accent {
    color: var(--primary-orange);
}

/* CTA Title - Two-tone */
.cta-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 32px;
    font-weight: 600;
    margin: 0 0 10px 0;
}

.cta-title .title-primary {
    color: var(--text-dark);
}

.cta-title .title-accent {
    color: var(--primary-orange);
}

/* ========== Main Section ========== */
.products-main {
    padding: 50px 0;
    background: #ffffff;
    min-height: 100vh;
}

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== Category Sections ========== */
.product-category {
    margin-bottom: 60px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.product-category.visible {
    opacity: 1;
    transform: translateY(0);
}

.product-category:last-child {
    margin-bottom: 0;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-light);
    position: relative;
}

.category-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-blue) 0%, var(--primary-orange) 100%);
    transition: width var(--transition-smooth);
}

.product-category.visible .category-header::after {
    width: 100px;
}

.category-icon {
    font-size: 26px;
    color: var(--primary-blue);
    transition: transform var(--transition-fast);
}

.category-header:hover .category-icon {
    transform: rotate(10deg) scale(1.1);
}

.category-icon.health {
    color: #e74c3c;
}

.category-icon.general {
    color: #27ae60;
}

.category-icon.govt {
    color: var(--primary-orange);
}

/* ========== Products Grid ========== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* ========== Product Card - Enhanced ========== */
.product-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 22px;
    text-align: center;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all var(--transition-smooth);
    cursor: pointer;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-blue) 0%, var(--primary-orange) 100%);
    transform: translateX(-100%);
    transition: transform var(--transition-smooth);
}

.product-card:hover::before {
    transform: translateX(0);
}

.product-category.visible .product-card {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Staggered animation for cards */
.product-category.visible .product-card:nth-child(1) { transition-delay: 0.05s; }
.product-category.visible .product-card:nth-child(2) { transition-delay: 0.1s; }
.product-category.visible .product-card:nth-child(3) { transition-delay: 0.15s; }
.product-category.visible .product-card:nth-child(4) { transition-delay: 0.2s; }
.product-category.visible .product-card:nth-child(5) { transition-delay: 0.25s; }
.product-category.visible .product-card:nth-child(6) { transition-delay: 0.3s; }
.product-category.visible .product-card:nth-child(7) { transition-delay: 0.35s; }
.product-category.visible .product-card:nth-child(8) { transition-delay: 0.4s; }
.product-category.visible .product-card:nth-child(9) { transition-delay: 0.45s; }
.product-category.visible .product-card:nth-child(10) { transition-delay: 0.5s; }

.product-card:hover {
    border-color: var(--primary-orange);
    box-shadow: var(--card-hover-shadow);
    transform: translateY(-4px) scale(1);
}

/* Focus state for accessibility */
.product-card:focus-within,
.card-focused {
    outline: 2px solid var(--primary-orange);
    outline-offset: 2px;
}

/* ========== Product Icon with Lazy Loading ========== */
.product-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 15px;
    background: rgba(36, 62, 147, 0.08);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-smooth);
    position: relative;
}

.lazy-icon .icon-placeholder {
    width: 20px;
    height: 20px;
    background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.lazy-icon.loaded .icon-placeholder {
    display: none;
}

.product-icon i {
    font-size: 22px;
    color: var(--primary-blue);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.lazy-icon.loaded i {
    opacity: 1;
}

.product-icon.health {
    background: rgba(231, 76, 60, 0.08);
}

.product-icon.health i {
    color: #e74c3c;
}

.product-icon.general {
    background: rgba(39, 174, 96, 0.08);
}

.product-icon.general i {
    color: #27ae60;
}

.product-icon.govt {
    background: rgba(243, 109, 33, 0.08);
}

.product-icon.govt i {
    color: var(--primary-orange);
}

.product-card:hover .product-icon {
    background: var(--primary-orange);
    transform: rotate(360deg);
}

.product-card:hover .product-icon i {
    color: white;
}

/* ========== Product Content ========== */
.product-name {
    font-family: 'Montserrat', sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 10px 0;
    line-height: 1.3;
    transition: color var(--transition-fast);
}

.product-card:hover .product-name {
    color: var(--primary-blue);
}

.product-description {
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: var(--text-light);
    margin: 0 0 18px 0;
    line-height: 1.5;
}

.product-link {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary-orange);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition-fast);
    position: relative;
}

.product-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--primary-orange);
    transition: width var(--transition-fast);
}

.product-link:hover::after {
    width: 100%;
}

.product-link:hover {
    color: var(--primary-blue);
    gap: 10px;
}

.product-link i {
    font-size: 11px;
    transition: transform var(--transition-fast);
}

.product-link:hover i {
    transform: translateX(3px);
}

/* ========== CTA Section ========== */
.products-cta {
    background: linear-gradient(135deg, var(--bg-light) 0%, #ffffff 100%);
    padding: 60px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.products-cta::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -10%;
    width: 30%;
    height: 200%;
    background: radial-gradient(circle, rgba(243, 109, 33, 0.05) 0%, transparent 70%);
    animation: float 15s infinite ease-in-out reverse;
}

.cta-content {
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

.cta-content p {
    font-size: 16px;
    color: var(--text-light);
    margin: 0 0 30px 0;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 35px;
    background: var(--primary-orange);
    color: white;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(243, 109, 33, 0.3);
}

.cta-button:hover {
    background: #e55a00;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(243, 109, 33, 0.4);
}

/* ========== Animations ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Responsive Design ========== */

/* Large Desktop - 5 columns */
@media (min-width: 1400px) {
    .products-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Desktop - 4 columns (default) */
@media (max-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Small Desktop - 3 columns */
@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
    
    .products-hero-title {
        font-size: 36px;
    }
    
    .category-title {
        font-size: 24px;
    }
    
    .cta-title {
        font-size: 28px;
    }
}

/* Tablet - 2 columns */
@media (max-width: 768px) {
    .products-hero {
        padding: 60px 0 40px;
    }
    
    .products-hero-title {
        font-size: 32px;
    }
    
    .products-hero-subtitle {
        font-size: 16px;
    }
    
    .products-main {
        padding: 40px 0;
    }
    
    .product-category {
        margin-bottom: 45px;
    }
    
    .category-title {
        font-size: 22px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .product-card {
        padding: 18px;
    }
    
    .product-icon {
        width: 45px;
        height: 45px;
    }
    
    .product-icon i {
        font-size: 20px;
    }
    
    .cta-title {
        font-size: 26px;
    }
}

/* Mobile - 2 columns maintained */
@media (max-width: 576px) {
    .container {
        padding: 0 15px;
    }
    
    .products-hero {
        padding: 50px 0 30px;
    }
    
    .products-hero-title {
        font-size: 28px;
        line-height: 1.3;
    }
    
    .products-hero-subtitle {
        font-size: 14px;
        padding: 0 10px;
    }
    
    .products-main {
        padding: 30px 0;
    }
    
    .product-category {
        margin-bottom: 35px;
    }
    
    .category-header {
        gap: 8px;
        margin-bottom: 18px;
        padding-bottom: 10px;
    }
    
    .category-icon {
        font-size: 20px;
    }
    
    .category-title {
        font-size: 18px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .product-card {
        padding: 14px;
    }
    
    .product-icon {
        width: 40px;
        height: 40px;
    }
    
    .product-icon i {
        font-size: 16px;
    }
    
    .product-name {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .product-description {
        font-size: 11px;
        margin-bottom: 12px;
    }
    
    .product-link {
        font-size: 12px;
    }
    
    .products-cta {
        padding: 40px 0;
    }
    
    .cta-title {
        font-size: 22px;
    }
    
    .cta-content p {
        font-size: 14px;
    }
    
    .cta-button {
        padding: 10px 25px;
        font-size: 14px;
    }
}

/* Very Small Mobile - Single column */
@media (max-width: 360px) {
    .products-hero {
        padding: 40px 0 24px;
    }
    
    .products-hero-title {
        font-size: 24px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .product-card {
        padding: 12px;
    }
    
    .category-title {
        font-size: 16px;
    }
    
    .cta-title {
        font-size: 20px;
    }
}

/* ========== Print Styles ========== */
@media print {
    .products-hero,
    .products-cta,
    .product-link i,
    .category-icon {
        display: none;
    }
    
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .product-card {
        border: 1px solid #ddd;
        break-inside: avoid;
        opacity: 1 !important;
        transform: none !important;
    }
    
    .title-primary,
    .title-accent {
        color: black !important;
    }
}

/* ========== Reduced Motion Support ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .product-card {
        opacity: 1;
        transform: none;
    }
}