/* 
 * content-sections.css
 * Styles for main content sections (tools, articles, testimonials)
 */

/* Tools Section with browser fixes */
.tools-section {
    padding: 80px 0;
    background-color: white;
    position: relative; /* Create new stacking context for IE */
    -webkit-transform: translateZ(0); /* Fix for Safari flickering */
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    -o-transform: translateZ(0);
    transform: translateZ(0);
}

/* Modern grid layout with flexbox fallback */
.tools-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    margin: -15px;
}

@supports (display: grid) {
    .tools-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
        margin: 0;
    }
}

.tool-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    -webkit-transition: -webkit-transform 0.3s, box-shadow 0.3s;
    transition: -webkit-transform 0.3s, box-shadow 0.3s;
    transition: transform 0.3s, box-shadow 0.3s;
    transition: transform 0.3s, box-shadow 0.3s, -webkit-transform 0.3s;
    
    /* Flex fallback */
    -webkit-box-flex: 0;
    -ms-flex: 0 0 calc(33.333% - 30px);
    flex: 0 0 calc(33.333% - 30px);
    margin: 15px;
}

@supports (display: grid) {
    .tool-card {
        margin: 0;
    }
}

.tool-card:hover {
    -webkit-transform: translateY(-10px);
    transform: translateY(-10px);
    -webkit-box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.tool-card img {
    width: 100%;
    height: 180px;
    -o-object-fit: cover;
    object-fit: cover;
    display: block;
}

.tool-content {
    padding: 25px;
}

.tool-content h3 {
    font-size: clamp(1.125rem, 2vw, 1.375rem);
    margin-bottom: 0.9375rem;
    color: #003366;
}

.tool-content p {
    margin-bottom: 1.25rem;
    color: #666;
    font-size: 1rem;
}

.tool-cta {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    background-color: #0056b3;
    color: white;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.9375rem;
    -webkit-transition: background-color 0.3s;
    transition: background-color 0.3s;
    cursor: pointer;
}

.tool-cta:hover {
    background-color: #003d7a;
    color: white;
}

/* Affiliate Section with flexbox for all browsers */
.affiliate-banner {
    background-color: #f1f8ff;
    padding: 30px;
    margin: 40px 0;
    border-radius: 8px;
    border-left: 5px solid #ff6600;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.affiliate-content {
    -webkit-box-flex: 1;
    -ms-flex: 1 1 300px;
    flex: 1 1 300px;
    padding-right: 20px;
}

.affiliate-content h3 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
    margin-bottom: 10px;
    color: #003366;
}

.affiliate-cta {
    background-color: #ff6600;
    color: white;
    padding: 15px 25px;
    border-radius: 5px;
    font-weight: bold;
    -webkit-transition: background-color 0.3s;
    transition: background-color 0.3s;
    display: inline-block;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    margin-top: 10px;
}

.affiliate-cta:hover {
    background-color: #e65c00;
    color: white;
}

/* Featured Articles with grid and flexbox fallback */
.articles-section {
    padding: 80px 0;
    background-color: #f7f9fc;
}

.articles-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    margin: -15px;
}

@supports (display: grid) {
    .articles-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 30px;
        margin: 0;
    }
}

.article-card {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    -webkit-transition: -webkit-transform 0.3s, box-shadow 0.3s;
    transition: -webkit-transform 0.3s, box-shadow 0.3s;
    transition: transform 0.3s, box-shadow 0.3s;
    transition: transform 0.3s, box-shadow 0.3s, -webkit-transform 0.3s;
    
    /* Flex fallback */
    -webkit-box-flex: 0;
    -ms-flex: 0 0 calc(33.333% - 30px);
    flex: 0 0 calc(33.333% - 30px);
    margin: 15px;
}

@supports (display: grid) {
    .article-card {
        margin: 0;
    }
}

.article-card:hover {
    -webkit-transform: translateY(-5px);
    transform: translateY(-5px);
    -webkit-box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
}

.article-card img {
    width: 100%;
    height: 200px;
    -o-object-fit: cover;
    object-fit: cover;
    display: block;
}

.article-content {
    padding: 25px;
}

.article-date {
    font-size: 14px;
    color: #888;
    margin-bottom: 10px;
    display: block;
}

.article-content h3 {
    font-size: clamp(1.125rem, 2vw, 1.25rem);
    margin-bottom: 15px;
    color: #003366;
}

.article-content p {
    margin-bottom: 20px;
    color: #666;
}

.article-read-more {
    display: inline-block;
    color: #0056b3;
    font-weight: bold;
}

.article-read-more:hover {
    color: #003d7a;
}

.view-all-articles {
    display: block;
    text-align: center;
    margin-top: 40px;
}

/* Testimonials with improved layout for all devices */
.testimonials-section {
    padding: 80px 0;
    background-color: #003366;
    color: white;
}

.testimonials-section .section-title,
.testimonials-section .section-subtitle {
    color: white;
}

.testimonials-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    margin: -15px;
}

@supports (display: grid) {
    .testimonials-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
        margin: 0;
    }
}

.testimonial-card {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 8px;
    position: relative;
    
    /* Flex fallback */
    -webkit-box-flex: 0;
    -ms-flex: 0 0 calc(33.333% - 30px);
    flex: 0 0 calc(33.333% - 30px);
    margin: 15px;
}

@supports (display: grid) {
    .testimonial-card {
        margin: 0;
    }
}

.testimonial-card::before {
    content: """;
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 60px;
    color: rgba(255, 255, 255, 0.2);
    font-family: Georgia, serif;
    line-height: 1;
}

.testimonial-text {
    font-style: italic;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.testimonial-author {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.testimonial-author img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
    -o-object-fit: cover;
    object-fit: cover;
}

.author-details h4 {
    font-size: 18px;
    margin-bottom: 5px;
}

.author-details p {
    font-size: 14px;
    opacity: 0.8;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .tool-card, 
    .article-card, 
    .testimonial-card {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 calc(50% - 30px);
        flex: 0 0 calc(50% - 30px);
    }
    
    @supports (display: grid) {
        .tools-grid, 
        .articles-grid, 
        .testimonials-grid {
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        }
        
        .tool-card, 
        .article-card, 
        .testimonial-card {
            -webkit-box-flex: initial;
            -ms-flex: initial;
            flex: initial;
        }
    }
}

@media (max-width: 992px) {
    .tools-section, 
    .articles-section, 
    .testimonials-section {
        padding: 60px 0;
    }
}

@media (max-width: 768px) {
    .tool-card, 
    .article-card, 
    .testimonial-card {
        -webkit-box-flex: 0;
        -ms-flex: 0 0 100%;
        flex: 0 0 100%;
    }
    
    .affiliate-banner {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .affiliate-content {
        padding-right: 0;
        margin-bottom: 20px;
    }
    
    .affiliate-cta {
        width: 100%;
        display: block;
        margin-left: 0;
    }
}

@media (max-width: 576px) {
    .tools-section, 
    .articles-section, 
    .testimonials-section {
        padding: 50px 0;
    }
    
    .tool-card img,
    .article-card img {
        height: 160px;
    }
    
    .tool-content,
    .article-content {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .testimonial-card::before {
        font-size: 40px;
    }
}

/* For print */
@media print {
    .tools-section, 
    .articles-section,
    .testimonials-section,
    .affiliate-banner {
        padding: 20px 0;
    }
    
    .tool-cta,
    .affiliate-cta,
    .article-read-more,
    .view-all-articles {
        display: none;
    }
}