/* The item "..." menu's Admin flyout, plus the little confirm dialog the two destructive
   actions use. Loaded by catalog/item.ejs and library/item.ejs.

   Why a flyout at all: the menu already carries Wear / Configure / Delete from Inventory /
   Regenerate Thumbnail / Revoke Thumbnail / Inspect Model, and a superadmin sees all of them
   at once. Adding "Delete From Site" and "Change Asset ID" inline made the popover taller
   than the thumbnail beside it, and put an irreversible action one slip away from Wear.

   Deliberately NOT reusing Roblox.Dialog for the confirm: it needs a
   [data-modal-type="confirmation"] container that only some pages ship, and the change-id
   flow needs a text field, which that dialog only supports through .modalPopup markup this
   page does not have. */

/* ── Flyout ──────────────────────────────────────────────────────────────── */

/* position:relative anchors the flyout. The rule is also separated from the owner actions
   above it with a hairline — this is the "you are about to do something as staff" line. Sits
   inside a .dropdown-menu, whose own <li> styling supplies the rest. */
.dropdown-menu > li.item-admin-parent {
    position: relative;
    border-top: 1px solid #e3e3e3;
    margin-top: 4px;
    padding-top: 4px;
}

.dropdown-menu > li.item-admin-parent > a.item-admin-toggle {
    cursor: pointer;
    /* The caret is pushed to the far edge, so the row needs to be a flex line rather than the
       plain block the sibling items are. */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.item-admin-toggle .item-admin-caret {
    /* -16x16 sprites are the site's own arrows, but there is no right-pointing one in the
       icon sheet at this size; a glyph avoids shipping an image for six pixels. */
    font-size: 10px;
    line-height: 1;
    margin-left: 12px;
    opacity: .6;
}

/* Every selector below is over-qualified on purpose. SiteStyle's
   `.popover-content .dropdown-menu { display: block; position: relative }` (0-2-0) applies to
   this flyout too — it IS a .dropdown-menu, nested inside the popover's menu — and it beat the
   plain `.item-admin-submenu` rule, so the flyout rendered in-flow and `left: 100%` slid it
   sideways out of the popover, leaving an empty two-row gap under the Admin row. */
.dropdown-menu > li.item-admin-parent > ul.item-admin-submenu {
    display: none;
    position: absolute;
    left: 100%;
    /* Lines the first submenu entry up with the parent row rather than with the menu's top
       padding, so the flyout reads as coming out of the row you are hovering. */
    top: -5px;
    margin: 0 0 0 1px;
    min-width: 190px;
    z-index: 1060; /* above .popover (1050) */
}

/* Flipped by ItemAdminMenu.js when the flyout would leave the viewport — on a narrow window
   the "..." menu is already hard against the right edge. */
.dropdown-menu > li.item-admin-parent > ul.item-admin-submenu.flip-left {
    left: auto;
    right: 100%;
    margin: 0 1px 0 0;
}

.dropdown-menu > li.item-admin-parent:hover > ul.item-admin-submenu,
.dropdown-menu > li.item-admin-parent.open > ul.item-admin-submenu {
    display: block;
}

/* Touch has no hover, so the flyout is click-toggled there too (see ItemAdminMenu.js). Keep
   the row itself from looking like it navigates. */
.item-admin-parent.open > a.item-admin-toggle {
    background-color: #f2f4f5;
}

.item-admin-submenu a {
    cursor: pointer;
}

.item-admin-submenu a.item-admin-destructive,
.item-admin-submenu a.item-admin-destructive:link,
.item-admin-submenu a.item-admin-destructive:visited {
    /* Qualified with :link because SiteStyle's `a:link { color: inherit }` (0-1-1) beats a
       bare single-class rule — see gotcha-anchor-styled-as-button. */
    color: #e2231a;
}

/* ── Confirm dialog ──────────────────────────────────────────────────────── */

.item-admin-backdrop {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 2100;
}

.item-admin-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-width: calc(100% - 32px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .35);
    z-index: 2101;
    font: 14px "Source Sans Pro", Helvetica, Arial, sans-serif;
    color: #191919;
}

.item-admin-dialog .item-admin-dialog-header {
    padding: 16px 20px 0;
    font-size: 18px;
    font-weight: 600;
}

.item-admin-dialog .item-admin-dialog-body {
    padding: 12px 20px;
    line-height: 1.45;
}

.item-admin-dialog .item-admin-dialog-body p {
    margin: 0 0 10px;
}

.item-admin-dialog .item-admin-dialog-body strong {
    font-weight: 700;
}

.item-admin-dialog input.item-admin-input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #c3c3c3;
    border-radius: 4px;
    font-size: 14px;
}

.item-admin-dialog .item-admin-dialog-error {
    color: #e2231a;
    min-height: 18px;
    margin: 6px 0 0;
}

.item-admin-dialog .item-admin-dialog-footer {
    padding: 4px 20px 18px;
    text-align: right;
}

.item-admin-dialog .item-admin-dialog-footer button {
    height: 34px;
    min-width: 92px;
    margin-left: 8px;
    padding: 0 14px;
    border: 0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.item-admin-dialog .item-admin-btn-cancel {
    background: #e3e3e3;
    color: #393b3d;
}

.item-admin-dialog .item-admin-btn-confirm {
    background: #e2231a;
    color: #fff;
}

.item-admin-dialog .item-admin-btn-confirm[disabled] {
    opacity: .5;
    cursor: default;
}
