/* ============================================================================
   cart-notes-2026.css — the customer's notes on the basket

   Prefixes:
     .nx-lnote-   the note on ONE basket line: a «أضف ملاحظة» button under the
                  line, the note as it stands, and a panel with the dish's
                  quick-note chips plus a free-text box.
     .nx-onote-   the note on the WHOLE order («ملاحظة على الطلب»).

   Drawn by partials/cart_line_note + partials/cart_order_note in the cart
   drawer (every storefront layout and the table-QR layout), on /cart and on
   the QR checkout. Behaviour lives in partials/cart_notes.

   Tokens come from the storefront theme (--theme-*) with fallbacks, so the
   Theme Colour setting recolours these without an edit here.
   ========================================================================== */

.nx-lnote, .nx-onote, .nx-pc {
    --nx-n-brand:     var(--m-brand, var(--theme-brand, #B8541A));
    --nx-n-brand-rgb: var(--m-brand-rgb, var(--theme-brand-rgb, 184, 84, 26));
    --nx-n-ink:       var(--theme-text, #241A13);
    --nx-n-soft:      var(--theme-text-soft, #5C4938);
    --nx-n-mute:      var(--theme-text-muted, #8C7A66);
    --nx-n-line:      rgba(36, 26, 19, .12);
    --nx-n-surf:      #FFFFFF;
    --nx-n-surf2:     #F8F4ED;
    --nx-n-danger:    #C73E3E;
    --nx-n-ok:        #16A34A;
    --nx-n-ease:      cubic-bezier(.22, .61, .36, 1);
    text-align: start;
}

/* ─────────────────────────── line note ─────────────────────────── */

.nx-lnote { min-width: 0; }
.nx-lnote.is-busy { opacity: .6; pointer-events: none; }

.nx-lnote__btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px dashed rgba(var(--nx-n-brand-rgb), .45);
    background: rgba(var(--nx-n-brand-rgb), .05);
    color: var(--nx-n-brand);
    font: inherit; font-size: 12px; font-weight: 700; line-height: 1.3;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.nx-lnote__btn i { font-size: 11.5px; }
.nx-lnote__btn:hover { background: rgba(var(--nx-n-brand-rgb), .12); border-style: solid; }
.nx-lnote__btn:focus-visible { outline: 2px solid var(--nx-n-brand); outline-offset: 2px; }
.nx-lnote__btn[aria-expanded="true"] { background: var(--nx-n-brand); border-color: var(--nx-n-brand); color: #fff; border-style: solid; }
.nx-lnote__btn-edit { display: none; }
.nx-lnote.has-note .nx-lnote__btn-add { display: none; }
.nx-lnote.has-note .nx-lnote__btn-edit { display: inline; }

.nx-lnote__text {
    display: flex; align-items: flex-start; gap: 7px;
    margin: 7px 0 0;
    padding: 7px 10px;
    border-radius: 10px;
    background: #FFF7EC;
    border: 1px solid rgba(217, 119, 6, .22);
    color: #92400E;
    font-size: 12.5px; font-weight: 600; line-height: 1.5;
    word-break: break-word;
}
.nx-lnote__text i { color: #D97706; font-size: 10px; margin-top: 4px; flex: 0 0 auto; }
.nx-lnote__text[hidden] { display: none; }

.nx-lnote__panel {
    margin-top: 9px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid var(--nx-n-line);
    background: var(--nx-n-surf);
    box-shadow: 0 10px 24px -18px rgba(20, 12, 7, .55);
    animation: nx-n-in .2s var(--nx-n-ease);
}
.nx-lnote__panel[hidden] { display: none; }
@keyframes nx-n-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.nx-lnote__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.nx-lnote__chip { position: relative; margin: 0; cursor: pointer; }
.nx-lnote__chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.nx-lnote__chip > span {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1.5px solid var(--nx-n-line);
    background: var(--nx-n-surf2);
    color: var(--nx-n-soft);
    font-size: 12px; font-weight: 700;
    user-select: none;
    transition: background .2s, border-color .2s, color .2s;
}
.nx-lnote__chip > span i { font-size: 9.5px; color: var(--nx-n-mute); }
.nx-lnote__chip .fa-check { display: none; }
.nx-lnote__chip:hover > span { border-color: rgba(var(--nx-n-brand-rgb), .45); }
.nx-lnote__chip input:checked + span { background: var(--nx-n-brand); border-color: var(--nx-n-brand); color: #fff; }
.nx-lnote__chip input:checked + span i { color: #fff; }
.nx-lnote__chip input:checked + span .fa-plus { display: none; }
.nx-lnote__chip input:checked + span .fa-check { display: inline; }
.nx-lnote__chip input:focus-visible + span { outline: 2px solid var(--nx-n-brand); outline-offset: 2px; }

.nx-lnote__input, .nx-onote__input {
    display: block; width: 100%;
    padding: 9px 11px !important;
    border-radius: 11px !important;
    border: 1.5px solid var(--nx-n-line) !important;
    background: var(--nx-n-surf2) !important;
    color: var(--nx-n-ink) !important;
    font: inherit; font-size: 13px !important; line-height: 1.5;
    resize: vertical;
    outline: 0;
    box-shadow: none !important;
    transition: border-color .2s, background .2s;
}
.nx-lnote__input { min-height: 58px; }
.nx-lnote__input:focus, .nx-onote__input:focus { border-color: var(--nx-n-brand) !important; background: var(--nx-n-surf) !important; }

.nx-lnote__bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-top: 9px;
}
.nx-lnote__count, .nx-onote__count {
    margin-inline-end: auto;
    font-size: 11px; font-weight: 600; color: var(--nx-n-mute);
    font-variant-numeric: tabular-nums;
}
.nx-lnote__act {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px;
    border-radius: 10px;
    border: 1px solid var(--nx-n-line);
    background: var(--nx-n-surf);
    color: var(--nx-n-soft);
    font: inherit; font-size: 12px; font-weight: 800;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s, filter .2s;
}
.nx-lnote__act:hover { border-color: rgba(var(--nx-n-brand-rgb), .45); color: var(--nx-n-brand); }
.nx-lnote__act:focus-visible { outline: 2px solid var(--nx-n-brand); outline-offset: 2px; }
.nx-lnote__act--save { background: var(--nx-n-brand); border-color: var(--nx-n-brand); color: #fff; }
.nx-lnote__act--save:hover { color: #fff; filter: brightness(1.07); }
.nx-lnote__act--clear { color: var(--nx-n-danger); border-color: rgba(199, 62, 62, .3); }
.nx-lnote__act--clear:hover { color: #fff; background: var(--nx-n-danger); border-color: var(--nx-n-danger); }
.nx-lnote:not(.has-note) .nx-lnote__act--clear { display: none; }

.nx-lnote__err, .nx-onote__err {
    display: flex; align-items: center; gap: 6px;
    margin: 8px 0 0;
    font-size: 12px; font-weight: 700; color: var(--nx-n-danger);
}
.nx-lnote__err[hidden], .nx-onote__err[hidden] { display: none; }

/* Where the widget sits in each basket */
.m-qcart__item > .nx-lnote { padding: 0 2px 2px; margin-top: 8px; }
.m-cart-item > .nx-lnote { grid-column: 1 / -1; }
@media (min-width: 768px) {
    .m-cart-item > .nx-lnote { grid-column: 2 / -1; }
}
.m-checkout-item__body .nx-lnote { margin-top: 6px; }

/* ─────────────────────────── order note ─────────────────────────── */

.nx-onote {
    border-radius: 16px;
    border: 1px solid var(--nx-n-line);
    background: var(--nx-n-surf);
    overflow: hidden;
}
.nx-onote__head {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    background: transparent;
    color: var(--nx-n-ink);
    font: inherit; text-align: start;
    cursor: pointer;
}
.nx-onote__head:focus-visible { outline: 2px solid var(--nx-n-brand); outline-offset: -2px; }
.nx-onote__ic {
    flex: 0 0 auto;
    width: 32px; height: 32px;
    border-radius: 10px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(var(--nx-n-brand-rgb), .10);
    color: var(--nx-n-brand);
    font-size: 13px;
}
.nx-onote__t { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.nx-onote__t b { font-size: 13.5px; font-weight: 800; }
.nx-onote__t small {
    font-size: 11.5px; font-weight: 600; color: var(--nx-n-mute);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nx-onote.has-note .nx-onote__t small { color: #92400E; }
.nx-onote__state {
    flex: 0 0 auto;
    padding: 3px 9px; border-radius: 999px;
    font-size: 10.5px; font-weight: 800;
    background: var(--nx-n-surf2); color: var(--nx-n-mute);
    border: 1px solid var(--nx-n-line);
}
.nx-onote.has-note .nx-onote__state { background: rgba(22, 163, 74, .10); color: #15803D; border-color: rgba(22, 163, 74, .25); }
.nx-onote__state-on { display: none; }
.nx-onote.has-note .nx-onote__state-on { display: inline; }
.nx-onote.has-note .nx-onote__state-off { display: none; }
.nx-onote__chev { flex: 0 0 auto; font-size: 11px; color: var(--nx-n-mute); transition: transform .2s var(--nx-n-ease); }
.nx-onote__head[aria-expanded="true"] .nx-onote__chev { transform: rotate(180deg); }

.nx-onote__body { padding: 0 14px 14px; }
.nx-onote__body[hidden] { display: none; }
.nx-onote__input { min-height: 76px; }
.nx-onote__foot {
    display: flex; align-items: center; gap: 8px;
    margin-top: 7px;
}
.nx-onote__status { font-size: 11.5px; font-weight: 700; color: var(--nx-n-mute); }
.nx-onote__status.is-ok { color: var(--nx-n-ok); }
.nx-onote__status.is-bad { color: var(--nx-n-danger); }

/* Placement */
.m-qcart .nx-onote { flex: none; margin: 12px 0 4px; }
.m-cart-sum .nx-onote { margin: 14px 0 0; }
.m-checkout-onote { margin: 0 0 22px; }
.m-checkout-onote .nx-onote { box-shadow: 0 4px 14px rgba(0, 0, 0, .04); }
.m-dco-sum .nx-onote { margin: 14px 0 0; }

/* ─────────────── size + notes on a product page (.nx-pc-) ─────────────── */

.nx-pc { display: flex; flex-direction: column; gap: 14px; margin: 16px 0; }
.nx-pc__group {
    margin: 0; min-width: 0;
    padding: 14px;
    border-radius: 16px;
    border: 1px solid var(--nx-n-line);
    background: var(--nx-n-surf);
    transition: border-color .2s, box-shadow .2s;
}
.nx-pc__group.is-invalid {
    border-color: var(--nx-n-danger);
    box-shadow: 0 0 0 3px rgba(199, 62, 62, .12);
    animation: nx-pc-shake .35s ease;
}
@keyframes nx-pc-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.nx-pc__h {
    float: none; width: 100%;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin: 0 0 10px; padding: 0;
    font-size: 14px !important; font-weight: 800; line-height: 1.3;
    color: var(--nx-n-ink);
}
.nx-pc__h > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
.nx-pc__h i { color: var(--nx-n-brand); font-size: 13px; }
.nx-pc__req, .nx-pc__opt {
    flex: 0 0 auto;
    padding: 3px 9px; border-radius: 999px;
    font-size: 10.5px; font-weight: 800;
}
.nx-pc__req { background: rgba(199, 62, 62, .10); color: #A32B2B; }
.nx-pc__opt { background: var(--nx-n-surf2); color: var(--nx-n-mute); border: 1px solid var(--nx-n-line); }
.nx-pc__group.is-done .nx-pc__req { background: rgba(22, 163, 74, .12); color: #15803D; }

.nx-pc__sizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.nx-pc__size { position: relative; margin: 0; cursor: pointer; }
.nx-pc__size input, .nx-pc__chip input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.nx-pc__size-card {
    position: relative;
    display: flex; flex-direction: column; gap: 4px;
    min-height: 64px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1.5px solid var(--nx-n-line);
    background: var(--nx-n-surf2);
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.nx-pc__size:hover .nx-pc__size-card { border-color: rgba(var(--nx-n-brand-rgb), .45); }
.nx-pc__size-nm { font-size: 13.5px; font-weight: 800; color: var(--nx-n-ink); padding-inline-end: 18px; }
.nx-pc__size-pr {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 13px; font-weight: 800; color: var(--nx-n-brand);
    font-variant-numeric: tabular-nums;
}
.nx-pc__size-pr .Saudi_Riyal { width: .75em; height: auto; }
.nx-pc__size-pr s { color: var(--nx-n-mute); font-weight: 600; font-size: 11.5px; margin-inline-start: 4px; }
.nx-pc__tick {
    position: absolute; inset-block-start: 9px; inset-inline-end: 9px;
    font-size: 15px; color: var(--nx-n-brand);
    opacity: 0; transform: scale(.6);
    transition: opacity .2s, transform .2s var(--nx-n-ease);
}
.nx-pc__size input:checked + .nx-pc__size-card {
    border-color: var(--nx-n-brand);
    background: rgba(var(--nx-n-brand-rgb), .07);
    box-shadow: 0 8px 18px -12px rgba(var(--nx-n-brand-rgb), .9);
}
.nx-pc__size input:checked + .nx-pc__size-card .nx-pc__tick { opacity: 1; transform: scale(1); }
.nx-pc__size input:focus-visible + .nx-pc__size-card,
.nx-pc__chip input:focus-visible + span { outline: 2px solid var(--nx-n-brand); outline-offset: 2px; }

.nx-pc__err {
    display: flex; align-items: center; gap: 6px;
    margin: 10px 0 0;
    font-size: 12px; font-weight: 700; color: #A32B2B;
}
.nx-pc__err[hidden] { display: none; }

.nx-pc__chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.nx-pc__chip { position: relative; margin: 0; cursor: pointer; }
.nx-pc__chip > span {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 13px;
    border-radius: 999px;
    border: 1.5px solid var(--nx-n-line);
    background: var(--nx-n-surf2);
    font-size: 12.5px; font-weight: 700; color: var(--nx-n-soft);
    user-select: none;
    transition: border-color .2s, background .2s, color .2s;
}
.nx-pc__chip > span i { font-size: 10px; color: var(--nx-n-mute); }
.nx-pc__chip .fa-check { display: none; }
.nx-pc__chip:hover > span { border-color: rgba(var(--nx-n-brand-rgb), .45); }
.nx-pc__chip input:checked + span { background: var(--nx-n-brand); border-color: var(--nx-n-brand); color: #fff; }
.nx-pc__chip input:checked + span i { color: #fff; }
.nx-pc__chip input:checked + span .fa-plus { display: none; }
.nx-pc__chip input:checked + span .fa-check { display: inline; }

.nx-pc__note-l { display: block; margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--nx-n-soft); }
.nx-pc__note {
    display: block; width: 100%;
    min-height: 64px;
    padding: 10px 12px !important;
    border-radius: 12px !important;
    border: 1.5px solid var(--nx-n-line) !important;
    background: var(--nx-n-surf2) !important;
    color: var(--nx-n-ink) !important;
    font: inherit; font-size: 13.5px !important; line-height: 1.5;
    resize: vertical;
    outline: 0;
    box-shadow: none !important;
    transition: border-color .2s, background .2s;
}
.nx-pc__note:focus { border-color: var(--nx-n-brand) !important; background: var(--nx-n-surf) !important; }
.nx-pc__meta {
    display: flex; justify-content: space-between; gap: 10px;
    margin-top: 6px;
    font-size: 11px; font-weight: 600; color: var(--nx-n-mute);
}
.nx-pc__meta i { color: var(--nx-n-brand); }
.nx-pc-from { font-size: 12px; font-weight: 700; color: var(--nx-n-mute, #8C7A66); margin-inline-end: 4px; }

@media (prefers-reduced-motion: reduce) {
    .nx-pc__group.is-invalid { animation: none; }
    .nx-lnote__panel { animation: none; }
    .nx-lnote__btn, .nx-lnote__act, .nx-onote__chev { transition: none; }
}
