/*
 * Hyva-only CSS for this module. Most of the module's Hyva look is now written as Tailwind
 * utilities in the templates themselves (the theme's build scans this module through
 * Observer/HyvaConfigGenerateObserver, so run the theme's `npm run build` after changing a
 * template). The templates are shared with Luma, where those utilities are inert and the LESS
 * in web/css/source styles the same markup.
 *
 * What remains here is what a template cannot carry as utilities:
 *   - the unread marker: a data-URI icon, unreadable as an arbitrary value;
 *   - the status/resolution chips: a palette keyed by the colour an administrator picks for a
 *     status, rendered by several templates as `status-branch-<colour>`;
 *   - links inside .mst-rma-box: their markup comes from PHP (order labels, message HTML);
 *   - the attachment lightbox and the attachment list items: built by JS at runtime.
 *
 * The hyva_* layout handles of the RMA pages (and of the order history, for the returns column)
 * add this file to <head>; Luma never loads it. Every rule is scoped to RMA markup.
 */

/*
 * The unread marker. Luma draws it from the same data URI in web/css/source/module/_list.less; the
 * icon is declared once per stylesheet pipeline because LESS is Luma-only and this file is
 * Hyva-only. One icon, two declarations - the cost of the two-pipeline model, not a second design.
 */
.mst-rma-list__unread {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    margin-left: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none'%3E%3Crect x='3' y='5.5' width='18' height='13' rx='2.5' stroke='%234b5563' stroke-width='1.8'/%3E%3Cpath d='M3.8 7.5 12 13l8.2-5.5' stroke='%234b5563' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3Ccircle cx='19.5' cy='5' r='4' fill='%23ef4444' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/*
 * The status pill. Luma gets this from _common.less and _view.less; Hyva has no LESS pipeline, so
 * without these rules the pill renders as bare text. The colours are the module's curated palette,
 * lifted verbatim - the -hyva copy instead put the colour NAME straight into an inline
 * background-color, which renders the raw CSS keyword (green #008000) rather than this (#59e05b).
 */
/* A status whose colour an administrator never set lands here, and it is the only chip
   left that fills itself with a saturated ground - which now makes the one status
   nobody configured the loudest on the page. It takes the same soft treatment as the
   rest. The resolution badge beside an item (Refund, Exchange) sits on the same page as
   the status chips and takes the same soft default, so the two read as one family.

   The transparent border is what gives the per-status border-colour something to
   paint: a border-colour without a border-style draws nothing, and the chips would
   also jump a pixel as their borders appeared. */
.mst-rma-status,
.mst-rma-badge {
    display: inline-block;
    background: #4059a3;
    color: #ffffff;
    border: 1px solid transparent;
    text-align: center;
    border-radius: 2px;
    font-size: 12px;
    padding: 4px 8px;
    line-height: 1;
    white-space: nowrap;
}

/* Status chips.

   The colour on a chip is the one an administrator picked for that status, and it
   carries meaning - green approved, red rejected - so it stays. What changes is the
   amount of it. Filling the whole chip with a saturated hue put sixteen competing
   blocks of colour on one page and left the label unreadable on most of them: with
   the single #424242 the palette used for every chip, twelve of the sixteen fell
   below the 4.5:1 that body-sized text needs, and `black` printed its label in its
   own background colour.

   Each chip now takes a tint of its hue for the ground, a darkened version of the
   same hue for the label, and a mid tone for the border. Every pair is at or above
   4.5:1, the hue is still what identifies the status, and a page of chips reads as
   one family rather than sixteen. The three neutrals sit close together by nature -
   an administrator who needs them told apart should pick hues instead. */
.mst-rma-status,
.mst-rma-badge {
    background: #eef1f7;
    color: #3a4f8f;
    border-color: #ccd5e8;
}

.mst-rma-status.status-branch-aqua {
    background: #e2f7f5;
    color: #1c7871;
    border: 1px solid #b6ebe6;
}
.mst-rma-status.status-branch-grey {
    background: #eeeeee;
    color: #5a5a5a;
    border: 1px solid #d5d5d5;
}
.mst-rma-status.status-branch-navy {
    background: #e6edf4;
    color: #416c9b;
    border: 1px solid #c0d2e5;
}
.mst-rma-status.status-branch-silver {
    background: #f6f6f6;
    color: #707070;
    border: 1px solid #e9e9e9;
}
.mst-rma-status.status-branch-black {
    background: #e5e5e5;
    color: #333333;
    border: 1px solid #bdbdbd;
}
.mst-rma-status.status-branch-green {
    background: #e8fbe8;
    color: #18811a;
    border: 1px solid #c5f4c6;
}
.mst-rma-status.status-branch-olive {
    background: #eaede0;
    color: #5a721d;
    border: 1px solid #c9d3b1;
}
.mst-rma-status.status-branch-teal {
    background: #e2f1f4;
    color: #267487;
    border: 1px solid #b7dbe4;
}
.mst-rma-status.status-branch-blue {
    background: #e8eaff;
    color: #3541cc;
    border: 1px solid #c7cbff;
}
.mst-rma-status.status-branch-lime {
    background: #eaf8eb;
    color: #29802f;
    border: 1px solid #caeecd;
}
.mst-rma-status.status-branch-purple {
    background: #f6dcf6;
    color: #9b059a;
    border: 1px solid #e9a8e9;
}
.mst-rma-status.status-branch-fuchsia {
    background: #f9e8f9;
    color: #b32eb3;
    border: 1px solid #f0c6f0;
}
.mst-rma-status.status-branch-maroon {
    background: #f4e8e8;
    color: #9b4b4b;
    border: 1px solid #e3c5c5;
}
.mst-rma-status.status-branch-red {
    background: #ffe0e0;
    color: #d10000;
    border: 1px solid #ffb3b3;
}
.mst-rma-status.status-branch-orange {
    background: #ffefdb;
    color: #a35a00;
    border: 1px solid #ffd7a6;
}
.mst-rma-status.status-branch-yellow {
    background: #fff9db;
    color: #857000;
    border: 1px solid #fff1a6;
}

/* Links in an RMA box: PHP-rendered markup (order labels, message text), so no class to put a utility on. */
/* Hyva's reset leaves <a> at the surrounding text colour, so every link inside an RMA box read as
   body text - the order number worst of all. Luma paints all of them with its own link colour. */
.mst-rma-box a {
    color: var(--color-primary, #2563eb);
}

.mst-rma-box a:hover {
    text-decoration: underline;
}

/* Built by JS at runtime (rma-attachments.js), so there is no template to carry utilities. */
.mst-rma-attachments__item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
    padding: 0.5rem;
    border: 1px solid #e8e8e8;
    border-radius: 0.375rem;
}

.mst-rma-attachments__thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 0.25rem;
}

.mst-rma-attachments__name {
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.mst-rma-attachments__remove {
    border: 0;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.25rem;
    color: #6b7280;
}

.mst-rma-attachments__remove:hover {
    color: #d10000;
}

/* Built by JS at runtime when the theme has no lightbox of its own. */
/* The attachment preview this module opens when the theme has no lightbox of its own. */
.mst-rma-lightbox {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.8);
    cursor: zoom-out;
}

.mst-rma-lightbox__figure {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
    cursor: default;
}

.mst-rma-lightbox img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    cursor: zoom-in;
}

.mst-rma-lightbox__figure._zoomed img {
    max-width: none;
    max-height: none;
    cursor: zoom-out;
}

/* While the next file decodes, the one still on screen is dimmed and a spinner runs over it, so
   a fast run through the gallery never passes off the previous picture as the current one. */
.mst-rma-lightbox__figure._loading img {
    opacity: 0.25;
}

.mst-rma-lightbox__figure._loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2.5rem;
    height: 2.5rem;
    margin: -1.25rem 0 0 -1.25rem;
    border: 3px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: mst-rma-lightbox-spin 0.8s linear infinite;
}

@keyframes mst-rma-lightbox-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .mst-rma-lightbox__figure._loading::after {
        animation-duration: 2.4s;
    }
}

.mst-rma-lightbox__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: #111827;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.mst-rma-lightbox__close:hover {
    background: #ffffff;
}

.mst-rma-lightbox__close::before {
    content: '\00D7';
}

.mst-rma-lightbox__prev,
.mst-rma-lightbox__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    color: #111827;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.mst-rma-lightbox__prev:hover,
.mst-rma-lightbox__next:hover {
    background: #ffffff;
}

.mst-rma-lightbox__prev { left: 1rem; }
.mst-rma-lightbox__next { right: 1rem; }

.mst-rma-lightbox__prev::before { content: '\2039'; }
.mst-rma-lightbox__next::before { content: '\203A'; }

.mst-rma-lightbox__caption {
    color: #ffffff;
    font-size: 0.875rem;
    text-align: center;
}
