/**
 * All Level Up XP styles are built from the file css/styles.css.
 */

.block_xp * {
    /** For older themes. */
    box-sizing: border-box;
}

@tailwind components;
@tailwind utilities;

/** Cancel overflow of .no-overflow */
.block_xp .xp-cancel-overflow .no-overflow {
    overflow: visible;
}

/** Legacy styles. */
.block_xp-level {
    background: url([[pix:block_xp|10]]) no-repeat;
    background-size: 100px 100px;
    color: #fff;
    font-size: 4em;
    height: 100px;
    line-height: 100px;
    text-align: center;
    width: 100px;

    cursor: default;
    @apply xp-select-none;
}
a .block_xp-level {
    cursor: inherit;
}

.block_xp-level.level-1 {
    background-image: url([[pix:block_xp|1]]);
}
.block_xp-level.level-2 {
    background-image: url([[pix:block_xp|2]]);
}
.block_xp-level.level-3 {
    background-image: url([[pix:block_xp|3]]);
}
.block_xp-level.level-4 {
    background-image: url([[pix:block_xp|4]]);
}
.block_xp-level.level-5 {
    background-image: url([[pix:block_xp|5]]);
}
.block_xp-level.level-6 {
    background-image: url([[pix:block_xp|6]]);
}
.block_xp-level.level-7 {
    background-image: url([[pix:block_xp|7]]);
}
.block_xp-level.level-8 {
    background-image: url([[pix:block_xp|8]]);
}
.block_xp-level.level-9 {
    background-image: url([[pix:block_xp|9]]);
}
.block_xp-level.small {
    height: 35px;
    width: 35px;
    font-size: 18px;
    line-height: 40px;
    margin: 0 auto;
    background-size: cover;
}
.block_xp-level.medium {
    height: 50px;
    width: 50px;
    font-size: 24px;
    line-height: 54px;
    margin: 0 auto;
    background-size: cover;
}

.block_xp-level.level-badge,
.block_xp-level.level-badge.small,
.block_xp-level.level-badge.medium {
    background: none;
    height: auto;
    width: auto;
    @apply xp-select-none;
}
.block_xp-level.level-badge {
    line-height: 100px;
}
.block_xp-level.level-badge.small {
    line-height: 35px;
}
.block_xp-level.level-badge.medium {
    line-height: 50px;
}
.block_xp-level.level-badge img {
    width: 100px;
}
.block_xp-level.level-badge.small img,
.block_xp-level.level-badge.medium img {
    width: auto;
    max-width: 100px;
}
.block_xp-level.level-badge.small img {
    height: 35px;
}
.block_xp-level.level-badge.medium img {
    height: 50px;
}

.block_xp-instructions {
    margin-bottom: 2em;
}

/** Block content. */
.block.block_xp .block_xp-level {
    margin-left: auto;
    margin-right: auto;
}
.block.block_xp .alert.alert-block {
    @apply xp-p-2 xp-py-1.5;
}
.block.block_xp .block_xp-level-progress [role='progressbar'] {
    @apply xp-h-4;
}
.block.block_xp .block_xp-heading {
    @apply xp-uppercase xp-text-gray-600 xp-text-xs xp-tracking-normal xp-mb-4 xp-border-0 xp-border-b xp-border-solid xp-border-gray-200;
}

.block.block_xp nav {
    text-align: center;
    align-content: stretch;
    @apply xp-flex xp-flex-wrap xp-items-stretch;
    @apply xp-border-0 xp-border-solid xp-border-t xp-border-gray-200;
}
.block.block_xp nav .nav-button {
    @apply xp-flex-1 xp-self-auto;
    text-decoration: none;
    color: #333;
    font-size: 80%;
    padding: 5px 5px 0;
}
.block.block_xp nav .nav-button .icon {
    margin: 0;
    padding: 0;
}
.block.block_xp nav .nav-button:hover {
    background: #eee;
}

/** Use over defined class name to re-use it through the block pages. */
.block_xp-xp {
    display: inline-block;
    white-space: nowrap;
}
.block_xp-xp .pts,
.block_xp-xp .sign {
    display: inline-block;
    letter-spacing: 0;
}
.block_xp-xp .sign-sup {
    vertical-align: super;
    font-size: 0.6428571428571429em; /* 9px. */
    line-height: 0.6428571428571429em;
}

/** Use our own highlight because of discrepencies between various themes. Sorry themers,
    it's a nightmare to maintain a plugin for multiple themes... */
.block_xp-table tr.highlight-row > td {
    @apply !xp-bg-yellow-100;
}

/**
 * Ladder table.
 */
.block_xp-table td {
    /* Using !important because it's late and I can't be bothered looking for an alternative. */
    vertical-align: middle !important; /* stylelint-disable-line declaration-no-important */
}
.block_xp-table .col-lvl {
    width: 50px;
    text-align: center;
}
.block_xp-table .col-rank {
    white-space: nowrap;
    width: 50px;
}
.block_xp-table .col-userpic {
    width: 35px;
}
.block_xp-table .userpicture {
    /* Margin only present in recent Moodle. */
    margin-right: 5px;
}
.dir-rtl .block_xp-table .userpicture {
    margin-left: 5px;
    margin-right: 0;
}

/**
 * Report table.
 */
.block_xp-report-table td {
    vertical-align: middle !important; /* stylelint-disable-line declaration-no-important */
}

/**
 * Page navigation.
 */
.block_xp-page-nav a {
    position: relative;
}
.block_xp-page-nav .has-new {
    border-radius: 50%;
    width: 7px;
    height: 7px;
    position: absolute;
    top: 4px;
    right: 4px;
    background-color: #d9534f;
}
.dir-rtl .block_xp-page-nav .has-new {
    left: 4px;
}

/**
 * Dismissable notice.
 */
.block_xp-dismissable-notice .alert {
    /** We override the padding, because else the close button doesn't align well... */
    padding: 14px;
}
.block_xp-dismissable-notice .dismiss-action {
    float: right;
    line-height: 12px;
}
.block_xp-dismissable-notice .dismiss-action .icon {
    padding: 0;
    margin: 0;
    width: 12px;
    height: 12px;
}
.dir-rtl .block_xp-dismissable-notice .dismiss-action {
    float: left;
}

/**
 * Notification dialogue.
 */

.block_xp-notification-hidden {
    display: none;
}
.block_xp-notification .moodle-dialogue-bd,
.block_xp-notification .moodle-dialogue-ft {
    text-align: center !important; /* stylelint-disable-line declaration-no-important */
}
.block_xp-notification .level-headline {
    font-size: 1.4em;
    font-weight: bold;
}
.block_xp-notification .level-name {
    margin-top: 1em;
    font-size: 16px;
    font-weight: bold;
}
.block_xp-notification .moodle-dialogue-ft button {
    /* Helps centering the button in the dialogue */
    margin-left: 0;
    margin-right: 0;
}

/**
 * Rule picker dialogue.
 */
.block_xp-rulepicker-hidden {
    display: none;
}
.block_xp-rulepicker-content .rule {
    cursor: pointer;
    padding: 0.5rem;
    border-bottom: 1px solid #efefef;
}
.block_xp-rulepicker-content .rule:last-child {
    border-bottom-width: 0;
}
.block_xp-rulepicker-content .rule:focus,
.block_xp-rulepicker-content .rule:hover {
    background-color: #efefef;
}
.block_xp-rulepicker-content .rule h3 {
    font-size: 1.125rem;
    font-weight: 500;
    margin: 0 !important;
}
.block_xp-rulepicker-content .rule .info {
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

/**
 * Rules pages.
 *
 * Note: We find the very first rule using .filter-rules > .rule
 */
.block-xp-filters-group .block-xp-filters-submit-actions {
    margin-top: 2em;
}
.block-xp-filters-group h4:not(:first-of-type) {
    margin-top: 1em;
}
.block-xp-filters-wrapper ul {
    list-style: none;
    padding-left: 0;
    padding-right: 0;
}
.block-xp-filters-wrapper p,
.block-xp-filters-wrapper ul,
.block-xp-filters-wrapper ul.filters-list,
/** Made more specific for RTL. */ .block-xp-filters-wrapper input[type],
.block-xp-filters-wrapper button,
.block-xp-filters-wrapper select {
    margin: 0;
}
.block-xp-filters-wrapper input[type],
.block-xp-filters-wrapper select {
    /* In Edge the line height is inherited when we do not do this. */
    line-height: 18px;
    max-width: 100%;
}
.block-xp-filters-wrapper .filter-rules {
    margin-left: 20px;
    margin-top: 5px;
}
.block-xp-filters-wrapper .filter {
    border: 1px solid #ddd;
    margin: 10px 0;
    padding: 8px 4px;
}
.block-xp-filters-wrapper .filter-add {
    margin: 10px 0;
}
.block-xp-filters-wrapper .rule-rules {
    margin-left: 35px;
}
.block-xp-filters-wrapper .filter-rules > .rule {
    border: 0;
    padding-left: 0;
}
.block-xp-filters-wrapper .filter-rules > .rule::before {
    border: 0;
}
.block-xp-filters-wrapper .filter-rules > .rule > .rule-rules {
    margin-left: 20px;
}
.block-xp-filters-wrapper .filter-rules > .rule > .rule-definition {
    padding-left: 5px;
}
.block-xp-filters-wrapper .rule-type-ruleset,
.block-xp-filters-wrapper .rule-type-ruleset .rule-rules > .rule:first-child {
    padding-top: 5px;
}
.block-xp-filters-wrapper .rule-type-ruleset > .rule-definition {
    background-color: #f1f1f1;
    padding-bottom: 2px;
}
.block-xp-filters-wrapper .rule-rules .rule {
    border-left: 1px dotted #ccc;
    min-height: 40px;
    padding-left: 15px;
    position: relative;
}
.block-xp-filters-wrapper .rule-rules .rule::before {
    border-top: 1px dotted #ccc;
    content: '';
    display: block;
    left: 0;
    position: absolute;
    top: 20px;
    width: 15px;
}
.block-xp-filters-wrapper .rule-type-ruleset .rule-rules > .rule:first-child::before,
.block-xp-filters-wrapper .rule.rule-type-ruleset::before {
    top: 25px;
}
.block-xp-filters-wrapper .rule-add {
    padding: 10px 17px;
    position: relative;
    line-height: 20px;
}
.block-xp-filters-wrapper .rule-add::before,
.block-xp-filters-wrapper .rule-rules .rule:last-child::before {
    border-bottom: 1px dotted #ccc;
    border-left: 1px dotted #ccc;
    border-top: 0;
    content: '';
    display: block;
    height: 20px;
    left: 0;
    position: absolute;
    top: 0;
    width: 15px;
}
.block-xp-filters-wrapper .rule-rules .rule:last-child {
    border: 0;
}
.block-xp-filters-wrapper .rule-move,
.block-xp-filters-wrapper .filter-move {
    cursor: move;
    margin: 0 0.5rem;
}
.block-xp-filters-wrapper .filter-delete,
.block-xp-filters-wrapper .rule-delete {
    margin-left: 0.5rem;
}
.block-xp-filters-wrapper .filter-rules > .rule > .rule-definition .rule-delete,
.block-xp-filters-wrapper .filter-rules > .rule > .rule-definition .rule-move {
    /** Hide the move/delete button on the top rule. */
    display: none;
}

/** Readonly filters. */
.block-xp-filters-wrapper .filters-readonly .filter {
    padding: 10px;
}
.block-xp-filters-wrapper .filters-readonly .filter-rules > .rule > .rule-definition,
.block-xp-filters-wrapper .filters-readonly .rule-rules .rule {
    line-height: 30px;
    min-height: 30px;
}
.block-xp-filters-wrapper .filters-readonly .filter-rules > .rule > .rule-definition {
    padding: 0 10px;
}
.block-xp-filters-wrapper .filters-readonly .rule-type-ruleset .rule-rules > .rule:first-child::before,
.block-xp-filters-wrapper .filters-readonly .rule.rule-type-ruleset::before {
    top: 20px;
}
.block-xp-filters-wrapper .filters-readonly .rule-rules .rule::before {
    top: 15px;
}
.block-xp-filters-wrapper .filters-readonly .rule-rules .rule:last-child::before {
    top: 0;
    height: 15px;
}

/** Level grid */

.block_xp-level-grid {
    display: flex;
    flex-wrap: wrap;
}
.block_xp-level-grid .block_xp-level-no {
    position: absolute;
    left: 10px;
    top: 10px;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
}
.block_xp-level-grid .block_xp-level-boxed {
    flex: 1 1 25%;
    display: flex;
    justify-content: center;
    padding-right: 1em;
    padding-bottom: 1em;
    box-sizing: border-box;
}
.block_xp-level-grid .block_xp-level-boxed-with-desc {
    flex-basis: 50%;
    flex-grow: 2;
}
.block_xp-level-grid .block_xp-level-box {
    position: relative;
    flex: 1;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background-color: #efefef;
    border-radius: 5px;
    padding: 1em;
    display: flex;
}

.block_xp-level-grid .level-name {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
}

.block_xp-level-grid .block_xp-level-desc {
    margin-top: 1em;
    font-size: 12px;
    line-height: 16px;
    overflow: auto;
}

@media (min-width: 768px) {
    .block_xp-level-grid .block_xp-level-boxed {
        max-width: 50%;
    }
}

/** Support inline input fields. */
.form-control.block_xp-form-control-inline {
    min-width: 0;
    width: auto;
    display: inline;
}

/** Hide accepted file types from level badges filemanager. **/
.block_xp #fitem_id_badges fieldset [name=badges] + p,
.block_xp #fitem_id_badges fieldset .form-filetypes-descriptions {
    @apply xp-hidden;
}

/**
 * CM rule.
 */
.block_xp-cm-rule-widget .cm-selected {
    display: none;
}
.block_xp-cm-rule-widget.has-cm .cm-selection {
    display: none;
}
.block_xp-cm-rule-widget.has-cm .cm-selected {
    display: inline;
}

/** RTL styles. */
.dir-rtl .block-xp-filters-wrapper .filter-rules {
    margin-left: 0;
    margin-right: 20px;
}
.dir-rtl .block-xp-filters-wrapper .rule-rules {
    margin-left: 0;
    margin-right: 40px;
}
.dir-rtl .block-xp-filters-wrapper .filter-rules > .rule > .rule-rules {
    margin-left: 0;
    margin-right: 20px;
}
.dir-rtl .block-xp-filters-wrapper .filter-rules > .rule > .rule-definition {
    padding-left: 0;
    padding-right: 5px;
}
.dir-rtl .block-xp-filters-wrapper .rule-rules .rule {
    border-left: 0;
    border-right: 1px dotted #ccc;
    padding-left: 0;
    padding-right: 15px;
}
.dir-rtl .block-xp-filters-wrapper .rule-rules .rule::before {
    right: 0;
}
.dir-rtl .block-xp-filters-wrapper .rule-add::before,
.dir-rtl .block-xp-filters-wrapper .rule-rules .rule:last-child::before {
    border-left: 0;
    border-right: 1px dotted #ccc;
    right: 0;
}
