/* ── verif_shared.css — Styles communs aux vues de vérification mobile ───
   Inclus par verify.php et stock_verify.php.
   Chaque vue conserve uniquement ses styles spécifiques dans un <style> inline.
────────────────────────────────────────────────────────────────────────────── */

a { color: inherit; text-decoration: none; }
a:visited { color: inherit; }

/* Padding page pour la barre d'action fixe */
.m-body { padding-bottom: 72px; }

/* ── Barre d'action fixe ──────────────────────────────────────────────────── */
#v-action-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: none;
    gap: 6px;
    padding: 8px 8px;
    padding-bottom: max(8px, calc(8px + env(safe-area-inset-bottom)));
    background: rgba(255,255,255,.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 2px solid #e0e5ec;
    box-shadow: 0 -4px 16px rgba(0,0,0,.12);
    z-index: 200;
    align-items: stretch;
}
#v-action-bar.mode-view { display: flex; }
#v-action-bar.mode-edit { display: flex; }
#v-action-view-btns { display: flex; gap: 6px; flex: 1; }
#v-action-edit-btns { display: none; flex: 1; gap: 6px; }
#v-action-bar.mode-edit #v-action-view-btns { display: none; }
#v-action-bar.mode-edit #v-action-edit-btns { display: flex; }

/* ── Boutons d'action ─────────────────────────────────────────────────────── */
.v-ref-btn-reset {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center; gap: 5px;
    padding: 0 14px; height: 44px;
    background: #fff; color: #64748b;
    border: 1.5px solid #e0e5ec; border-radius: 10px;
    font-size: 14px; font-weight: 700; font-family: inherit;
    cursor: pointer; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}
.v-ref-btn-reset:active { background: #f1f5f9; }

.v-ref-btn-validate,
.v-ref-btn-validate-edit {
    flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 0 10px; height: 44px;
    background: #00a8ff; color: #fff;
    border: none; border-radius: 10px;
    font-size: 15px; font-weight: 800; font-family: inherit;
    cursor: pointer; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background .12s;
}
.v-ref-btn-validate:active,
.v-ref-btn-validate-edit:active { background: #0090d9; }

.v-ref-btn-edit {
    flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 0 16px; height: 44px;
    background: transparent;
    border: 1.5px solid #e0e5ec; border-radius: 10px;
    font-size: 15px; font-weight: 800; font-family: inherit;
    cursor: pointer; color: #444; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background .12s, border-color .12s;
}
.v-ref-btn-edit:active { background: #f0f0f0; border-color: #bbb; }

/* ── Barre de progression ─────────────────────────────────────────────────── */
.v-ref-progress {
    position: sticky; top: 0; z-index: 100;
    background: #f4f6f9;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    display: flex; align-items: center; gap: 8px;
    padding: 10px 4px 8px;
}
.v-ref-progress-bar {
    flex: 1; height: 6px;
    background: #e0e5ec; border-radius: 3px; overflow: hidden;
}
.v-ref-progress-fill {
    height: 100%; background: #00a8ff;
    border-radius: 3px; transition: width .35s ease;
}
.v-ref-progress-label {
    font-size: 13px; font-weight: 800; color: #555; white-space: nowrap;
}

/* ── Cartes de référence ──────────────────────────────────────────────────── */
.v-ref-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    margin-bottom: 4px;
    overflow: hidden;
    border-left: 4px solid transparent;
    transition: border-color .2s, box-shadow .2s, opacity .2s;
}
.v-ref-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; min-height: 44px; gap: 8px;
    cursor: default; -webkit-tap-highlight-color: transparent; user-select: none;
}
/* Conteneur titre + dot (kit) ou div inline (stock) */
.v-ref-card-title {
    display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
}
.v-ref-card-name {
    font-size: 14px; font-weight: 700; color: #1e2a3a;
    white-space: normal; line-height: 1.3; flex: 1;
}
.v-ref-card-meta {
    display: flex; align-items: center; gap: 4px;
    flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end;
}
.v-ref-done-icon  { width: 16px; height: 16px; color: #27ae60; flex-shrink: 0; display: none; }
.v-ref-chevron    { width: 14px; height: 14px; color: #bbb; flex-shrink: 0; display: none; transition: transform .2s; }
.v-ref-card-body  { padding: 0 12px 12px; }

/* ── États des cartes ────────────────────────────────────────────────────── */
.v-ref-card.state-pending .v-ref-card-body { display: none; }
.v-ref-card.state-pending .v-ref-chevron   { display: none; }
.v-ref-card.state-pending .v-ref-done-icon { display: none; }

.v-ref-card.state-active-view {
    border-left-color: #00a8ff;
    box-shadow: 0 2px 10px rgba(0,168,255,.15);
}
.v-ref-card.state-active-view .v-ref-card-header  { padding: 12px; background: #f8fbff; min-height: 52px; }
.v-ref-card.state-active-view .v-ref-card-name    { font-size: 15px; line-height: 1.2; white-space: normal; }
.v-ref-card.state-active-view .v-ref-card-body    { display: block; }
.v-ref-card.state-active-view .v-qty-ctrl         { display: flex !important; }
.v-ref-card.state-active-view .v-qty-btn          { display: none !important; }
.v-ref-card.state-active-view .v-qty-display      { font-size: 22px; font-weight: 800; color: #1e2a3a; min-width: 28px; }
.v-ref-card.state-active-view .v-expired-wrap     { display: none !important; }
.v-ref-card.state-active-view .v-add-btn          { display: none !important; }
.v-ref-card.state-active-view .v-add-form         { display: none !important; }
.v-ref-card.state-active-view .v-remove-new-batch { display: none !important; }
.v-ref-card.state-active-view .v-ref-chevron      { display: block; transform: rotate(-90deg); }
.v-ref-card.state-active-view .v-ref-done-icon    { display: none; }

.v-ref-card.state-active-edit {
    border-left-color: #00a8ff;
    box-shadow: 0 2px 12px rgba(0,168,255,.18);
}
.v-ref-card.state-active-edit .v-ref-card-header  { padding: 12px; background: #f8fbff; min-height: 52px; }
.v-ref-card.state-active-edit .v-ref-card-name    { font-size: 15px; line-height: 1.2; white-space: normal; }
.v-ref-card.state-active-edit .v-ref-card-body    { display: block; }
.v-ref-card.state-active-edit .v-qty-ctrl         { display: flex; }
.v-ref-card.state-active-edit .v-expired-wrap     { display: flex; }
.v-ref-card.state-active-edit .v-add-btn          { display: flex; }
.v-ref-card.state-active-edit .v-ref-chevron      { display: block; transform: rotate(90deg); }
.v-ref-card.state-active-edit .v-ref-done-icon    { display: none; }

.v-ref-card.state-done { opacity: .82; }
.v-ref-card.state-done .v-ref-card-body    { display: none; }
.v-ref-card.state-done .v-ref-chevron      { display: none; }
.v-ref-card.state-done .v-ref-done-icon    { display: block; }
.v-ref-card.state-done .v-ref-card-header  { cursor: pointer; background: #fafafa; }
.v-ref-card.state-done .v-ref-card-name    { color: #888; }

/* ── Lignes de lot ────────────────────────────────────────────────────────── */
.v-batch-row {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; background: #f4f7fb;
    border-radius: 8px; margin-bottom: 6px; min-height: 40px;
    transition: opacity .15s;
}
.v-batch-row.is-expired       { opacity: .5; }
.v-batch-row.is-expiring-warn { background: #fff5e8; }
.v-batch-meta  { flex: 1; min-width: 0; }
.v-batch-label {
    font-size: 13px; font-weight: 700; color: #2f3640;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.v-batch-sublabel { font-size: 12px; color: #999; margin-top: 2px; }
.v-batch-exp      { font-size: 12px; color: #888; margin-top: 2px; }
.v-batch-exp.warn    { color: #a05c00; font-weight: 600; }
.v-batch-exp.soon    { color: #e67e22; font-weight: 700; }
.v-batch-exp.expired { color: #c0392b; font-weight: 700; }

/* ── Contrôles quantité ───────────────────────────────────────────────────── */
.v-qty-ctrl { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.v-qty-btn {
    width: 32px; height: 32px; border-radius: 8px;
    border: 1.5px solid #e0e5ec; background: #fff;
    font-size: 18px; font-weight: 700; color: #1e2a3a;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .1s, border-color .1s; flex-shrink: 0;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.v-qty-btn:active   { background: #e8f4ff; border-color: #00a8ff; }
.v-qty-btn:disabled { opacity: .3; cursor: default; }
.v-qty-display {
    min-width: 22px; width: 44px; text-align: center;
    font-size: 16px; font-weight: 800; color: #1e2a3a;
    border: none; background: transparent;
    font-family: inherit; padding: 0;
    -moz-appearance: textfield;
}
.v-qty-display::-webkit-inner-spin-button,
.v-qty-display::-webkit-outer-spin-button { display: none; }
.state-active-edit .v-qty-display {
    border: 1.5px solid #cbd5e1; border-radius: 6px;
    background: #fff; padding: 2px 4px;
}

/* ── Toggle périmé ────────────────────────────────────────────────────────── */
.v-expired-wrap  { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.v-expired-check { width: 18px; height: 18px; cursor: pointer; accent-color: #e74c3c; }
.v-expired-label { font-size: 12px; color: #e74c3c; font-weight: 700; cursor: pointer; white-space: nowrap; }

/* ── Bouton + formulaire ajout de lot ─────────────────────────────────────── */
.v-add-btn {
    display: flex; align-items: center; gap: 6px; width: 100%;
    padding: 10px 12px; background: transparent;
    border: 2px dashed #00a8ff; border-radius: 8px;
    color: #00a8ff; font-size: 13px; font-weight: 700; font-family: inherit;
    cursor: pointer; margin-top: 6px; transition: background .15s; touch-action: manipulation;
}
.v-add-btn:active { background: #e8f4ff; }

.v-add-form {
    background: #f0f7ff; border: 1.5px solid #c0ddf5;
    border-radius: 10px; padding: 12px; margin-top: 6px;
}
.v-add-form .m-field          { margin-bottom: 8px; }
.v-add-form .m-field label    { font-size: 12px; }
.v-add-form .m-field input    { font-size: 14px; padding: 8px 10px; }
.v-add-form-row               { display: flex; gap: 8px; }
.v-add-form-row .m-field      { flex: 1; margin-bottom: 0; }
.v-add-form-actions           { display: flex; gap: 8px; margin-top: 10px; }

.v-add-confirm-btn {
    flex: 1; padding: 10px 8px; background: #00a8ff; color: #fff;
    border: none; border-radius: 8px; font-size: 13px; font-weight: 700;
    font-family: inherit; cursor: pointer; touch-action: manipulation;
}
.v-add-cancel-btn {
    padding: 10px 14px; background: transparent; border: 1.5px solid #ccc;
    border-radius: 8px; font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer; color: #666; touch-action: manipulation;
}
.v-add-expiry-btn {
    width: 100%; padding: 8px 10px; background: #fff; border: 1.5px solid #c0ddf5;
    border-radius: 8px; font-size: 13px; font-weight: 600; font-family: inherit;
    color: #0078c8; cursor: pointer; text-align: left; transition: border-color .15s;
    touch-action: manipulation;
}
.v-add-expiry-btn.has-date            { color: #1e2a3a; }
.v-add-expiry-btn.no-expiry           { color: #bbb; border-color: #e8e8e8; background: #fafafa; }
.v-add-expiry-btn.no-expiry.has-date  { color: #1e2a3a; border-color: #c0ddf5; background: #fff; }
.v-add-expiry-btn.required-error      { border-color: #e74c3c !important; color: #e74c3c !important; background: #fff5f5; }

/* ── Récapitulatif ────────────────────────────────────────────────────────── */
#v-summary-card { padding: 0 8px; }
.v-summary-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px;
}
.v-summary-item:last-child { border-bottom: none; }
.v-summary-badge {
    font-size: 11px; font-weight: 700; padding: 2px 8px;
    border-radius: 20px; white-space: nowrap; flex-shrink: 0; margin-top: 1px;
}
.badge-expired  { background: #fde; color: #c0392b; }
.badge-modified { background: #e8f4ff; color: #0078c8; }
.badge-added    { background: #eafaf1; color: #1a7a32; }
.v-expiry-warn-badge {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: 11px; font-weight: 700; color: #a05c00;
    background: #fff0d6; border-radius: 6px; padding: 2px 6px;
    white-space: nowrap; flex-shrink: 0;
}
.v-summary-desc { flex: 1; color: #444; }
.v-summary-back-btn {
    width: 100%; padding: 10px; background: transparent;
    border: 1.5px solid #e0e5ec; border-radius: 8px;
    font-size: 13px; font-weight: 700; font-family: inherit;
    cursor: pointer; color: #666; margin-top: 8px; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.v-summary-back-btn:active { background: #f0f0f0; }

/* ── Alerte vérification en attente ──────────────────────────────────────── */
.v-pending-warn {
    background: #fff8e1; border: 1px solid #ffc107; border-radius: 0;
    padding: 8px 12px; font-size: 13px; color: #856404; margin: 0 0 4px;
}

/* ── Modal date de péremption ─────────────────────────────────────────────── */
.kv-expiry-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 9999;
    align-items: center; justify-content: center; padding: 12px;
}
.kv-expiry-inner {
    background: #fff; border-radius: 20px; padding: 20px 18px 16px;
    width: 100%; max-width: 96vw; text-align: center;
    box-shadow: 0 10px 32px rgba(0,0,0,.2);
}
.kv-expiry-inner h3 { font-size: 16px; font-weight: 700; margin: 0 0 6px; color: #1e2a3a; }
.kv-expiry-display {
    display: flex; justify-content: center; align-items: center;
    gap: 10px; margin: 12px 0 6px; font-size: 32px;
}
.kv-exp-sep  { color: #999; font-weight: 300; }
.kv-exp-field {
    flex: 1; padding: 8px 0; border: 2px solid #ddd; border-radius: 10px;
    text-align: center; color: #aaa; background: #f8f8f8;
    transition: border-color .15s, color .15s, background .15s;
    letter-spacing: 3px; font-size: 24px;
}
.kv-exp-field.active { border-color: #00a8ff; background: #fff; color: #111; }
.kv-exp-field.filled { color: #111; background: #fff; }
.kv-exp-error { color: #e84118; font-size: 12px; min-height: 16px; margin-bottom: 6px; font-weight: 500; }
.kv-exp-keypad {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 10px;
}
.kv-exp-key {
    height: 52px; font-size: 20px; font-weight: 600; border: none;
    border-radius: 10px; background: #f0f0f0; cursor: pointer;
    touch-action: manipulation; user-select: none;
    -webkit-tap-highlight-color: transparent; transition: background .1s;
}
.kv-exp-key:active    { background: #d0d0d0; }
.kv-exp-key-back      { background: #ffe0e0; color: #c0392b; }
.kv-exp-key-ok        { background: #00a8ff; color: #fff; font-size: 18px; }
.kv-exp-key-ok:active { background: #0090d9; }
.kv-exp-cancel {
    width: 100%; padding: 10px; border: none; background: transparent;
    color: #888; font-size: 13px; font-weight: 600; font-family: inherit;
    cursor: pointer; touch-action: manipulation;
}
