/**
 * Button Module Styles
 * 
 * Configurable button module with dynamic styles
 * 
 * @package Clayutility
 * @version 1.0
 */

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

/* Background colors */
.button-module--bg-white-bg {
    background-color: var(--color-white-bg);
}

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

.button-module__inner {
    width: 100%;
}

.button-module__button-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    width: 100%;
}

/* Alignments */
.button-module__button-wrapper--left {
    justify-content: flex-start;
}

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

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

.button-module__button-item {
    flex-shrink: 0;
}

/* Pill-style button */
.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; /* Default medium */
    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;
}

/* Font sizes */
.button-module__button--font-small {
    font-size: 1rem;
}

.button-module__button--font-medium {
    font-size: 1.5rem;
}

.button-module__button--font-big {
    font-size: 2rem;
}

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

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

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

.button-module__button--type-1:hover {
    background: var(--color-magenta);
    color: var(--color-white);
    border-color: var(--color-magenta);
}

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

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

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

.button-module__button--type-3:hover {
    background: var(--color-magenta);
    color: var(--color-white);
    border-color: var(--color-magenta);
}

/* Type 4: Magenta background, white text, hover white background and magenta text */
.button-module__button--type-4 {
    background: var(--color-magenta);
    color: var(--color-white);
    border-color: var(--color-magenta);
}

.button-module__button--type-4:hover {
    background: var(--color-white);
    color: var(--color-magenta);
    border-color: var(--color-magenta);
}

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

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

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

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

/* Layout horizontal (lado a lado) - Desktop */
@media (min-width: 769px) {
    .button-module--two-buttons.button-module--buttons-layout-horizontal .button-module__button-wrapper {
        flex-direction: row;
    }

    .button-module--two-buttons.button-module--buttons-layout-horizontal .button-module__button-item {
        width: auto;
    }
}

/* Layout vertical (apilado) - Desktop */
@media (min-width: 769px) {
    .button-module--two-buttons.button-module--buttons-layout-vertical .button-module__button-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .button-module--two-buttons.button-module--buttons-layout-vertical .button-module__button-item {
        width: 100%;
    }

    /* Alignment within vertical layout */
    .button-module--align-left.button-module--buttons-layout-vertical .button-module__button-wrapper {
        align-items: flex-start;
    }

    .button-module--align-center.button-module--buttons-layout-vertical .button-module__button-wrapper {
        align-items: center;
    }

    .button-module--align-right.button-module--buttons-layout-vertical .button-module__button-wrapper {
        align-items: flex-end;
    }
}

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

    .button-module__button {
        font-size: 1.25rem; /* Default medium on mobile */
        width: 100%;
        white-space: normal;
    }

    /* Adjust font sizes on mobile proportionally */
    .button-module__button--font-small {
        font-size: 0.875rem;
    }

    .button-module__button--font-medium {
        font-size: 1.25rem;
    }

    .button-module__button--font-big {
        font-size: 1.75rem;
    }

    /* On mobile, when there are two buttons, always stack vertically */
    .button-module--two-buttons .button-module__button-wrapper {
        flex-direction: column;
    }

    .button-module--two-buttons .button-module__button-item {
        width: 100%;
    }

    /* On mobile, all alignments are centered */
    .button-module__button-wrapper--left,
    .button-module__button-wrapper--right {
        justify-content: center;
    }

    .button-module__button-wrapper--center .button-module__button {
        width: 100%;
    }

    /* For a single centered button, maintain automatic width */
    .button-module--one-button .button-module__button-wrapper--center .button-module__button {
        width: auto;
        min-width: 200px;
    }
}

