// Correctly inherit ion-text-wrap onto labels.
ion-item.ion-text-wrap ion-label {
    white-space: normal !important;
}


// Ionic toolbar.
ion-toolbar ion-back-button,
ion-toolbar .in-toolbar.button-clear {
    --color: var(--ion-color-primary-contrast);
}

// Ionic icon.
ion-icon {
    &.icon-slash::after,
    &.icon-backslash::after {
        content: " ";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        background-color: var(--ion-color-danger);
        -webkit-mask: url("/assets/fonts/font-awesome/solid/slash.svg") no-repeat 50% 50%;
        mask: url("/assets/fonts/font-awesome/solid/slash.svg") no-repeat 50% 50%;
    }

    &.icon-slash::after {
        -webkit-transform: scale(-1, 1);
        transform: scale(-1, 1);
    }

    &.fa-fw {
        text-align: center;
        width: 1.25em;
    }
}

[dir=rtl] ion-icon.icon-flip-rtl {
    -webkit-transform: scale(-1, 1);
    transform: scale(-1, 1);
}

// Ionic alert.
ion-alert.core-alert-network-error .alert-head {
    position: relative;
    content: " ";
    background: url("/assets/fonts/font-awesome/solid/wifi.svg") no-repeat 50% 50%;
    margin: 25px auto;

    &::after {
        content: " ";
        position: absolute;
        top: -20%;
        right: -15%;
        width: 50%;
        height: 50%;
        background-color: var(--ion-color-danger);
        -webkit-mask: url("/assets/fonts/font-awesome/solid/exclamation-triangle.svg") no-repeat 50% 50%;
        mask: url("/assets/fonts/font-awesome/solid/exclamation-triangle.svg") no-repeat 50% 50%;
    }
}
[dir=rtl] ion-alert.core-alert-network-error .alert-head::after {
    right: unset;
    left: -15%;
}

// Ionic item divider.
ion-item-divider {
    --background: var(--gray-lighter);
    border: 0;
}

// Ionic list.
ion-list.list-md {
    padding-bottom: 0;
}

// Modals.
.core-modal-fullscreen  .modal-wrapper {
    position: absolute;
    // @todo @include position(0 !important, null, null, 0 !important);
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.core-modal-force-on-top {
    z-index: 100000 !important;
}

// Hidden submit button.
.core-submit-hidden-enter {
    position: absolute;
    visibility: hidden;
    left: -1000px;
}

// Note on foot of ion-input.
.item .core-input-footnote {
    width: 100%;
    font-style: italic;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 14px;
}

// Item styles
.item.core-selected-item {
    // TODO: Add safe are to border and RTL
    border-inline-start: var(--selected-item-border-width) solid var(--selected-item-color);
    --ion-safe-area-left: calc(-1 * var(--selected-item-border-width));
}

.item.item-file {
    ion-thumbnail {
        --size: 32px;
        width: var(--size);
        height: var(--size);
    }
}

.item.core-primary-item,
.item.core-info-item,
.item.core-secondary-item,
.item.core-tertiary-item,
.item.core-success-item,
.item.core-warning-item,
.item.core-danger-item {
    --inner-border-width: 0 0 3px 0;
}
.item.core-primary-item {
    --border-color: var(--ion-color-primary);
}
.item.core-info-item,
.item.core-secondary-item {
    --border-color: var(--ion-color-secondary);
}
.item.core-tertiary-item {
    --border-color: var(--ion-color-tertiary);
}
.item.core-success-item {
    --border-color: var(--ion-color-success);
}
.item.core-warning-item {
    --border-color: var(--ion-color-warning);
}
.item.core-danger-item {
    --border-color: var(--ion-color-danger);
}

// Card styles

// Message cards.
ion-card.core-primary-card,
ion-card.core-info-card,
ion-card.core-secondary-card,
ion-card.core-tertiary-card,
ion-card.core-success-card,
ion-card.core-warning-card,
ion-card.core-danger-card {
    border-bottom: 3px solid transparent;
}
ion-card.core-primary-card {
    border-bottom-color: var(--ion-color-primary);
}
ion-card.core-info-card,
ion-card.core-secondary-card {
    border-bottom-color: var(--ion-color-secondary);
}
ion-card.core-tertiary-card {
    border-bottom-color: var(--ion-color-tertiary);
}
ion-card.core-success-card {
    border-bottom-color: var(--ion-color-success);
}
ion-card.core-warning-card {
    border-bottom-color: var(--ion-color-warning);
}
ion-card.core-danger-card {
    border-bottom-color: var(--ion-color-danger);
}

// Avatar
// -------------------------
// Large centered avatar
img.large-avatar {
    display: block;
    margin: auto;
    width: 90px;
    height: 90px;
    max-width: 90px;
    max-height: 90px;
    margin-bottom: 10px;
    border-radius : 50%;
    padding: 4px;
    border: 1px solid #ddd;
    background-color: transparent;
}

ion-avatar ion-img, ion-avatar img {
    text-indent: -99999px;
    background-color: var(--gray-light);
}

// Action sheet.
.md ion-action-sheet {
    .action-sheet-group-cancel {
        -webkit-filter: drop-shadow(0px 3px 3px rgba(var(--action-sheet-shadow-color)));
        filter: drop-shadow(0px 3px 3px rgba(var(--action-sheet-shadow-color)));
    }

    .action-sheet-title {
        border-bottom: 1px solid var(--title-border-color);
    }
}

.ios ion-action-sheet {
    .action-sheet-title {
        font-size: 16px;
    }
}

// Select.
ion-select.core-button-select,
.core-button-select {
    background-color: var(--ion-color-primary-contrast);
    color: var(--ion-color-primary);
    white-space: normal;
    min-height: 45px;
}

// File uploader.
.action-sheet-button input.core-fileuploader-file-handler-input {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    min-width: 100%;
    opacity: 0;
    z-index: 100;
    cursor: pointer;
}
