/* Category Icons and Titles */
.category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background-color: rgba(26, 115, 232, 0.1);
    border-radius: 50%;
    margin-bottom: 1.5rem;
    margin-right: 1.5rem;
    float: none; /* Changed from float: left to prevent text wrapping issues */
}

.category-header {
    display: flex; /* Changed to flexbox for better control */
    flex-direction: column;
    width: 100%;
    overflow: visible; /* Changed from hidden to prevent text clipping */
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e8eaed;
}

.category-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #1a73e8;
    margin-bottom: 1.5rem;
    display: block;
    padding-top: 0.5rem;
    padding-left: 75px; /* Add left padding to align with icon */
    margin-top: -70px; /* Pull up to align with icon */
}

.category-description {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
    color: #5f6368;
    max-width: 100%;
    display: block;
    padding-left: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-top: 1.5rem; /* Increased space above the description */
    clear: both; /* Ensure it starts on a new line */
}

/* Fix for category sections - prevent text overlap */
.calculator-category {
    margin-bottom: 5rem; /* Increased from 4rem for more separation */
    padding-bottom: 2rem;
    clear: both; /* Ensure each category starts on a new line */
    overflow: visible; /* Changed from hidden to prevent text clipping */
    position: relative; /* Added for better positioning control */
}

/* Add more space between categories */
.calculator-category + .calculator-category {
    margin-top: 4rem; /* Increased from 3rem */
    padding-top: 2rem; /* Increased from 1rem */
    border-top: 1px solid #f1f3f4; /* Added subtle separator */
}

/* Category Grid Layout */
.category-calculators {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 0.5rem; /* Reduced from 1rem for less space between columns */
    width: 100%;
    max-width: 100%;
    padding: 0 0.25rem; /* Reduced padding for better alignment */
    margin-top: 2rem; /* Added space after description */
}

@media (min-width: 576px) {
    .category-calculators {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem; /* Consistent minimal gap */
    }
}

@media (min-width: 768px) {
    .category-calculators {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem; /* Slightly larger but still small gap for medium screens */
    }
}

@media (min-width: 992px) {
    .category-calculators {
        grid-template-columns: repeat(4, 1fr); /* Changed to 4 columns on larger screens */
        gap: 0.75rem; /* Consistent small gap */
    }
}

@media (min-width: 1200px) {
    .category-calculators {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.75rem; /* Consistent small gap */
    }
}

/* Alternative layout for category sections */
.calculator-category-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 3rem;
}

.category-header-flex {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.category-content {
    display: flex;
    flex-direction: column;
    margin-left: 1rem;
}

/* Fix for text overflow in calculator cards */
.calculator-card h3,
.calculator-card p {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
}
