/* =========================================================
   ToolZen Hub
   Categories + Popular Calculators
========================================================= */


/* =========================================================
   Shared Section
========================================================= */

.categories-section,
.popular-section {
    width: 100%;

    box-sizing: border-box;

    overflow-x: hidden;
}


/* =========================================================
   Categories Section
========================================================= */

.categories-section {
    padding-top: 22px;
    padding-bottom: 20px;

    background: #ffffff;
}


/* =========================================================
   Popular Section
========================================================= */

.popular-section {
    padding-top: 0;
    padding-bottom: 22px;

    background: #f7fbf9;
}


/* =========================================================
   Section Header
========================================================= */

.section-header {
    width: 100%;

    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 14px;

    min-width: 0;
}


/* =========================================================
   Section Title
========================================================= */

.section-title {
    margin: 0;

    color: #101828;

    font-size: 18px;

    font-weight: 750;

    line-height: 1.3;

    letter-spacing: -0.3px;

    min-width: 0;
}


/* =========================================================
   Section Link
========================================================= */

.section-link {
    display: inline-flex;

    align-items: center;

    gap: 6px;

    flex-shrink: 0;

    color: #087d46;

    font-size: 13px;

    font-weight: 600;

    text-decoration: none;

    transition:
        color 0.2s ease,
        gap 0.2s ease;
}


.section-link:hover {
    color: #056438;

    gap: 9px;
}


/* =========================================================
   Category Grid
========================================================= */

.category-grid {
    width: 100%;
    max-width: 100%;

    display: grid;

    grid-template-columns:
        repeat(8, minmax(0, 1fr));

    gap: 14px;

    box-sizing: border-box;

    min-width: 0;
}


/* =========================================================
   Category Card
========================================================= */

.category-card {
    min-width: 0;
    max-width: 100%;

    min-height: 124px;

    display: flex;

    flex-direction: column;

    box-sizing: border-box;

    padding: 12px;

    border: 1px solid #e7ecea;

    border-radius: 12px;

    background: #ffffff;

    box-shadow:
        0 2px 7px rgba(16, 24, 40, 0.035);

    color: inherit;

    text-decoration: none;

    overflow: hidden;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


.category-card:hover {
    transform: translateY(-2px);

    border-color: #cfe8dc;

    box-shadow:
        0 7px 18px rgba(16, 24, 40, 0.07);
}


/* =========================================================
   Category Icon
========================================================= */

.category-card__icon {
    width: 38px;
    height: 38px;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    margin-bottom: 9px;

    border-radius: 10px;

    font-size: 20px;
}


/* =========================================================
   Category Icon Colors
========================================================= */

.category-card__icon--loans {
    background: #e9f8e9;
    color: #159447;
}

.category-card__icon--investment {
    background: #e6f6ed;
    color: #0b9f58;
}

.category-card__icon--tax {
    background: #eee8ff;
    color: #7047d9;
}

.category-card__icon--health {
    background: #ffe8f0;
    color: #e23d75;
}

.category-card__icon--business {
    background: #e5f2ff;
    color: #2475c7;
}

.category-card__icon--math {
    background: #fff4df;
    color: #c88a12;
}

.category-card__icon--converter {
    background: #e3f7f4;
    color: #158c7d;
}

.category-card__icon--more {
    background: #edf1f5;
    color: #496277;
}


/* =========================================================
   Category Content
========================================================= */

.category-card__content {
    min-width: 0;

    max-width: 100%;

    overflow: hidden;
}


.category-card h3 {
    margin: 0 0 6px;

    color: #101828;

    font-size: 13px;

    font-weight: 700;

    line-height: 1.3;

    overflow-wrap: anywhere;
}


.category-card p {
    margin: 0;

    color: #475467;

    font-size: 11px;

    line-height: 1.45;

    overflow-wrap: anywhere;
}


/* =========================================================
   Calculator Grid
========================================================= */

.calculator-grid {
    width: 100%;
    max-width: 100%;

    display: grid;

    grid-template-columns:
        repeat(6, minmax(0, 1fr));

    gap: 14px;

    box-sizing: border-box;

    min-width: 0;
}


/* =========================================================
   Calculator Card
========================================================= */

.calculator-card {
    position: relative;

    min-width: 0;
    max-width: 100%;

    min-height: 108px;

    display: flex;

    align-items: flex-start;

    box-sizing: border-box;

    padding: 13px;

    border: 1px solid #e5ebe8;

    border-radius: 12px;

    background: #ffffff;

    color: inherit;

    text-decoration: none;

    box-shadow:
        0 2px 7px rgba(16, 24, 40, 0.035);

    overflow: hidden;

    transition:
        transform 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}


.calculator-card:hover {
    transform: translateY(-2px);

    border-color: #cfe8dc;

    box-shadow:
        0 7px 18px rgba(16, 24, 40, 0.07);
}


/* =========================================================
   Calculator Icon
========================================================= */

.calculator-card__icon {
    width: 38px;
    height: 38px;

    display: flex;

    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    margin-right: 10px;

    border-radius: 10px;

    font-size: 20px;
}


/* =========================================================
   Calculator Icon Colors
========================================================= */

.calculator-card__icon--green {
    background: #eaf8df;
    color: #3a9a40;
}

.calculator-card__icon--blue {
    background: #e6f2ff;
    color: #2675c5;
}

.calculator-card__icon--yellow {
    background: #fff4d8;
    color: #b98208;
}

.calculator-card__icon--purple {
    background: #eee7ff;
    color: #7047d9;
}

.calculator-card__icon--pink {
    background: #ffe8ef;
    color: #db4774;
}

.calculator-card__icon--teal {
    background: #e2f7f4;
    color: #178c7d;
}


/* =========================================================
   Calculator Content
========================================================= */

.calculator-card__content {
    min-width: 0;

    max-width: 100%;

    padding-right: 20px;

    overflow: hidden;
}


.calculator-card h3 {
    margin: 1px 0 5px;

    color: #101828;

    font-size: 12px;

    font-weight: 700;

    line-height: 1.35;

    overflow-wrap: anywhere;
}


.calculator-card p {
    margin: 0;

    color: #475467;

    font-size: 10px;

    line-height: 1.45;

    overflow-wrap: anywhere;
}


/* =========================================================
   Calculator Arrow
========================================================= */

.calculator-card__arrow {
    position: absolute;

    right: 12px;
    bottom: 10px;

    color: #0b9f58;

    font-size: 20px;

    line-height: 1;

    transition:
        transform 0.2s ease;
}


.calculator-card:hover .calculator-card__arrow {
    transform: translateX(3px);
}


/* =========================================================
   Large Desktop
========================================================= */

@media (min-width: 1200px) {

    .categories-section {
        padding-top: 22px;
        padding-bottom: 20px;
    }


    .popular-section {
        padding-bottom: 24px;
    }


    .category-grid,
    .calculator-grid {
        gap: 16px;
    }


    .category-card {
        min-height: 126px;

        padding: 13px;
    }


    .calculator-card {
        min-height: 110px;

        padding: 14px;
    }

}


/* =========================================================
   Tablet
========================================================= */

@media (max-width: 1100px) {

    .category-grid {
        grid-template-columns:
            repeat(4, minmax(0, 1fr));
    }


    .calculator-grid {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }

}


/* =========================================================
   Small Tablet
========================================================= */

@media (max-width: 760px) {

    .category-grid {
        display: flex;

        width: 100%;
        max-width: 100%;

        overflow-x: auto;

        gap: 12px;

        padding-bottom: 6px;

        scroll-snap-type: x proximity;

        scrollbar-width: thin;

        box-sizing: border-box;
    }


    .category-card {
        flex: 0 0 170px;

        max-width: 170px;

        scroll-snap-align: start;
    }


    .calculator-grid {
        display: flex;

        width: 100%;
        max-width: 100%;

        overflow-x: auto;

        gap: 12px;

        padding-bottom: 6px;

        scroll-snap-type: x proximity;

        scrollbar-width: thin;

        box-sizing: border-box;
    }


    .calculator-card {
        flex: 0 0 250px;

        max-width: 250px;

        scroll-snap-align: start;
    }

}


/* =========================================================
   Mobile
========================================================= */

@media (max-width: 600px) {

    .categories-section {
        padding-top: 18px;
        padding-bottom: 16px;
    }


    .popular-section {
        padding-top: 0;
        padding-bottom: 18px;
    }


    .section-header {
        margin-bottom: 12px;

        min-width: 0;
    }


    .section-title {
        font-size: 17px;

        min-width: 0;
    }


    .section-link {
        font-size: 11px;

        flex-shrink: 0;
    }


    .category-grid,
    .calculator-grid {
        gap: 10px;

        margin-right: 0 !important;

        padding-right: 0 !important;

        max-width: 100%;

        box-sizing: border-box;
    }


    .category-card {
        flex-basis: 160px;

        min-height: 118px;

        padding: 11px;

        max-width: 160px;
    }


    .calculator-card {
        flex-basis: 245px;

        min-height: 104px;

        padding: 12px;

        max-width: 245px;
    }

}


/* =========================================================
   Very Small Mobile
========================================================= */

@media (max-width: 380px) {

    .section-title {
        font-size: 16px;
    }


    .section-link {
        font-size: 10px;
    }


    .category-card {
        flex-basis: 150px;

        max-width: 150px;
    }


    .calculator-card {
        flex-basis: 230px;

        max-width: 230px;
    }

}


/* =========================================================
   FINAL MOBILE EDGE SAFETY
   Prevent accidental viewport overflow
========================================================= */

@media (max-width: 600px) {

    .categories-section,
    .popular-section {
        width: 100%;
        max-width: 100%;

        margin-left: 0;
        margin-right: 0;

        overflow-x: hidden;
    }


    .category-grid,
    .calculator-grid {
        width: 100%;
        max-width: 100%;

        min-width: 0;
    }


    .category-card,
    .calculator-card {
        box-sizing: border-box;

        min-width: 0;
    }

}
