@import "../../../base/less/mixins";

@responsive_breakpoint: 780px;
@align: center;
@mobile_align: center;

@button_width: '';
@button_color: #41a9d5;
@border_color: darken(@button_color, 5%);
@text_color: #FFFFFF;
@icon_size: 1.3em;

@hover_background_color: #41a9d5;
@hover_text_color:  #FFFFFF;

@button_font: default;
@button_font_weight: default;
@button_font_style: default;

@font_size: 1em;
@rounding: 0.25em;
@padding: 1em;
@has_text: true;
@has_button_icon: false;

.ow-button-base {
	.clearfix();

	@media (max-width: @responsive_breakpoint) {
		&.ow-button-align-@{align} {
			text-align: @mobile_align;

			& when not ( @mobile_align = justify ) {
				&.ow-button-align-justify .sowb-button {
					display: inline-block;
				}
			}

			& when ( @mobile_align = justify ) {
				.sowb-button {
					display: block;
				}
			}
		}
	}

	.sowb-button {
		.box-sizing(border-box);
		.font(@button_font, @button_font_weight);
		.rounded(@rounding);
		background: @button_color;
		border-width: 1px 0;
		border: 1px solid @button_color;
		color: @text_color !important;
		font-size: @font_size;
		font-style: @button_font_style;
		padding: @padding;
		text-shadow: 0 1px 0 rgba(0,0,0,0.05);

		& when( isnumber( @button_width ) ) {
			width: @button_width;
			max-width: 100%;
		}

		& when ( @has_text = true ) {
			padding-inline: @padding * 2;
		}

		& when not ( @has_text = true ) {
			.sow-icon-image,
			[class^="sow-icon-"] {
				margin: 0;
			}
		}

		& when ( @has_button_icon = true ) {
			& > span {
				display: flex;
				justify-content: center;

				[class^="sow-icon-"] {
					font-size: @icon_size;
				}
			}

			&.ow-icon-placement-top > span {
				flex-direction: column;
			}

			&.ow-icon-placement-right > span {
				flex-direction: row-reverse;
			}

			&.ow-icon-placement-bottom > span {
				flex-direction: column-reverse;
			}

			&.ow-icon-placement-left > span {
				align-items: start;
			}
		}

		&.ow-button-hover:active,
		&.ow-button-hover:hover {
			background: lighten(@hover_background_color, 4%);
			border-color: lighten(@hover_background_color, 4%);
			color: @hover_text_color !important;
		}
	}
}
