/*
 * Element UI 2 look on Element Plus 2.
 * Loaded right after /element-plus/index.css and before the project CSS, so project
 * rules (custom-admin.css, theme ...) still override it exactly as they overrode the
 * Element UI theme before.
 *
 * Size mapping used by the migration (templates and CSS class names):
 *   Element UI  default (no size) 40px  ->  Element Plus large    (global default size)
 *   Element UI  small 32px / medium      ->  Element Plus default
 *   Element UI  mini 28px                ->  Element Plus small
 */

:root {
  --el-component-size-large: 40px;
  --el-component-size: 32px;
  --el-component-size-small: 28px;
}

/* form item spacing: Element UI 22px (default) / 18px (small, mini) */
.el-form-item--large { --el-form-item-margin-bottom: 22px; }
.el-form-item--default,
.el-form-item--small { --el-form-item-margin-bottom: 18px; }

/* labels on top: Element UI used the control's line-height plus 10px below the label */
/* (margin-bottom is left to Element Plus: 8px, the same as Bootstrap's label .5rem the app relied on) */
.el-form-item--label-top .el-form-item__label {
  display: inline-block;
  vertical-align: middle;
  height: auto;
  padding: 0 0 10px;
  line-height: 40px;
}
.el-form-item--label-top.el-form-item--default .el-form-item__label { line-height: 32px; }
.el-form-item--label-top.el-form-item--small .el-form-item__label { line-height: 28px; }

/* label text size per Element UI size (mini / small labels were 14px, controls 12px / 13px) */
.el-form-item--small .el-form-item__label,
.el-form-item--default .el-form-item__label { font-size: 14px; }

/* inputs: Element UI padding 0 15px, 30px next to a prefix / suffix icon */
.el-input__wrapper { padding: 1px 15px; }
.el-input--prefix .el-input__wrapper { padding-left: 5px; }
.el-input--suffix .el-input__wrapper { padding-right: 5px; }
.el-input__prefix-inner > :last-child,
.el-input__prefix-inner > :first-child { margin-right: 5px; }
.el-input--small .el-input__wrapper { font-size: 12px; }
.el-input--default .el-input__wrapper { font-size: 13px; }
.el-select .el-select__wrapper { padding: 1px 15px; }
.el-select--small .el-select__wrapper { min-height: 28px; padding: 1px 15px; font-size: 12px; }
.el-select--default .el-select__wrapper { min-height: 32px; padding: 1px 15px; font-size: 13px; }
.el-select--large .el-select__wrapper { min-height: 40px; padding: 1px 15px; font-size: 14px; }
.el-textarea__inner { padding: 5px 15px; }

/* buttons: Element UI buttons had no fixed height - padding + text (line-height 1) + border,
   i.e. 28px (mini), 32px (small), 40px (default) with the default font sizes */
.el-button { height: auto; line-height: 1; }
.el-button--small { padding: 7px 15px; font-size: 12px; border-radius: 3px; }
.el-button--default { padding: 9px 15px; font-size: 12px; border-radius: 3px; }
.el-button--large { padding: 12px 20px; font-size: 14px; }
.el-button.is-round.el-button--small { padding: 7px 15px; }
.el-button.is-round.el-button--default { padding: 9px 15px; }
.el-button.is-round.el-button--large { padding: 12px 23px; }
.el-button.is-circle { width: auto; padding: 12px; }
.el-button.is-circle.el-button--small { padding: 7px; }
.el-button.is-circle.el-button--default { padding: 9px; }
.el-button + .el-button { margin-left: 10px; }

/* radio buttons (Element UI paddings) */
.el-radio-button--small .el-radio-button__inner { padding: 7px 15px; font-size: 12px; }
.el-radio-button--default .el-radio-button__inner { padding: 9px 15px; font-size: 12px; }
.el-radio-button--large .el-radio-button__inner { padding: 12px 20px; font-size: 14px; }

/* Element UI showed the select placeholder / selected value inside a native <input>, which
   does not inherit text-transform; Element Plus uses a <span>, so reset it the same way */
.el-select__placeholder { text-transform: none; }

/* Element UI pagination was inline content (follows the parent's text-align, e.g. text-right);
   Element Plus uses a block-level flex box */
.el-pagination { display: inline-flex; }

/* pagination: Element UI buttons were 28px high at every size (13px text) */
.el-pagination,
.el-pagination--large,
.el-pagination--default {
  --el-pagination-button-width: 30px;
  --el-pagination-button-height: 28px;
  --el-pagination-font-size: 13px;
}
.el-pagination.is-background .el-pager li,
.el-pagination.is-background .btn-prev,
.el-pagination.is-background .btn-next { min-width: 30px; height: 28px; }

/* switch: Element UI had one size (40 x 20, 16px knob); Element Plus scales it with the form size */
.el-switch,
.el-switch--large,
.el-switch--small { height: 20px; line-height: 20px; font-size: 14px; }
.el-switch--large .el-switch__core,
.el-switch--small .el-switch__core { min-width: 40px; height: 20px; border-radius: 10px; }
.el-switch--large .el-switch__core .el-switch__action,
.el-switch--small .el-switch__core .el-switch__action { width: 16px; height: 16px; }
.el-switch--large.is-checked .el-switch__core .el-switch__action,
.el-switch--small.is-checked .el-switch__core .el-switch__action { left: calc(100% - 17px); }
.el-switch--large .el-switch__label,
.el-switch--small .el-switch__label { font-size: 14px; height: 20px; line-height: 20px; }

/* radio / checkbox: Element UI only sized the bordered variants (40 / 32 / 28px).
   Plain radios/checkboxes: Element UI values, at plain-class specificity so project CSS
   still overrides them (Element Plus' size variants are lowered with :where() in index.css) */
.el-radio { height: auto; line-height: 1; font-size: 14px; }
.el-radio__inner { width: 14px; height: 14px; }
.el-radio__label { font-size: 14px; padding-left: 10px; }
/* Element UI radio group: inline-block, line-height 1 (Element Plus: inline-flex) */
.el-radio-group { display: inline-block; line-height: 1; vertical-align: middle; }
/* Element UI checkboxes had no line-height of their own (inherited from the parent) */
.el-checkbox { height: auto; line-height: inherit; font-size: 14px; }
.el-checkbox__inner { width: 14px; height: 14px; }
.el-checkbox__inner::after { width: 3px; height: 7px; left: 4px; top: 1px; }
.el-checkbox__label { font-size: 14px; padding-left: 10px; line-height: 19px; }
.el-radio.is-bordered.el-radio--large, .el-checkbox.is-bordered.el-checkbox--large { height: 40px; padding: 12px 20px 0 10px; }
.el-radio.is-bordered.el-radio--default, .el-checkbox.is-bordered.el-checkbox--default { height: 32px; padding: 8px 15px 0 10px; }
.el-radio.is-bordered.el-radio--small, .el-checkbox.is-bordered.el-checkbox--small { height: 28px; padding: 6px 15px 0 10px; }

/* form labels: Element UI labels had no fixed height (Element Plus sets 24 / 32 / 40px) */
.el-form-item--large .el-form-item__label,
.el-form-item--default .el-form-item__label,
.el-form-item--small .el-form-item__label { height: auto; }

/* tables: Element UI cell padding default 12px / small 8px / mini 6px, 12px text for small & mini */
.el-table--small .el-table__cell { padding: 6px 0; }
.el-table--default { font-size: 12px; }

/* dialog: Element UI spacing (header 20 20 10, body 30 20, footer 10 20 20, close button at 20px) */
.el-dialog { padding: 0; --el-dialog-padding-primary: 20px; }
.el-dialog__header { padding: 20px 20px 10px; margin-right: 0; }
.el-dialog__body { padding: 30px 20px; color: #606266; font-size: 14px; word-break: break-all; }
.el-dialog__footer { padding: 10px 20px 20px; }
.el-dialog__headerbtn { top: 20px; right: 20px; width: auto; height: auto; font-size: 16px; }

/* message box ($confirm / $alert): Element UI spacing */
.el-message-box { padding: 0 0 10px; width: 420px; }
.el-message-box__header { padding: 15px 15px 10px; }
.el-message-box__container, .el-message-box__content { padding: 10px 15px; }
.el-message-box__btns { padding: 5px 15px 0; }
.el-message-box__headerbtn { top: 15px; right: 15px; width: auto; height: auto; }

/* table sort arrows: Element UI box was 34px high (it sets the header row height) */
.el-table .caret-wrapper { height: 34px; }
.el-table .sort-caret.ascending { top: 5px; }
.el-table .sort-caret.descending { bottom: 7px; }

/* message ($message / $showNoti): Element UI put the close "x" absolutely at the right edge
   and kept 16px free after the text; Element Plus places it inline right after the text */
.el-message .el-message__closeBtn { position: absolute; top: 50%; right: 15px; transform: translateY(-50%); margin: 0; }
.el-message.is-closable .el-message__content { padding-right: 16px; }

/* dropdown menu: Element UI items had no vertical padding (height = line-height):
   default 36px / 0 20px, small 27px / 0 15px, mini 24px / 0 10px; menu padding 10px 0 */
.el-dropdown-menu,
.el-dropdown-menu--large,
.el-dropdown-menu--default { padding: 10px 0; }
.el-dropdown-menu--small { padding: 3px 0; }
.el-dropdown-menu__item,
.el-dropdown-menu--large .el-dropdown-menu__item { line-height: 36px; padding: 0 20px; font-size: 14px; }
.el-dropdown-menu--default .el-dropdown-menu__item { line-height: 27px; padding: 0 15px; font-size: 13px; }
.el-dropdown-menu--small .el-dropdown-menu__item { line-height: 24px; padding: 0 10px; font-size: 12px; }
.el-dropdown-menu__item--divided { margin-top: 6px; border-top: 1px solid #ebeef5; }

/* form items whose form has no label-width (label not on top): Element UI floated the label
   left and kept the content a normal block, so a full-width field wrapped below the label.
   Element Plus lays them out side by side with flexbox. */
.el-form-item:not(.el-form-item--label-top):has(> .el-form-item__label:not([style*="width"])) { display: block; }
.el-form-item:not(.el-form-item--label-top):has(> .el-form-item__label:not([style*="width"]))::after { content: ""; display: table; clear: both; }
.el-form-item:not(.el-form-item--label-top) > .el-form-item__label:not([style*="width"]) { float: left; }
.el-form-item:not(.el-form-item--label-top):has(> .el-form-item__label:not([style*="width"])) > .el-form-item__content { display: block; }

/* buttons / selects inside an input's prepend or append: Element UI pulled them into the
   input's height with negative margins */
.el-input-group__append .el-button,
.el-input-group__append .el-select,
.el-input-group__prepend .el-button,
.el-input-group__prepend .el-select { display: inline-block; margin: -10px -20px; }

/* select natural width: Element UI's select was a native <input> (about 20 characters wide),
   which sets how wide table columns / inline layouts make it. Element Plus' select is only as
   wide as its text. An invisible spacer restores the same natural width (it never forces a
   select wider than its container). */
.el-select::after { content: ""; display: block; height: 0; width: 193px; max-width: 100%; }
.el-select--default::after { width: 192px; }
.el-select--small::after { width: 172px; }

/* checkbox: Element UI was inline-block (its line-height sets the height even without a label);
   Element Plus uses flex, which collapses to the 14px box */
.el-checkbox { display: inline-block; }
.el-checkbox__input { vertical-align: middle; }
.el-checkbox__label { display: inline-block; }
