/* === CSS Reset & Base Styles === */
:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #212529;
    --muted-text-color: #6c757d;
    --border-color: #dee2e6;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    background-color: var(--background-color);
    color: var(--text-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* === Section & Typography === */
section {
    padding: 60px 0;
}

.section-title {
    text-align: center;
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 40px;
    color: var(--text-color);
}

h1, h2, h3, h4, h5 {
    line-height: 1.2;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: var(--primary-hover);
}

/* === Header === */
.header {
    background-color: var(--surface-color);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.main-nav a {
    font-weight: 500;
    color: var(--muted-text-color);
    position: relative;
    padding-bottom: 5px;
}

.main-nav a.active,
.main-nav a:hover {
    color: var(--primary-color);
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

.main-nav a.active::after,
.main-nav a:hover::after {
    width: 100%;
}


/* === Hero Section === */
.hero {
    background: linear-gradient(45deg, rgba(0, 123, 255, 0.05), rgba(0, 123, 255, 0));
    padding: 80px 0;
    text-align: center;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 2rem auto;
    color: var(--muted-text-color);
}

.hero-btn { margin-top: 1rem; }


/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.btn-secondary {
    background-color: var(--surface-color);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* === Calculator & Category Grids === */
.calculator-grid, .category-grid, .testimonial-grid {
    display: grid;
    gap: 1.5rem;
}

/* For larger screens */
@media (min-width: 768px) {
    .calculator-grid { grid-template-columns: repeat(2, 1fr); }
    .testimonial-grid { grid-template-columns: repeat(3, 1fr); }
    .category-grid { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
}
@media (min-width: 992px) {
    .calculator-grid { grid-template-columns: repeat(4, 1fr); }
}


/* === Cards === */
.calculator-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.calculator-card, .category-card, .testimonial-card {
    background-color: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.calculator-card-link:hover .calculator-card {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

.calculator-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: #fff;
}
.calculator-icon.financial { background-color: #007bff; }
.calculator-icon.investment { background-color: #28a745; }
.calculator-icon.health { background-color: #dc3545; }
.calculator-icon.math { background-color: #ffc107; }

.calculator-card h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.calculator-card p {
    color: var(--muted-text-color);
    flex-grow: 1; /* Pushes link to the bottom */
    margin-bottom: 1rem;
}

.calculator-link {
    font-weight: 600;
    color: var(--primary-color);
    align-self: flex-start;
}

.category-card h4 {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.category-card ul {
    list-style: none;
}

.category-card ul li {
    margin-bottom: 0.75rem;
}

/* === Testimonials === */
.testimonials {
    background-color: #e9ecef;
}

.testimonial-content {
    flex-grow: 1;
    margin-bottom: 1rem;
    font-style: italic;
    color: var(--muted-text-color);
}

.testimonial-content p {
    border-left: 3px solid var(--primary-color);
    padding-left: 1rem;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.author-info h5 { margin: 0; }
.author-info p { margin: 0; color: var(--muted-text-color); font-size: 0.9rem; }


/* === CTA Section === */
.cta {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: #fff;
    text-align: center;
}

.cta-content h2 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
}

.cta-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}
.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.cta .btn-primary {
    background: #fff;
    color: var(--primary-color);
}
.cta .btn-primary:hover {
    background: #eee;
}
.cta .btn-secondary {
    border-color: #fff;
    color: #fff;
}
.cta .btn-secondary:hover {
    background: #fff;
    color: var(--primary-color);
}


/* === Footer === */
.footer {
    background-color: #343a40;
    color: #adb5bd;
    padding: 40px 0 20px 0;
}

.footer-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.footer-column h4 {
    color: #fff;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}
.footer-column h5 {
    color: #f8f9fa;
    margin-bottom: 1rem;
}
.footer-column p {
    line-height: 1.7;
}
.footer-column ul {
    list-style: none;
}
.footer-column ul li {
    margin-bottom: 0.5rem;
}
.footer-column a {
    color: #adb5bd;
}
.footer-column a:hover {
    color: #fff;
    text-decoration: underline;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid #495057;
    padding-top: 20px;
    font-size: 0.9rem;
}

/* === Responsive Adjustments for Mobile === */
@media (max-width: 767px) {
    .section-title { font-size: 1.8rem; }
    .hero-content h1 { font-size: 2.2rem; }
    .testimonial-grid, .footer-grid { grid-template-columns: 1fr; }
    .header-content { flex-direction: column; gap: 1rem; }
    .main-nav ul { gap: 1rem; }
}