/**
 * Columns Module Styles
 * 
 * @package Clayutility
 * @version 1.0
 */

/* ===== Columns Module ===== */
.columns-module {
    padding: 22px 0;
    position: relative;
}

.columns-module--bg-white-bg {
    background-color: var(--color-white-bg);
}

.columns-module--bg-white {
    background-color: var(--color-white);
}

.columns-module__wrapper {
    padding: 0;
}

.columns-module__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: 3.5rem;
    text-align: center;
}

.columns-module__list {
    display: grid;
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
    /* Column distribution is controlled by dynamic classes added by JavaScript */
    /* JavaScript detects the number of columns and adds the corresponding class (--columns-1 to --columns-5) */
}

/* Dynamic column distribution based on quantity (added by JavaScript) */
.columns-module__list--columns-1 {
    grid-template-columns: 1fr;
}

.columns-module__list--columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

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

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

.columns-module__list--columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.columns-module .column {
    background: var(--color-white);
    padding: 35px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: 30px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

/* When section background is white, columns use white-bg */
.columns-module.columns-module--bg-white .column {
    background: var(--color-white-bg);
}

.columns-module .column:hover {
    transform: translateY(-2px);
    background: var(--color-blue);
    color: var(--color-white);
}

/* Links turn white when column is hovered */
.columns-module .column:hover a {
    color: #fff !important;
}

.columns-module .column__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.columns-module .column__icon img {
    max-width: 80px;
    max-height: 80px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.columns-module .column__title {
    margin: 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-black);
    transition: color 0.2s ease;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.columns-module .column__title--left {
    text-align: left;
}

.columns-module .column__title--center {
    text-align: center;
}

.columns-module .column__title--right {
    text-align: right;
}

.columns-module .column__content {
    color: var(--color-gray-600);
    margin: 0 0 .3rem;
    transition: color 0.2s ease;
    overflow-wrap: anywhere;
    word-break: break-word;
    flex: 1 1 auto; /* Pushes button wrapper to the bottom */
}

/* Links default: BLACK */
.columns-module .column__content a {
    color: #000;
    transition: color 0.2s ease;
}

.columns-module .column__content p {
    margin: 0 0 1rem 0;
}

.columns-module .column__content p:last-child {
    margin-bottom: 0;
}

/* Links inside column__content */
.columns-module .column__content a {
    text-decoration: none;
}

.columns-module .column:hover .column__title,
.columns-module .column:hover .column__content {
    color: var(--color-white);
}

/* Links on column hover */
.columns-module .column:hover .column__content a {
    color: var(--color-white);
}

/* Button Wrapper inside the column */
.columns-module__button-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    margin-top: auto; /* Pins button to bottom of card */
}

.columns-module__button-wrapper--left {
    justify-content: flex-start;
}

.columns-module__button-wrapper--center {
    justify-content: center;
}

.columns-module__button-wrapper--right {
    justify-content: flex-end;
}

/* Button styles (reused from button module) */
.columns-module .button-module__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    border-radius: 50px;
    border: 2px solid transparent;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: normal;
    padding: 12px 24px;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.columns-module .button-module__button--has-icon {
    justify-content: space-between;
}

.columns-module .button-module__button--uppercase {
    text-transform: uppercase;
}

/* Type 1: Blue background, white text, hover magenta background */
.columns-module .button-module__button--type-1 {
    background: var(--color-blue);
    color: var(--color-white);
    border: 2px solid var(--color-white);
}

.columns-module .button-module__button--type-1:hover {
    background: var(--color-magenta);
    color: var(--color-white);
    border: 2px solid var(--color-white);
}

/* Type 2: Blue background, white text, hover white background and blue text */
.columns-module .button-module__button--type-2 {
    background: var(--color-blue);
    color: var(--color-white);
    border: 2px solid var(--color-white);
}

.columns-module .button-module__button--type-2:hover {
    background: var(--color-white);
    color: var(--color-blue);
    border: 2px solid var(--color-blue);
}

/* Type 3: White background, blue text, hover magenta background and white text */
.columns-module .button-module__button--type-3 {
    background: var(--color-white);
    color: var(--color-blue);
    border: 2px solid var(--color-blue);
}

.columns-module .button-module__button--type-3:hover {
    background: var(--color-magenta);
    color: var(--color-white);
    border: 2px solid var(--color-white);
}

/* Focus states for accessibility */
.columns-module .button-module__button:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.columns-module .button-module__button-text {
    display: inline-flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

.columns-module .button-module__button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.columns-module .button-module__button-icon-image {
    max-height: 24px;
    width: auto;
}

/* Responsive Columns Module */
@media (max-width: 1366px) {
    .columns-module__list {
        gap: 12px;
    }
}

@media (max-width: 1100px) {

    /* Reduce columns on tablet */
    .columns-module__list--columns-5,
    .columns-module__list--columns-4 {
        grid-template-columns: repeat(3, 1fr);
    }

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

    .columns-module__list--columns-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .columns-module__list--columns-1 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .columns-module__list {
        gap: 25px;
    }

    /* Reduce to 2 columns on large mobile */
    .columns-module__list--columns-5,
    .columns-module__list--columns-4,
    .columns-module__list--columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .columns-module__list--columns-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .columns-module__list--columns-1 {
        grid-template-columns: 1fr;
    }

    /*
    .columns-module__list--columns-5 .columns-module__item:last-child:nth-child(odd),
    .columns-module__list--columns-4 .columns-module__item:last-child:nth-child(odd),
    .columns-module__list--columns-3 .columns-module__item:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        justify-self: center;
        max-width: calc(50% - 5px);
    }
	*/
}

@media (max-width: 480px) {
    .columns-module__list {
        /* Single column on small mobile */
        grid-template-columns: 1fr !important;
    }

    .columns-module .button-module__button {
        font-size: 1.25rem;
        width: 100%;
    }

    .columns-module__button-wrapper--left,
    .columns-module__button-wrapper--right {
        justify-content: center;
    }

    .columns-module__button-wrapper--center .button-module__button {
        width: auto;
        min-width: 200px;
    }

    /* Center button text on mobile */
    .columns-module .button-module__button-text {
        text-align: center;
        justify-content: center;
    }
}