/* Reset styles
   ========================================================================= */
html, body {
    height: 100vh;
    margin: 0;
}
body {
    background-color: var(--body-bg);
    color: var(--text-color);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
}

// Needed because we always add 'fa fa-' to the given icon name, so these
// styles allow to override that with icon names such as 'symfony fab'
i.fa, i.fas, i.far {
    font-family: 'Font Awesome 6 Free' !important;
}
i.fab {
    font-family: 'Font Awesome 6 Brands' !important;
}
i.fal {
    font-family: 'Font Awesome 6 Pro' !important;
}
i.fad {
    font-family: 'Font Awesome 6 Duotone' !important;
}

a {
    color: var(--link-color);
    text-decoration: none;
}
a:hover {
    color: var(--link-hover-color);
    text-decoration: var(--link-hover-decoration);
}

code, pre {
    color: #c44c34;
    font-family: SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace;
    font-size: 13px;
}
pre {
    line-height: 1.8;
}

// Needed to provide BC compatibility because
// Bootstrap 5 replaced these classes by .text-start and .text-end
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

/* Layout
   ========================================================================= */
.wrapper {
    @media(min-width: 992px) {
        display: grid;
        grid-template-columns: var(--sidebar-max-width) auto;
        min-height: 100vh;
    }

    @media(min-width: 1280px) {
        grid-column-gap: 0;
    }
}

body:not(.ea-content-width-full) .content-wrapper {
    max-width: var(--body-max-width);
}
body.ea-sidebar-width-compact .wrapper {
    @media(min-width: 992px) {
        grid-template-columns: 44px auto;
    }
}

.responsive-header {
    align-items: center;
    background: var(--responsive-header-bg);
    box-shadow: inset 0 -1px 0 var(--responsive-header-border-color);
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;

    @media(min-width: 992px) {
        display: none;
    }

    #responsive-header-logo {
        padding: 0 15px;
        font-size: var(--font-size-base);
        font-weight: 500;
        margin: 0;

        a {
            color: var(--responsive-header-logo-color);
        }
    }

    .dropdown-settings {
        display: block;
    }
}
.main-header {
    display: none;

    @media(min-width: 992px) {
        display: block;
    }
}

.main-header .navbar {
    display: block;
    padding: 0 0 0 var(--sidebar-menu-items-padding-left);
}

.main-header #header-logo {
    overflow: hidden;
}
.main-header #header-logo a {
    color: var(--sidebar-logo-color);
    display: block;
    font-size: var(--font-size-lg);
    font-weight: 500;
    line-height: 24px;
    padding: 17px 0 28px 0;
}
.main-header #header-logo img,
.main-header #header-logo svg {
    max-width: 100%;
}

.main-header #header-logo {
    .logo-custom { display: block; }
    .logo-compact { display: none; }
}
@media(min-width: 992px) {
    body.ea-sidebar-width-compact .main-header #header-logo {
        .logo-custom { display: none; }
        .logo-compact { display: block; }
    }
}

#navigation-toggler {
    background: transparent;
    border: 0;
    color: var(--text-color-dark);
    cursor: pointer;
    filter: opacity(50%);
    font-size: 17px;
    margin: 0 5px 0 -5px;
    padding: 0;
    width: 24px;

    @media(min-width: 992px) {
        display: none;
    }
}

.sidebar-wrapper {
    position: relative;
}
.sidebar {
    background: var(--sidebar-bg);
    height: 100%;
    min-height: 100vh;
    left: calc(0px - 2 * 20px - var(--sidebar-max-width));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 15px 20px;
    position: fixed;
    top: 0;
    transition: left 0.3s;
    z-index: $zindex-modal-backdrop + 1;
    width: calc(2 * 20px + var(--sidebar-max-width));

    @media(min-width: 992px) {
        box-shadow: inset -1px 0 0 var(--sidebar-border-color);
        max-width: var(--sidebar-max-width);
        padding: 0 var(--sidebar-padding-right) 0 var(--sidebar-padding-left);
        position: static;
        z-index: $zindex-modal-backdrop - 1;
        width: initial;
    }
}
body.ea-mobile-sidebar-visible .sidebar {
    box-shadow: 20px 0 25px -5px rgba(0, 0, 0, 0.1), 10px 0 10px -5px rgba(0, 0, 0, 0.04);
    left: 0;
}

.user-menu-wrapper {
    a.user-details,
    a.user-details:hover {
        align-items: center;
        color: var(--user-name-color);
        cursor: pointer;
        display: flex;
        -webkit-appearance: none; // needed for Safari
    }
    &.user-is-impersonated a.user-details,
    &.user-is-impersonated a.user-details:hover {
        color: var(--user-menu-impersonated-link-color);
        font-weight: 500;
    }
    .user-details .user-name {
        margin-left: 6px;
    }

    .user-avatar {
        border-radius: var(--border-radius);
        display: block;
    }
    span.user-avatar {
        .fa-stack { border-radius: var(--border-radius); font-size: 14px; vertical-align: middle; width: 2em; }
        .user-avatar-icon-background { color: var(--user-avatar-icon-bg); }
        .user-avatar-icon-foreground { color: var(--user-avatar-icon-color); }
    }
    img.user-avatar {
        border: 1px solid var(--user-menu-border-color);
        height: 21px;
        max-width: 21px;
        width: auto;
    }

    .dropdown-menu {
        min-width: 200px;
        max-width: 480px;

        .dropdown-user-details {
            align-items: flex-start;
            display: flex;
            padding: 0 5px;

            .user-avatar {
                margin-right: 10px;
            }
            span.user-avatar .fa-stack {
                font-size: 24px;

                .user-avatar-icon-background { font-size: 48px; }
                .user-avatar-icon-foreground { font-size: 24px; }
                i { height: 48px; width: 48px; margin: 0; }
            }
            img.user-avatar {
                height: 39px;
                max-width: 39px;
                margin-top: 2px;
                width: auto;
            }
            .user-label {
                color: var(--text-muted);
                display: block;
                font-size: var(--font-size-sm);
                margin-bottom: 2px;
            }
        }
    }
}

.dropdown-settings {
    display: none;
    @media(min-width: 992px) {
        display: block;
    }

    .dropdown-settings-button {
        color: var(--dropdown-settings-icon-color);
        font-size: 16px;
        padding: 0 0 0 15px;
    }

    .dropdown-header {
        color: var(--text-muted);
        display: block;
        font-size: var(--font-size-sm);
    }

    .dropdown-item.active {
        background: var(--dropdown-settings-active-item-bg);
        box-shadow: var(--dropdown-settings-active-item-shadow);
        color: var(--dropdown-settings-active-item-color);

        i {
            color: var(--dropdown-settings-active-item-color);
        }
    }
}

.content-wrapper {
    padding: 0 var(--content-padding-right) 0 var(--content-padding-left);

    @media(min-width: 992px) {
        display: grid;
        grid-template-columns: auto var(--resize-handler-width);
        padding: 0 var(--lg-content-padding-right) 0 var(--lg-content-padding-left);
    }
}

.content {
}

.resizer-handler {
    display: none;

    @media(min-width: 992px) {
        cursor: col-resize;
        display: block;
        margin: 0 0 0 7px;
        min-height: 100vh;
        transition: background 0.7s;
        width: 3px;

        &:hover {
            background: var(--resize-handler-hover-bg);
        }
    }
}
#sidebar-resizer-handler {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    min-height: 100vh;
}

#content-resizer-handler {
    min-height: calc(100vh - 56px);
}

.content-top {
    align-items: center;
    box-shadow: 0 1px 0 var(--content-top-border-color);
    display: flex;
    margin-bottom: 1px;
    padding: 5px 15px 5px var(--content-padding-left);

    @media(max-width: 992px) {
        &.ea-search-disabled { box-shadow: none; }
    }

    @media(min-width: 992px) {
        display: flex;
        height: 56px;
        justify-content: space-between;
        padding: 11px calc(var(--lg-content-padding-right) + var(--resize-handler-width)) 11px var(--lg-content-padding-left);
        position: relative;
    }
}

.content-top .navbar-custom-menu {
    display: none;

    @media(min-width: 992px) {
        display: block;
    }
}

.content-top .content-search {
    flex: 1;

    .form-group {
        flex-basis: 100%;
        padding: 2px 0;
    }
    .form-widget {
        align-items: center;
        display: flex;
        flex: unset;

        @media(min-width: 992px) {
            display: block;
        }
    }
    .content-search-icon {
        color: var(--content-search-icon-color);
        margin-right: 0;
    }
    .content-search-reset {
        background: var(--content-search-reset-button-bg);
        border-radius: var(--border-radius);
        color: var(--content-search-reset-button-color);
        font-size: 13px;
        padding: 2px 2px;

        &:hover {
            background: var(--content-search-reset-button-hover-bg);
            color: var(--content-search-reset-button-hover-color);
        }
    }

    input[type="search"][name="query"] {
        background: var(--content-search-input-bg);
        border: 0;
        box-shadow: none;
        max-width: unset;

        // needed to hide the default [X] mark showed by Webkit browsers in these fields
        &::-webkit-search-decoration,
        &::-webkit-search-cancel-button,
        &::-webkit-search-results-button,
        &::-webkit-search-results-decoration {
            -webkit-appearance: none;
        }

        &:focus, &:active {
            box-shadow: none;
            outline: none;
        }
    }

    // copied from https://css-tricks.com/auto-growing-inputs-textareas/#other-ideas
    .content-search-label {
        align-items: center;
        display: inline-grid;
        margin: 0;
        padding: 0;

        @media(min-width: 992px) {
            max-width: 600px;
        }
    }
    .content-search-label::after,
    .content-search-label input {
        grid-area: 1/2;
        resize: none;
        width: auto;
    }
    .content-search-label input.is-blank {
        min-width: 300px;
    }
    .content-search-label::after {
        /* the extra blank space is needed to make it look good */
        content: attr(data-value) "    ";
        height: 30px;
        visibility: hidden;
        white-space: pre-wrap;
    }
}

.content-header {
    padding: 26px 0 16px;

    @media(min-width: 768px) {
        align-items: flex-start;
        background: var(--body-bg);
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        padding: 36px 0 16px;
    }
}
body.ea-new .content-header,
body.ea-edit .content-header {
    @media(min-width: 992px) {
        position: sticky;
        top: -20px;
        z-index: 999;
    }
}

.content-header-title {
    flex: 1;
}
.content-header-title .title {
    font-size: var(--font-size-xxl);
    font-weight: bold;
    line-height: 1.2;
    margin: 0;
    padding-right: 15px;

    @media(min-width: 992px) {
        font-size: var(--font-size-xxxl);
    }
}
.content-header-title .title small {
    color: var(--gray-600);
    font-size: var(--font-size-lg);
    font-weight: 500;
    line-height: var(--font-size-lg);
}

.content-header-help {
    i {
      color: var(--text-muted);
      cursor: pointer;
      font-size: 21px;
    }
}
// customizing Bootstrap's Saas variables for popovers doesn't work,
// so we need to define these styles explicitly
.popover.ea-content-help-popover {
  border-color: var(--popover-border-color);
  box-shadow: var(--popover-shadow);
  max-width: var(--popover-max-width);
}
.popover.ea-content-help-popover .popover-body {
  background: var(--popover-bg);
  border-radius: var(--border-radius);
  color: var(--popover-color);
  font-size: var(--font-size-base);
  padding: 15px;
  text-align: left;
}
.popover.ea-content-help-popover.bs-popover-auto[data-popper-placement^=top]>.popover-arrow, .bs-popover-top > .popover-arrow {
    &:before { border-top-color: var(--popover-border-color); }
    &:after { border-top-color: var(--popover-bg); }
}
.popover.ea-content-help-popover.bs-popover-auto[data-popper-placement^=right]>.popover-arrow, .bs-popover-end > .popover-arrow {
    &:before { border-right-color: var(--popover-border-color); }
    &:after { border-right-color: var(--popover-bg); }
}
.popover.ea-content-help-popover.bs-popover-auto[data-popper-placement^=bottom] > .popover-arrow, .bs-popover-bottom > .popover-arrow {
  top: -.5rem;
  &:before { border-bottom-color: var(--popover-border-color); }
  &:after { border-bottom-color: var(--popover-bg); }
}
.popover.ea-content-help-popover.bs-popover-auto[data-popper-placement^=left]>.popover-arrow, .bs-popover-start > .popover-arrow {
    &:before { border-left-color: var(--popover-border-color); }
    &:after { border-left-color: var(--popover-bg); }
}

.ea-content-help-popover.tooltip.show {
  opacity: 1;
}

.content-header .datagrid-filters {
    margin-right: 10px;
}
.content-header .page-actions {
    justify-content: right;
    flex-wrap: wrap;
    row-gap: 1em;
    display: flex;
    flex-direction: row;
    margin: 10px 0 15px;

    &:empty { display: none; }

    @media(min-width: 768px) {
        margin: 2px 1px 0 10px;
    }

    .btn + .btn {
        margin-left: 10px;
    }

    .btn-group .btn + .btn {
        margin-left: 0;
    }
}

.batch-actions form {
    display: flex;
}
.batch-actions .btn + .btn {
    margin-left: 15px;
}

.with-rounded-top {
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}
.with-rounded-bottom {
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}
.datagrid.with-rounded-top thead tr:first-child th:first-child {
    border-top-left-radius: var(--border-radius);
}
.datagrid.with-rounded-top thead tr:first-child th:last-child {
    border-top-right-radius: var(--border-radius);
}

.content-footer {
    background: var(--body-bg);
    border-top: var(--border-width) var(--border-style) var(--content-section-border-color);
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
    color: var(--text-muted);
    margin-top: 15px;
    padding: 15px 0;
}

.content-panel {
    margin-bottom: 20px;
}

.content-panel-header {
    border-bottom: var(--border-width) var(--border-style) var(--content-section-border-color);
    font-size: var(--font-size-lg);
    line-height: 24px;
    margin: 0;
    padding: 15px 17px 15px 20px;
}
.content-panel-header.collapsible {
    padding: 0;
}
.content-panel-header.collapsible > a {
    color: inherit;
    display: block;
    padding: 15px 17px 15px 20px;
}
.content-panel-header.collapsible.with-help > a {
    padding: 15px 17px 1px 20px;
}
.content-panel-header.collapsible .collapse-icon {
    color: var(--color-primary);
    margin-right: 5px;
    transition: all .1s linear;
}
.content-panel-collapse:not(.collapsed) .collapse-icon {
    transform: rotate(90deg);
}
.content-panel-header.collapsible.with-help .content-panel-header-help {
    padding: 0 17px 15px 20px;
}

.content-panel-header-help {
    color: var(--gray-500);
    font-size: var(--font-size-base);
}

.content-panel-body {
    background: var(--white);
    padding: 15px 20px;

    @media(min-width: 992px) {
        padding: 18px 25px;
    }

    &.with-min-h-250 {
        min-height: 250px;
    }
}
.content-panel-body.with-background {
    background: var(--content-panel-bg);
}
.content-panel-body.without-padding {
    padding: 0;
}
.content-panel-body.without-header {
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}
.content-panel-body.without-footer {
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.content-panel-footer {
    border-top: var(--border-width) var(--border-style) var(--border-color);
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
    margin: 0;
    padding: 15px 17px 15px 20px;

    &.without-border {
        border-top: 0;
    }
}
.content-panel-footer.without-padding {
    padding: 0;
}

.dropdown-menu {
    --dropdown-padding: 4px;

    background-color: var(--dropdown-bg);
    border-color: var(--dropdown-border-color);
    box-shadow: var(--shadow-xl);
    color: var(--dropdown-color);
    max-width: 240px;
    padding: 5px;

    li {
        border-radius: var(--border-radius);
    }
    a, a:hover, a:active {
        border-radius: var(--border-radius);
        color: var(--dropdown-link-color);
    }
    a:hover {
        background: var(--dropdown-link-hover-bg);
    }
    i {
        color: var(--dropdown-icon-color);
        margin: 0 10px 0 4px;
        font-size: 15px;
    }

    .dropdown-item, .dropdown-header {
        align-items: center;
        display: flex;
        height: 28px;
        white-space: nowrap;
        overflow: hidden;
        padding: 0 12px 0 6px;
        text-overflow: ellipsis;
    }
    .dropdown-divider {
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: 0 -1px 0 var(--dropdown-border-color);
        height: 1px;
        margin: 6px calc(-1 * var(--dropdown-padding));
        opacity: 1;
    }
    .dropdown-item-color-scheme {
        color: var(--dropdown-color);

        &:hover { background: transparent; }
        label { align-items: center; display: flex; }
        i { margin-top: 0; }
        select {
            background: var(--dropdown-bg);
            border: 1px solid var(--dropdown-border-color);
            border-radius: var(--border-radius);
            color: var(--dropdown-color);
            margin-left: 10px;
            outline: none;
            padding: 0 4px;
        }
    }
}

.list-pagination {
    background: var(--table-footer-bg);
    border-bottom-left-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
    color: var(--pagination-color);
    padding: 15px 0;

    @media (min-width: 992px) {
        align-items: center;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
    }
}
.list-pagination-counter {
    color: var(--pagination-color);
}

.pager ul {
    margin-bottom: 0;

    @media (max-width: 992px) {
        margin-top: 15px
    }
}
.page-item.active .page-link, .page-item.active .page-link:hover {
    background: var(--pagination-active-bg);
    border-color: var(--pagination-active-bg);
    color: var(--pagination-active-color);
}
.page-item.disabled .page-link {
    background: transparent;
    color: var(--pagination-disabled-color);
}
.page-item .page-link,
.page-item .page-link:focus,
.page-item .page-link:hover {
    background: transparent;
    border: var(--border-width) var(--border-style) transparent;
    border-radius: var(--border-radius);
    color: inherit;
    margin: 0 1px;
}
// needed to override some Bootstrap styles
.page-item:not(:first-child) .page-link {
    margin: 0 1px;
}
.page-item .page-link:focus,
.page-item .page-link:hover {
    border-color: var(--pagination-hover-border-color);
}
.pager .page-item i {
    vertical-align: middle;
}

/* Modal for delete action */
.modal-content {
    border-color: var(--modal-border-color);
}
.modal-body {
    background: var(--modal-bg);
}
.modal-body h4 {
    font-size: var(--font-size-lg);
}

.modal-footer {
    background: var(--modal-footer-bg);
    border-color: var(--modal-border-color);
    padding: 8px 10px;
}

// Flash messages
#flash-messages {
    background: transparent;
}
.alert {
    border-width: 0 0 var(--border-width);
    border-radius: 0;
    margin: 0;

    .btn-close, .btn-close:focus {
        box-shadow: none;
        outline: none;
    }

    &:last-of-type {
        border-bottom-width: 2px;
    }

    &.alert-primary {
        background-color: var(--alert-primary-bg);
        border-color: var(--alert-primary-border-color);
        color: var(--alert-primary-color);
    }
    &.alert-secondary {
        background-color: var(--alert-secondary-bg);
        border-color: var(--alert-secondary-border-color);
        color: var(--alert-secondary-color);
    }
    &.alert-success {
        background-color: var(--alert-success-bg);
        border-color: var(--alert-success-border-color);
        color: var(--alert-success-color);
    }
    &.alert-info {
        background-color: var(--alert-info-bg);
        border-color: var(--alert-info-border-color);
        color: var(--alert-info-color);
    }
    &.alert-warning {
        background-color: var(--alert-warning-bg);
        border-color: var(--alert-warning-border-color);
        color: var(--alert-warning-color);
    }
    &.alert-danger {
        background-color: var(--alert-danger-bg);
        border-color: var(--alert-danger-border-color);
        color: var(--alert-danger-color);
    }
    &.alert-light {
        background-color: var(--alert-light-bg);
        border-color: var(--alert-light-border-color);
        color: var(--alert-light-color);
    }
    &.alert-dark {
        background-color: var(--alert-dark-bg);
        border-color: var(--alert-dark-border-color);
        color: var(--alert-dark-color);
    }
}
.ea-dark-scheme .alert:not(.alert-light), .alert.alert-dark {
    .btn-close {
        filter: invert(1);
    }
}

// Utilities
.text-primary { color: var(--text-primary-color) !important; }
.text-secondary { color: var(--text-secondary-color) !important; }
.text-tertiary { color: var(--text-tertiary-color) !important; }

.border-primary { border: 1px solid var(--border-primary-color) !important; }
.border-secondary { border: 1px solid var(--border-secondary-color) !important; }
.border-tertiary { border: 1px solid var(--border-tertiary-color) !important; }

.background-primary { background-color: var(--primary-bg) !important; }
.background-secondary { background-color: var(--secondary-bg) !important; }
.background-tertiary { background-color: var(--tertiary-bg) !important; }
