/* «Купить в 1 клик» */

/* ---------- кнопки ---------- */
.oc-btn {
    --oc-accent: #111;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    box-sizing: border-box; margin: 0; padding: 0 20px; height: 48px;
    font: inherit; font-size: 15px; font-weight: 500; line-height: 1; white-space: nowrap;
    color: var(--oc-accent); background: transparent;
    border: 1.5px solid var(--oc-accent); border-radius: 10px;
    cursor: pointer; transition: background .15s, color .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}
.oc-btn:hover { color: #fff; background: var(--oc-accent); }
.oc-btn:active { transform: scale(.98); }
.oc-btn:focus-visible { outline: 2px solid var(--oc-accent); outline-offset: 2px; }
.oc-btn__icon { width: 16px; height: 16px; fill: currentColor; flex: none; }
.oc-btn--product { width: 100%; margin-top: 10px; }
.oc-btn--cart { margin-top: 12px; }
.oc-btn--catalog {
    height: 34px; padding: 0 12px; margin-top: 8px; font-size: 13px;
    border-width: 1px; border-radius: 8px; position: relative; z-index: 2;
}
.oc-btn--catalog .oc-btn__icon { width: 13px; height: 13px; }

/* ---------- окно ---------- */
html.oc-lock, html.oc-lock body { overflow: hidden; }

.oc-modal {
    --oc-accent: #111;
    --oc-text: #16181d; --oc-muted: #6b7280; --oc-line: #e6e8ec; --oc-soft: #f5f6f8; --oc-danger: #d92d20;
    position: fixed; inset: 0; z-index: 2147483000;
    display: flex; align-items: center; justify-content: center; padding: 16px;
    font-family: inherit; color: var(--oc-text); -webkit-font-smoothing: antialiased;
}
.oc-modal[hidden] { display: none; }
.oc-modal *, .oc-modal *::before, .oc-modal *::after { box-sizing: border-box; }

.oc-modal__backdrop {
    position: absolute; inset: 0; background: rgba(15, 17, 21, .45);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    opacity: 0; transition: opacity .2s;
}
.oc-modal__box {
    position: relative; width: 100%; max-width: 440px; max-height: calc(100vh - 32px);
    overflow-y: auto; overscroll-behavior: contain;
    background: #fff; border-radius: 18px; box-shadow: 0 24px 64px rgba(0, 0, 0, .18);
    opacity: 0; transform: translateY(12px) scale(.98); transition: opacity .2s, transform .2s;
}
.oc-modal.is-open .oc-modal__backdrop { opacity: 1; }
.oc-modal.is-open .oc-modal__box { opacity: 1; transform: none; }

.oc-modal__close {
    position: absolute; top: 12px; right: 12px; z-index: 1;
    width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
    background: var(--oc-soft); cursor: pointer; display: grid; place-items: center;
    transition: background .15s;
}
.oc-modal__close:hover { background: var(--oc-line); }
.oc-modal__close svg { width: 18px; height: 18px; stroke: var(--oc-text); stroke-width: 2; stroke-linecap: round; fill: none; }

.oc-modal__body { padding: 28px 24px 24px; transition: opacity .15s; }
.oc-modal__body.is-busy { opacity: .6; pointer-events: none; }

.oc-title { margin: 0 44px 6px 0; font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.oc-note { margin: 0 0 18px; font-size: 14px; line-height: 1.45; color: var(--oc-muted); }

/* ---------- товары ---------- */
.oc-items { border: 1px solid var(--oc-line); border-radius: 14px; }
.oc-items--scroll { max-height: 264px; overflow-y: auto; }
.oc-item { display: flex; gap: 12px; padding: 12px; }
.oc-item + .oc-item { border-top: 1px solid var(--oc-line); }
.oc-item__img { width: 64px; height: 64px; flex: none; object-fit: contain; border-radius: 10px; background: var(--oc-soft); }
.oc-item__main { flex: 1; min-width: 0; }
.oc-item__name { font-size: 14px; line-height: 1.35; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.oc-item__sku { margin-top: 2px; font-size: 13px; color: var(--oc-muted); }
.oc-item__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.oc-item__price { font-size: 15px; font-weight: 600; white-space: nowrap; }
.oc-item__qty-fixed { font-size: 13px; color: var(--oc-muted); }

.oc-select {
    display: block; width: 100%; margin-top: 6px; height: 34px; padding: 0 30px 0 10px;
    font: inherit; font-size: 13px; color: var(--oc-text);
    border: 1px solid var(--oc-line); border-radius: 8px; background: #fff;
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236b7280' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; background-size: 11px;
}

.oc-qty { display: inline-flex; align-items: center; height: 32px; border: 1px solid var(--oc-line); border-radius: 8px; overflow: hidden; }
.oc-qty button { width: 32px; height: 100%; padding: 0; border: 0; background: #fff; font-size: 17px; line-height: 1; color: var(--oc-text); cursor: pointer; }
.oc-qty button:hover:not(:disabled) { background: var(--oc-soft); }
.oc-qty button:disabled { color: #c4c8cf; cursor: default; }
.oc-qty input { width: 36px; height: 100%; padding: 0; border: 0; text-align: center; font: inherit; font-size: 14px; color: var(--oc-text); background: #fff; }
.oc-qty input:focus { outline: none; }

.oc-total { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 2px 18px; font-size: 15px; }
.oc-total b { font-size: 20px; font-weight: 700; }

/* ---------- форма ---------- */
.oc-form { margin: 0; }
.oc-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

.oc-field { position: relative; margin-bottom: 12px; }
.oc-field input, .oc-field textarea {
    display: block; width: 100%; margin: 0; padding: 22px 14px 8px; height: 54px;
    font: inherit; font-size: 16px; color: var(--oc-text);
    border: 1px solid var(--oc-line); border-radius: 12px; background: #fff;
    transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.oc-field textarea { height: auto; min-height: 76px; resize: vertical; }
.oc-field input:focus, .oc-field textarea:focus {
    outline: none; border-color: var(--oc-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--oc-accent) 14%, transparent);
}
.oc-field label {
    position: absolute; left: 15px; top: 17px; margin: 0;
    font-size: 16px; line-height: 1.2; color: var(--oc-muted);
    pointer-events: none; transform-origin: left top; transition: transform .15s, color .15s;
}
.oc-field input:focus + label, .oc-field input:not(:placeholder-shown) + label,
.oc-field textarea:focus + label, .oc-field textarea:not(:placeholder-shown) + label { transform: translateY(-9px) scale(.75); }
.oc-field.is-error input { border-color: var(--oc-danger); }
.oc-field.is-error label { color: var(--oc-danger); }
.oc-field__err { font-size: 12px; color: var(--oc-danger); margin: 4px 2px 0; }
.oc-field__err:empty { display: none; }

.oc-link { display: inline-block; margin: 0 0 12px; padding: 0; border: 0; background: none; font: inherit; font-size: 14px; color: var(--oc-muted); cursor: pointer; }
.oc-link:hover { color: var(--oc-text); }
.oc-modal [hidden] { display: none !important; }

.oc-check { display: flex; gap: 10px; align-items: flex-start; margin: 2px 0 14px; font-size: 13px; line-height: 1.4; color: var(--oc-muted); cursor: pointer; }
.oc-check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--oc-accent); }
.oc-check a, .oc-consent a { color: inherit; text-decoration: underline; }

.oc-error { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--oc-danger); background: #fef3f2; }
.oc-error[hidden] { display: none; }
.oc-warn { margin: 12px 0 0; font-size: 13px; color: var(--oc-danger); text-align: center; }

.oc-submit {
    position: relative; display: flex; align-items: center; justify-content: center;
    width: 100%; height: 52px; margin: 0; padding: 0 20px;
    font: inherit; font-size: 16px; font-weight: 600; color: #fff;
    border: 0; border-radius: 12px; background: var(--oc-accent);
    cursor: pointer; transition: opacity .15s, transform .1s;
}
.oc-submit:hover { opacity: .9; }
.oc-submit:active { transform: scale(.99); }
.oc-submit:disabled { opacity: .45; cursor: default; transform: none; }
.oc-submit:focus { outline: none; }
.oc-submit:focus-visible, .oc-modal__close:focus-visible, .oc-link:focus-visible, .oc-qty button:focus-visible {
    outline: 2px solid var(--oc-accent); outline-offset: 2px;
}
.oc-form.is-sending .oc-submit span { opacity: 0; }
.oc-form.is-sending .oc-submit::after {
    content: ''; position: absolute; width: 20px; height: 20px;
    border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%;
    animation: oc-spin .7s linear infinite;
}
.oc-consent { margin: 12px 0 0; font-size: 12px; line-height: 1.45; color: var(--oc-muted); text-align: center; }

/* ---------- состояния ---------- */
.oc-loading { display: grid; place-items: center; min-height: 220px; }
.oc-spinner { width: 28px; height: 28px; border: 2.5px solid var(--oc-line); border-top-color: var(--oc-accent); border-radius: 50%; animation: oc-spin .7s linear infinite; }
@keyframes oc-spin { to { transform: rotate(360deg); } }

.oc-state { padding: 16px 0 0; text-align: center; }
.oc-state .oc-title { margin: 0 0 8px; }
.oc-state p { margin: 0 0 22px; font-size: 15px; line-height: 1.5; color: var(--oc-muted); }
.oc-check-anim { width: 64px; height: 64px; margin: 4px auto 16px; display: block; }
.oc-check-anim circle { fill: none; stroke: #12b76a; stroke-width: 2.5; stroke-dasharray: 151; stroke-dashoffset: 151; animation: oc-draw .5s ease-out forwards; }
.oc-check-anim path { fill: none; stroke: #12b76a; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 36; stroke-dashoffset: 36; animation: oc-draw .3s .4s ease-out forwards; }
@keyframes oc-draw { to { stroke-dashoffset: 0; } }

/* ---------- телефон: окно снизу ---------- */
@media (max-width: 600px) {
    .oc-modal { align-items: flex-end; padding: 0; }
    .oc-modal__box {
        max-width: none; max-height: 92vh; border-radius: 20px 20px 0 0;
        transform: translateY(100%); transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .2, 1);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .oc-modal__box::before { content: ''; display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: var(--oc-line); }
    .oc-modal__body { padding: 16px 18px 20px; }
    .oc-title { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .oc-modal__box, .oc-modal__backdrop, .oc-btn { transition: none; }
}
