/* ==========================================================
   BUTTONS
   SOSMedical Design System
========================================================== */

/*
|--------------------------------------------------------------------------
| Base
|--------------------------------------------------------------------------
*/

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    min-height: 48px;
    padding: 13px 24px;

    color: var(--primary);
    font-family: var(--font-title);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;

    cursor: pointer;
    user-select: none;

    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);

    transition:
        color var(--transition),
        background-color var(--transition),
        border-color var(--transition),
        box-shadow var(--transition),
        transform var(--transition),
        opacity var(--transition);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus-visible {
    outline: 3px solid rgba(0, 153, 216, 0.22);
    outline-offset: 3px;
}

.btn:disabled,
.btn.is-disabled {
    cursor: not-allowed;
    opacity: 0.55;
    pointer-events: none;
    transform: none;
}

/*
|--------------------------------------------------------------------------
| Primary
|--------------------------------------------------------------------------
*/

.btn--primary {
    color: var(--white);
    background: var(--secondary);
    border-color: var(--secondary);
    box-shadow: 0 10px 24px rgba(0, 153, 216, 0.22);
}

.btn--primary:hover {
    color: var(--white);
    background: #0087c0;
    border-color: #0087c0;
    box-shadow: 0 14px 32px rgba(0, 153, 216, 0.3);
}

/*
|--------------------------------------------------------------------------
| Dark
|--------------------------------------------------------------------------
*/

.btn--dark {
    color: var(--white);
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 10px 24px rgba(11, 35, 65, 0.2);
}

.btn--dark:hover {
    color: var(--white);
    background: var(--primary-light);
    border-color: var(--primary-light);
    box-shadow: 0 14px 32px rgba(11, 35, 65, 0.28);
}

/*
|--------------------------------------------------------------------------
| Success
|--------------------------------------------------------------------------
*/

.btn--success {
    color: var(--white);
    background: var(--success);
    border-color: var(--success);
    box-shadow: 0 10px 24px rgba(0, 182, 122, 0.2);
}

.btn--success:hover {
    color: var(--white);
    background: #009d69;
    border-color: #009d69;
    box-shadow: 0 14px 32px rgba(0, 182, 122, 0.28);
}

/*
|--------------------------------------------------------------------------
| Outline
|--------------------------------------------------------------------------
*/

.btn--outline {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(11, 35, 65, 0.18);
}

.btn--outline:hover {
    color: var(--secondary);
    background: var(--white);
    border-color: var(--secondary);
    box-shadow: var(--shadow-sm);
}

.btn--outline-light {
    color: var(--white);
    background: transparent;
    border-color: rgba(255, 255, 255, 0.42);
}

.btn--outline-light:hover {
    color: var(--primary);
    background: var(--white);
    border-color: var(--white);
}

/*
|--------------------------------------------------------------------------
| Ghost
|--------------------------------------------------------------------------
*/

.btn--ghost {
    color: var(--primary);
    background: transparent;
    border-color: transparent;
}

.btn--ghost:hover {
    color: var(--secondary);
    background: rgba(0, 153, 216, 0.08);
}

/*
|--------------------------------------------------------------------------
| Link
|--------------------------------------------------------------------------
*/

.btn--link {
    min-height: auto;
    padding: 4px 0;

    color: var(--secondary);
    background: transparent;
    border: 0;
    border-radius: 0;
}

.btn--link::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;

    height: 1px;

    content: "";
    background: currentColor;

    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
}

.btn--link:hover {
    color: var(--primary);
    transform: none;
}

.btn--link:hover::after {
    transform: scaleX(1);
}

/*
|--------------------------------------------------------------------------
| Sizes
|--------------------------------------------------------------------------
*/

.btn--sm {
    min-height: 40px;
    padding: 10px 18px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn--lg {
    min-height: 56px;
    padding: 16px 30px;
    font-size: 15px;
}

.btn--xl {
    min-height: 64px;
    padding: 19px 36px;
    font-size: 16px;
    border-radius: 18px;
}

/*
|--------------------------------------------------------------------------
| Width
|--------------------------------------------------------------------------
*/

.btn--block {
    width: 100%;
}

/*
|--------------------------------------------------------------------------
| Rounded
|--------------------------------------------------------------------------
*/

.btn--pill {
    border-radius: 999px;
}

/*
|--------------------------------------------------------------------------
| Icon
|--------------------------------------------------------------------------
*/

.btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn__icon svg {
    width: 1.2em;
    height: 1.2em;
}

.btn--icon {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border-radius: 50%;
}

.btn--icon.btn--sm {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
}

.btn--icon.btn--lg {
    width: 56px;
    min-width: 56px;
    height: 56px;
    min-height: 56px;
}

/*
|--------------------------------------------------------------------------
| Arrow animation
|--------------------------------------------------------------------------
*/

.btn__arrow {
    display: inline-flex;
    transition: transform var(--transition);
}

.btn:hover .btn__arrow {
    transform: translateX(4px);
}

/*
|--------------------------------------------------------------------------
| Loading
|--------------------------------------------------------------------------
*/

.btn.is-loading {
    color: transparent;
    pointer-events: none;
}

.btn.is-loading::after {
    position: absolute;

    width: 18px;
    height: 18px;

    content: "";

    border: 2px solid rgba(255, 255, 255, 0.38);
    border-top-color: var(--white);
    border-radius: 50%;

    animation: button-spin 0.75s linear infinite;
}

.btn--outline.is-loading::after,
.btn--ghost.is-loading::after {
    border-color: rgba(0, 153, 216, 0.25);
    border-top-color: var(--secondary);
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

/*
|--------------------------------------------------------------------------
| Button groups
|--------------------------------------------------------------------------
*/

.btn-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/*
|--------------------------------------------------------------------------
| Responsive
|--------------------------------------------------------------------------
*/

@media (max-width: 576px) {
    .btn-group--mobile-block {
        align-items: stretch;
        flex-direction: column;
    }

    .btn-group--mobile-block .btn {
        width: 100%;
    }

    .btn--xl {
        min-height: 56px;
        padding: 16px 26px;
        font-size: 15px;
    }
}

/*
|--------------------------------------------------------------------------
| Reduced motion
|--------------------------------------------------------------------------
*/

@media (prefers-reduced-motion: reduce) {
    .btn,
    .btn__arrow {
        transition: none;
    }

    .btn:hover {
        transform: none;
    }
}