@charset "UTF-8";
/* Vajra Delibio - scanner de la commande rapide (views/js/vajra-scanner.js) */

:root {
    --vs-green: #4a7c59;
    --vs-green-dark: #3a6246;
    --vs-text: #2d3748;
    --vs-muted: #5f6b7a;
    --vs-bg: #f5f7f5;
    --vs-error-bg: #fdecea;
    --vs-error: #9b1c1c;
    --vs-radius: 12px;
}

.vs-overlay[hidden], .vs-sheet[hidden], .vs-backdrop[hidden], .vs-toast[hidden],
.vs-alert[hidden], #vajra-scan [hidden], .vs-btn[hidden], .vs-overlay__session[hidden] {
    display: none !important;
}

html.vs-lock, html.vs-lock body {
    overflow: hidden;
}

/* ---------- bloc sur la page ---------- */
#vajra-scan {
    margin-bottom: 1.5rem;
}

.vs-card {
    background: var(--vs-bg);
    border-radius: var(--vs-radius);
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.vs-card__title {
    margin: 0 0 4px;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--vs-text);
}

.vs-card__subtitle, .vs-card__hint {
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: var(--vs-muted);
}

.vs-card__hint {
    margin: 8px 0 0;
    font-size: 0.8rem;
}

.vs-manual {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.vs-manual__input {
    flex: 1;
    min-width: 0;
    height: 48px;
    padding: 0 12px;
    font-size: 16px; /* 16px minimum : évite le zoom automatique sur iPhone */
    border: 1px solid #c8cfd6;
    border-radius: 8px;
    background: #fff;
}

/* ---------- boutons ---------- */
.vs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 16px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.2;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.vs-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.vs-btn--block {
    display: flex;
    width: 100%;
    margin-top: 8px;
}

.vs-btn--big {
    min-height: 56px;
    font-size: 1.1rem;
}

.vs-btn--primary {
    background: var(--vs-green);
    color: #fff;
}

.vs-btn--primary:active {
    background: var(--vs-green-dark);
}

.vs-btn--secondary {
    background: #e2e8e4;
    color: var(--vs-text);
}

.vs-btn--link {
    background: transparent;
    color: var(--vs-muted);
    font-weight: 400;
}

.vs-btn--ghost {
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    min-height: 44px;
}

.vs-btn--ghost.is-on {
    background: #f2c94c;
    color: #000;
}

.vs-icon {
    font-size: 1.3em;
}

.vs-alert {
    margin: 12px 0 0;
    padding: 12px;
    border-radius: 8px;
    background: var(--vs-error-bg);
    color: var(--vs-error);
    font-size: 0.95rem;
}

.vs-center {
    text-align: center;
}

/* ---------- caméra plein écran ---------- */
.vs-overlay {
    position: fixed;
    inset: 0;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 100000;
    background: #000;
    display: flex;
    flex-direction: column;
}

.vs-overlay__bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 12px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

.vs-overlay__tools {
    display: flex;
    gap: 8px;
}

.vs-overlay__view {
    position: relative;
    flex: 1;
    overflow: hidden;
}

.vs-overlay__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vs-overlay__frame {
    position: absolute;
    left: 10%;
    right: 10%;
    top: 50%;
    height: 28%;
    transform: translateY(-50%);
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.vs-overlay__status {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    margin: 0;
    text-align: center;
    color: #fff;
    font-size: 1rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ---------- fiche produit ---------- */
.vs-backdrop {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    z-index: 100001;
    background: rgba(0, 0, 0, 0.45);
}

.vs-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100002;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    color: var(--vs-text);
}

.vs-sheet__body {
    max-width: 480px;
    margin: 0 auto;
}

.vs-sheet__loading {
    margin: 16px 0;
    text-align: center;
    color: var(--vs-muted);
}

.vs-product {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.vs-product__img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 8px;
    background: var(--vs-bg);
    flex-shrink: 0;
}

.vs-product__info {
    min-width: 0;
}

.vs-product__name {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

.vs-product__meta {
    font-size: 0.875rem;
    color: var(--vs-muted);
}

.vs-product__price {
    margin-top: 2px;
    font-weight: 600;
}

.vs-product__incart {
    margin-top: 4px;
    font-size: 0.875rem;
    color: var(--vs-green-dark);
    font-weight: 600;
}

.vs-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0 4px;
}

.vs-stepper__btn {
    width: 56px;
    height: 56px;
    border: 0;
    border-radius: 50%;
    background: #e2e8e4;
    color: var(--vs-text);
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.vs-stepper__btn:disabled {
    opacity: 0.35;
}

.vs-stepper__value {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
}

.vs-stepper__input {
    width: 88px;
    height: 56px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    border: 2px solid #c8cfd6;
    border-radius: 8px;
    -moz-appearance: textfield;
}

.vs-stepper__input::-webkit-outer-spin-button,
.vs-stepper__input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.vs-stepper__unit {
    font-size: 0.875rem;
    color: var(--vs-muted);
}

.vs-stepper__equals {
    text-align: center;
    font-size: 0.95rem;
    color: var(--vs-muted);
    margin-bottom: 8px;
}

/* ---------- message de confirmation ---------- */
.vs-toast {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    z-index: 100003;
    max-width: 480px;
    margin: 0 auto;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--vs-green-dark);
    color: #fff;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.vs-toast {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.vs-toast__text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vs-toast__action {
    flex-shrink: 0;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

/* caméra ouverte : le message passe en haut, le bas est pris par le compteur */
html.vs-lock .vs-toast {
    top: calc(72px + env(safe-area-inset-top, 0px));
    bottom: auto;
}

/* ---------- mode rafale ---------- */
.vs-switch {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 14px 0 0;
    font-weight: 400;
    color: var(--vs-text);
    cursor: pointer;
}

.vs-switch__input {
    width: 22px;
    height: 22px;
    margin: 1px 0 0;
    flex-shrink: 0;
    accent-color: var(--vs-green);
}

.vs-switch__text {
    display: flex;
    flex-direction: column;
    font-size: 0.95rem;
}

.vs-switch__hint {
    font-size: 0.8rem;
    color: var(--vs-muted);
}

/* ---------- liste en cours ---------- */
.vs-card__session {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #dfe6e1;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--vs-green-dark);
}

.vs-overlay__session {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 8px 8px 14px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
}

.vs-overlay__session .vs-btn {
    flex-shrink: 0;
}

.vs-overlay.has-session .vs-overlay__status {
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}

/* ---------- récapitulatif ---------- */
.vs-recap__title {
    margin: 0 0 4px;
    font-size: 1.15rem;
    font-weight: 700;
}

.vs-recap {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.vs-recap__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid #e6ebe8;
}

.vs-recap__img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--vs-bg);
    flex-shrink: 0;
}

.vs-recap__info {
    flex: 1;
    min-width: 0;
}

.vs-recap__name {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.vs-recap__ctl {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.vs-recap__btn, .vs-recap__del {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: #e2e8e4;
    color: var(--vs-text);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
}

.vs-recap__del {
    background: transparent;
    color: var(--vs-error);
    font-size: 1rem;
}

.vs-recap__btn:disabled, .vs-recap__del:disabled {
    opacity: 0.35;
}

.vs-recap__value {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
}

.vs-recap__total {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 1rem;
}
