/**
 * Heading Module Styles
 * 
 * Módulo de encabezado configurable con estilos dinámicos
 * 
 * @package Clayutility
 * @version 1.0
 */

/* ===== Heading Module ===== */
.heading-module {
    padding: 40px 0;
    position: relative;
}

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

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

.heading-module__inner {
    width: 100%;
}

.heading-module__text-wrapper {
    width: 100%;
}

h1.heading-module__text {
    font-size: 3rem;
    font-weight: 700;
}

h2.heading-module__text {
    font-size: 2.5rem;
    font-weight: 700;
}

h3.heading-module__text {
    font-size: 1.5rem;
    font-weight: 700;
}

.heading-module__text {
    margin: 0;
    font-weight: normal;
    word-wrap: break-word;
    hyphens: auto;
    color: var(--color-black);
}

.heading-module--uppercase .heading-module__text {
    text-transform: uppercase;
}

/* Container for heading and button side by side */
.heading-module__content-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
}

.heading-module--button-left .heading-module__content-wrapper {
    flex-direction: row;
}

.heading-module--button-right .heading-module__content-wrapper {
    flex-direction: row;
}

.heading-module__button-wrapper {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: auto;
}

.heading-module__text-wrapper {
    width: 100%;
}

.heading-module--has-button .heading-module__content-wrapper .heading-module__text-wrapper {
    flex: 1 1 60%;
    max-width: 50%;
}

.heading-module--has-button .heading-module__content-wrapper .heading-module__button-wrapper {
    flex: 0 0 40%;
    max-width: 50%;
}

.heading-module--button-left .heading-module__button-wrapper {
    justify-content: flex-start;
}

.heading-module--button-right .heading-module__button-wrapper {
    justify-content: flex-end;
}

/* Pill-style button */
.heading-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: 1.5rem;
    font-weight: 600;
    line-height: 1.5;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.3s ease;
    white-space: normal;
    background: var(--color-blue);
    color: var(--color-white);
    padding: 12px 24px;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.heading-module__button--has-icon {
    justify-content: space-between;
}

.heading-module__button--uppercase {
    text-transform: uppercase;
}

.heading-module__button:hover {
    background: var(--color-white);
    color: var(--color-blue);
    border-color: var(--color-blue);
}

.heading-module__button:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

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

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

.heading-module__button-icon-image {
    max-height: 24px;
    width: auto;
}

/* Alineaciones */
.heading-module--align-left .heading-module__text {
    text-align: left;
}

.heading-module--align-center .heading-module__text {
    text-align: center;
}

.heading-module--align-right .heading-module__text {
    text-align: right;
}

/* Responsive Heading Module */
@media (max-width: 768px) {
    .heading-module {
        padding: 30px 0;
    }

    .heading-module__text {
        line-height: 1.3;
    }

    /* Ensure alignments are maintained on mobile */
    .heading-module--align-left .heading-module__text {
        text-align: left;
    }

    .heading-module--align-center .heading-module__text {
        text-align: center;
    }

    .heading-module--align-right .heading-module__text {
        text-align: right;
    }

    /* On mobile, button always below heading */
    .heading-module__content-wrapper {
        flex-direction: column !important;
        align-items: flex-start;
        gap: 16px;
        justify-content: flex-start;
    }

    .heading-module__button-wrapper {
        max-width: 100%;
        width: 100%;
        justify-content: flex-start;
    }

    .heading-module__button {
        width: 100%;
        white-space: normal;
    }

    /* Center button if heading is centered */
    .heading-module--align-center .heading-module__button-wrapper {
        display: flex;
        justify-content: center;
    }

    .heading-module--align-center .heading-module__button {
        width: auto;
    }

    .heading-module--has-button .heading-module__content-wrapper .heading-module__text-wrapper {
        max-width: 100%;
    }

    .heading-module--has-button .heading-module__content-wrapper .heading-module__button-wrapper {
        max-width: 100%;
    }
}