/* Shop → "Add to prescription" dialog (builds on assets/prescriptions/prescriptions.css) */

.ycc-picker {
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0;
    border: 0;
    border-radius: 16px;
    background: var(--rx-surface);
    color: var(--rx-text);
    box-shadow: 0 24px 60px rgba(16, 24, 40, .28);
    gap: 0;
    overflow: hidden;
}
.ycc-picker[open] { display: flex; flex-direction: column; }
.ycc-picker:not([open]) { display: none; } /* .ycc-rx sets display: grid */
.ycc-picker::backdrop { background: rgba(16, 24, 40, .5); }
.ycc-picker *, .ycc-picker *::before, .ycc-picker *::after { box-sizing: border-box; }

.ycc-picker__frame { display: flex; flex-direction: column; min-height: 0; margin: 0; }

/* Header: product */
.ycc-picker__head {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--rx-border);
}
.ycc-picker__thumb { width: 56px; height: 56px; border-radius: 10px; background: var(--rx-subtle); overflow: hidden; }
.ycc-picker__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; margin: 0; }
.ycc-picker__title { margin: 0; font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
.ycc-picker__price { margin-top: 2px; color: var(--rx-muted); font-size: 14px; }
.ycc-picker__price del { opacity: .7; }

body .ycc-picker button.ycc-picker__close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    min-height: 0;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--rx-muted) !important;
    cursor: pointer;
}
body .ycc-picker button.ycc-picker__close:hover { background: var(--rx-subtle) !important; color: var(--rx-text) !important; }

/* Body */
.ycc-picker__body { padding: 18px 20px 20px; overflow-y: auto; }
.ycc-picker__body > section { display: grid; gap: 16px; }
.ycc-picker__body .ycc-rx-note { margin: 0; }
.ycc-picker__label { padding: 0; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--rx-muted); text-transform: uppercase; }

/* Quantity */
.ycc-picker__qty-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ycc-picker__stepper { display: inline-flex; align-items: center; border: 1px solid var(--rx-border); border-radius: 10px; overflow: hidden; }
body .ycc-picker button.ycc-picker__step {
    width: 40px;
    height: 40px;
    min-height: 0;
    margin: 0;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: var(--rx-subtle) !important;
    color: var(--rx-text) !important;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
body .ycc-picker button.ycc-picker__step:disabled { opacity: .4; cursor: not-allowed; }
.ycc-picker .ycc-picker__qty {
    width: 56px;
    height: 40px;
    margin: 0;
    padding: 0 4px;
    border: 0;
    border-inline: 1px solid var(--rx-border);
    border-radius: 0;
    background: var(--rx-surface);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    -moz-appearance: textfield;
}
.ycc-picker .ycc-picker__qty::-webkit-inner-spin-button,
.ycc-picker .ycc-picker__qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Choices */
.ycc-picker__choices { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.ycc-picker__list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ycc-picker__list > li { margin: 0; }

.ycc-picker__choice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--rx-border);
    border-radius: 12px;
    background: var(--rx-surface);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}
.ycc-picker__choice:hover { border-color: var(--rx-primary); }
.ycc-picker__choice:has(input:checked) { border-color: var(--rx-primary); background: var(--rx-info-bg); }
.ycc-picker__choice:has(input:focus-visible) { outline: 3px solid var(--rx-primary); outline-offset: 2px; }
.ycc-picker__choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--rx-primary); }
.ycc-picker__choice-main { display: grid; gap: 2px; min-width: 0; }
.ycc-picker__choice-main strong { overflow-wrap: anywhere; }
.ycc-picker__choice-main small, .ycc-picker__already { color: var(--rx-muted); font-size: 12px; }
.ycc-picker__choice-side { display: grid; justify-items: end; gap: 4px; }
.ycc-picker__choice--new { grid-template-columns: auto minmax(0, 1fr); border-style: dashed; }

.ycc-picker__patient { margin-top: 8px; }
.ycc-picker__patient select {
    width: 100%;
    min-height: 42px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--rx-border);
    border-radius: 10px;
    background: var(--rx-surface);
    font-size: 15px;
}

.ycc-picker__empty { margin: 0; color: var(--rx-muted); font-size: 14px; }
.ycc-picker__empty a { font-weight: 700; }

/* Actions */
.ycc-picker__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ycc-picker__actions .ycc-button { margin: 0; }

/* Loading */
.ycc-picker__skeleton { display: grid; gap: 10px; }
.ycc-picker__skeleton span {
    height: 54px;
    border-radius: 12px;
    background: linear-gradient(90deg, var(--rx-subtle) 0%, var(--rx-neutral-bg) 50%, var(--rx-subtle) 100%);
    background-size: 200% 100%;
    animation: ycc-picker-shimmer 1.2s ease-in-out infinite;
}
.ycc-picker__skeleton span:first-child { width: 45%; height: 40px; }
@keyframes ycc-picker-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .ycc-picker__skeleton span { animation: none; } }

/* Done */
.ycc-picker__done { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 12px; }
.ycc-picker__tick { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--rx-success-bg); color: var(--rx-success); }
.ycc-picker__done-title { margin: 6px 0 4px; font-weight: 700; overflow-wrap: anywhere; }
.ycc-picker__done-list { margin: 0; padding: 0; list-style: none; color: var(--rx-muted); font-size: 14px; }
.ycc-picker__done-list li { margin: 2px 0; }
.ycc-picker__done-list a { font-weight: 600; }

/* Phones: a bottom sheet */
@media (max-width: 600px) {
    .ycc-picker {
        width: 100%;
        max-width: 100%;
        max-height: 92dvh;
        margin: auto 0 0;
        border-radius: 18px 18px 0 0;
    }
    .ycc-picker__head { grid-template-columns: 48px minmax(0, 1fr) auto; padding: 14px 16px; }
    .ycc-picker__thumb { width: 48px; height: 48px; }
    .ycc-picker__body { padding: 16px; }
    .ycc-picker__actions > * { flex: 1 1 auto; }
}

/* Patient picker improvements — 17 November 2026. */
.ycc-picker__patient-create { margin: 12px 0; }
.ycc-picker__patient-fields:not([hidden]) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.ycc-picker__patient-fields label, .ycc-picker__patient label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.ycc-picker__patient-fields input, .ycc-picker__patient input { width: 100%; min-width: 0; min-height: 44px; box-sizing: border-box; font-size: 16px; padding: 10px; border: 1px solid var(--rx-border); border-radius: 8px; }
.ycc-picker__patient-fields [role=status] { grid-column: 1 / -1; margin: 0; }
.ycc-picker__patient input[type=search] { margin-bottom: 8px; }
@media(max-width: 480px) { .ycc-picker__patient-fields:not([hidden]) { grid-template-columns: minmax(0, 1fr); } }

/* Search suggestions, field errors and accessible button contrast. */
.ycc-picker [data-patient-select][hidden], .ycc-picker [hidden] { display: none !important; }
.ycc-picker__patient-search { position: relative; }
.ycc-picker__patient-results { background: #fff; border: 1px solid #94a3b8; border-radius: 8px; max-height: 200px; overflow-y: auto; margin-top: -4px; margin-bottom: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.ycc-picker__patient-results [role=option] { padding: 12px; cursor: pointer; font-size: 14px; color: #19314b; border-bottom: 1px solid #e2e8f0; }
.ycc-picker__patient-results [role=option]:hover, .ycc-picker__patient-results [aria-selected=true] { background: #e5f3ff; color: #122b40; }
.ycc-picker__patient-results p { padding: 12px; margin: 0; font-size: 14px; }
body .ycc-picker .ycc-picker__patient-fields input[aria-invalid=true] { border: 2px solid #b42318; background: #fff6f5; }
.ycc-picker__field-error { color: #b42318; font-size: 13px; font-weight: 500; line-height: 1.4; }
.ycc-picker__patient-fields [role=status] { font-size: 14px; line-height: 1.5; }
body .ycc-picker .ycc-rx-btn:not(:disabled):hover,
body .ycc-picker .ycc-rx-btn:not(:disabled):focus-visible,
body .ycc-picker .ycc-button:not(:disabled):hover,
body .ycc-picker .ycc-button:not(:disabled):focus-visible { background: #000 !important; color: #fff !important; border-color: #000 !important; }
body .ycc-picker .ycc-rx-btn:not(:disabled):hover *,
body .ycc-picker .ycc-button:not(:disabled):hover * { color: inherit !important; }

/* Keep patient controls visible above long prescription lists. */
.ycc-picker__list { max-height: 220px; overflow-y: auto; overscroll-behavior: contain; }
.ycc-picker [data-open-prescriptions-heading] { margin: 10px 0 0; }

@media (max-width: 767px) {
    html:has(.ycc-picker[open]), body:has(.ycc-picker[open]) { overflow: hidden; }
    .ycc-picker__body { min-height: 0; overscroll-behavior-y: contain; }
    .ycc-picker__list, .ycc-picker__patient-results { max-height: none; overflow-y: visible; }
}

.ycc-picker__patient-toolbar {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.ycc-picker__patient-toolbar button {min-height:44px;white-space:normal}
.ycc-picker__patient-fields button {grid-column:1/-1;width:100%}
body .ycc-picker .ycc-picker__patient-create :is(button, [data-submit]),
body .ycc-picker .ycc-picker__actions :is(.ycc-button, .ycc-rx-btn) {
    box-sizing: border-box; min-height: 44px; margin: 0; padding: 10px 16px;
    border-width: 1px !important; border-style: solid !important; border-radius: 8px !important;
    line-height: 1.35; white-space: normal;
}
.ycc-picker__patient-create { display: grid; gap: 12px; }
.ycc-picker__patient-create > [role=status] { margin: 0; font-weight: 600; }
body .ycc-picker .ycc-picker__patient-create [data-submit] {
    background: #FFA500 !important; border-color: #FFA500 !important; color: #201800 !important;
}
body .ycc-picker [data-submit]:focus-visible { outline: 2px solid #201800; outline-offset: 2px; }
.ycc-picker [data-view="prescription"] .ycc-picker__actions [data-close] {display:none!important}

.ycc-picker [data-view="prescription"] .ycc-picker__actions [data-picker-close],.ycc-picker [data-view="prescription"]:has(.ycc-picker__patient-fields:not([hidden])) [data-rx-list]{display:none!important}
.ycc-picker [data-done-list] button{display:block;margin:12px 0 8px}
body .ycc-picker .ycc-continue-shopping{background:transparent;color:#135477;text-decoration:underline;border:0}

.ycc-picker .ycc-picker__patient-search label { display:grid; gap:8px; margin:0; }
.ycc-picker .ycc-picker__patient-search input[type="search"] { box-sizing:border-box; width:100%; min-width:0; min-height:44px; margin:0; padding:10px 14px; border:1px solid #8995a1; border-radius:8px!important; font-size:16px; }
.ycc-picker .ycc-picker__patient-results { margin-top:6px; }

.ycc-category-nav{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;margin:0 0 20px}.ycc-category-nav label{font-weight:600;margin:0}.ycc-category-nav select{min-height:44px;min-width:min(100%,220px);max-width:100%;border:1px solid #8995a1;border-radius:8px;padding:8px 36px 8px 12px;background-color:white;color:#23384a;font-size:16px}
.ycc-suggestions{min-width:0;max-width:100%;margin:20px 0;container-type:inline-size}.ycc-suggestions h3{margin-bottom:8px}.ycc-suggestion-controls:not([hidden]){display:flex;justify-content:flex-end;gap:8px;margin:0 0 8px}.ycc-suggestion-controls button{min-width:44px;height:44px;padding:0;border:1px solid #ccd8df;border-radius:8px;color:#20374a;background:white;font-size:25px;line-height:1}.ycc-suggestion-controls button:disabled{opacity:.4}.ycc-suggestions ul{display:flex;gap:12px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;list-style:none;margin:0;padding:2px 2px 10px}.ycc-suggestions li{flex:0 0 min(74%,180px);box-sizing:border-box;margin:0;padding:0;list-style:none;scroll-snap-align:start}.ycc-suggestions li a{display:flex;flex-direction:column;gap:10px;height:100%;box-sizing:border-box;padding:12px;border:1px solid #d9e1e5;border-radius:8px;background:#fff;color:#20374a;font-size:15px;font-weight:600;line-height:1.4}.ycc-suggestions img{width:100%;height:100px;object-fit:contain}

/* Basket navigation retains readable arrows across theme interaction states. */
body.woocommerce-cart .ycc-suggestions .ycc-suggestion-controls button {background:#176092!important;color:#fff!important;border-color:#176092!important;opacity:1!important}
body.woocommerce-cart .ycc-suggestions .ycc-suggestion-controls button:is(:hover,:focus-visible,:active):enabled {background:#13476a!important;color:white!important}
body.woocommerce-cart .ycc-suggestions .ycc-suggestion-controls button:disabled {background:#edf2f5!important;color:#536477!important;border-color:#c8d4dd!important;cursor:default}
.ycc-suggestion-controls button:focus-visible,.ycc-category-mobile summary:focus-visible {outline:3px solid #246791;outline-offset:2px}
.ycc-category-mobile {display:none}
@media(max-width:767px){
 .ycc-category-nav:has(.ycc-category-mobile){display:block}
 .ycc-category-nav:has(.ycc-category-mobile)>:is(label,select){display:none!important}
 .ycc-category-mobile{display:block;width:100%}
 .ycc-category-mobile summary{box-sizing:border-box;cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:48px;padding:8px 14px;border:1px solid #a1b4c0;border-radius:8px;color:#21394a;background:white;font-weight:600;list-style:none}
 .ycc-category-mobile summary::-webkit-details-marker{display:none}
 .ycc-category-mobile summary small{display:block;font-size:12px;font-weight:500}
 .ycc-category-mobile summary::after{content:'⌄';font-size:20px}.ycc-category-mobile[open] summary::after{transform:rotate(180deg)}
 .ycc-category-mobile .category-links{max-height:min(40vh,280px);overflow:auto;overscroll-behavior:contain;border:1px solid #cbd7df;border-radius:8px;margin-top:6px;background:white}
 .ycc-category-mobile .category-links a{display:flex;align-items:center;min-height:46px;box-sizing:border-box;padding:8px 14px;color:#20394b;border-bottom:1px solid #e2e9ed;text-decoration:none}
 .ycc-category-mobile a[aria-current=page]{font-weight:bold;background:#e5f3fa}
}

.ycc-picker .ycc-picker__selected-patient:not([hidden]) {
    display: grid; gap: 3px; margin: 4px 0 12px; padding: 10px 14px;
    background: #eef7fb; color: #163f55; border: 1px solid #8badbe;
    border-left: 4px solid #17649b; border-radius: 8px; overflow-wrap: anywhere;
}
.ycc-picker__selected-patient span { font-size: 13px; }
.ycc-picker__selected-patient strong { font-size: 18px; line-height: 1.35; }
.ycc-picker [data-done-list] li a:first-child { font-weight: 700; }
