
@st-namespace 'SectionNotification-st-css';
@st-import [ --wix-color-5, --wix-color-1 ] from '@wix/tpa-style-webpack-plugin/stylable-variables.st.css';
@st-import [ createColor ] from '../../common/formatters.st';
@st-import [ errorColor-rgb ] from '../../common/palette.st.css';
@st-import [ fontFamily ] from '../../common/fonts.st.css';
@st-import [ --wst-paragraph-2-color-rgb ] from '@wix/wix-site-theme-variables/stylable-variables.st.css';

/*
 * Background color
 * @type color
 * @default --wix-color-5
 */
@property st-global(--wix-ui-tpa-section-notification-background-color);

/*
 * Icons color
 * @type color
 * @default --wix-color-5
 */
@property st-global(--wix-ui-tpa-section-notification-icon-color);

/*
 * Text color
 * @type color
 * @default --wix-color-5
 */
@property st-global(--wix-ui-tpa-section-notification-text-color);

/*
 * Border radius
 * @type size
 * @default 2px
 */
@property st-global(--wix-ui-tpa-section-notification-border-radius);

.root {
    -st-states: error, alert, wired, success, rtl, size(enum(regular, compact));

    --border-radius: 2px;

    --main-vertical-padding: 9px;
    --main-compact-vertical-padding: 5px;
    --main-left-padding: 12px;
    --main-right-padding: 16px;

    --content-padding: 8px;
    --line-height: 20px;

    --default-text-color: 0, 0, 0;
    --success-color: 0, 130, 80;
    --success-icon-color: rgb(var(--success-color));
    
    --wst-background-color: var(--wst-paragraph-2-color-rgb, var(--wix-color-5));
    --wired-text-color: createColor(--wix-ui-tpa-section-notification-text-color, var(--wst-paragraph-2-color-rgb, var(--wix-color-5)));
    --wired-background-color: createColor(--wix-ui-tpa-section-notification-background-color, (var(--wst-background-color), 0.05));

    width: 100%;
    height: 100%;
    display: flex;
    background-color: #FFFFFF;
    border-radius: var(--wix-ui-tpa-section-notification-border-radius, var(--border-radius));
}

.main {
    display: flex;
    flex: 1;
    /* is used to allow controls to wrap on the next line when available width is not enough */
    flex-wrap: wrap;
    justify-content: center;

    padding: var(--main-vertical-padding) var(--main-right-padding) var(--main-vertical-padding) var(--main-left-padding);

    background-color: createColor(--wix-ui-tpa-section-notification-background-color, (var(--wst-background-color), 0.05));

    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--wix-ui-tpa-section-notification-border-radius, var(--border-radius));

    color: createColor(--wix-ui-tpa-section-notification-text-color, var(--wst-paragraph-2-color-rgb, var(--default-text-color)));
    font-family: value(fontFamily);
    font-size: 14px;
}

.contentsWrapper {
    display: flex;
    flex-direction: row;
    flex: 1;
    padding: 6px 0;
    align-items: center;
}

.buttonsWrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin: var(--main-vertical-padding) var(--content-padding);
}

.buttonsWrapper:empty {
    display: none;
}

.icon {
    transform: translateX(calc(-1 * (var(--content-padding) / 2)));
    height: 20px;
}

.root:rtl .icon {
    transform: translateX(calc((var(--content-padding) / 2)));
}

.icon svg {
    height: var(--line-height);
    fill: createColor((--wix-ui-tpa-section-notification-icon-color, --wix-ui-tpa-section-notification-text-color), var(--wst-paragraph-2-color-rgb, var(--default-text-color)));
    color: createColor((--wix-ui-tpa-section-notification-icon-color, --wix-ui-tpa-section-notification-text-color), var(--wst-paragraph-2-color-rgb, var(--default-text-color)));
}

.text {
    flex: 1;
    min-width: 200px;
    margin: 0;
    line-height: var(--line-height);
}

.text:first-child {
    margin: 0;
}

.button {
    margin: 0 calc(var(--content-padding) / 2);
}

.root:error .main {
    background-color: rgb(value(errorColor-rgb), 0.1);
}

.root:alert .main {
    background-color: rgb(255, 182, 0, 0.1);
}

.root:wired {
    background-color: rgba(255, 255, 255, 0);
}

.root:wired .main {
    background-color: var(--wired-background-color);
    color: var(--wired-text-color);
}

.root:wired .icon svg:not([fill="currentColor"]) path {
    stroke: var(--wired-text-color);
}

.root:success .main {
    background-color: rgb(var(--success-color), 0.1);
}

.root:success .icon svg:not([fill="currentColor"]) path {
    stroke: var(--success-icon-color);
}

/* --------- new icons ---------- */

.root:error .icon svg[fill="currentColor"] {
    color: rgb(value(errorColor-rgb));
}

.root:success .icon svg[fill="currentColor"] {
    color: var(--success-icon-color);
}

.root:wired .icon svg[fill="currentColor"] {
    color: var(--wired-text-color);
}

.root:size(compact) .main {
    padding-top: var(--main-compact-vertical-padding);
    padding-bottom: var(--main-compact-vertical-padding);
}

.root:size(compact) .buttonsWrapper {
    margin-top: var(--main-compact-vertical-padding);
    margin-bottom: var(--main-compact-vertical-padding);
}

/* st-namespace-reference="../../../../src/components/SectionNotification/SectionNotification.st.css" */
    