/* MVMP Shoppers — Frontend Styles */

/* Dashboard */
.mvmp-shopper-dashboard { max-width: 800px; margin: 0 auto; padding: 20px 0; }

.mvmp-sd-profile {
    display: flex; align-items: center; gap: 16px;
    padding: 20px 24px; background: var(--mvmp-card, #fff);
    border-radius: 14px; border: 1px solid var(--mvmp-border, #e2e8f0);
    margin-bottom: 20px;
}
.mvmp-sd-profile h2 { margin: 0 0 4px; font-size: 1.3rem; }
.mvmp-sd-email { margin: 0; color: #64748b; font-size: .88rem; }

.mvmp-sd-stats {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 14px; margin-bottom: 20px;
}
@media (max-width: 600px) { .mvmp-sd-stats { grid-template-columns: repeat(2, 1fr); } }

.mvmp-sd-stat {
    background: var(--mvmp-card, #fff);
    border: 1px solid var(--mvmp-border, #e2e8f0);
    border-radius: 12px; padding: 16px 12px; text-align: center;
}
.mvmp-sd-stat__icon { font-size: 1.5rem; display: block; margin-bottom: 6px; }
.mvmp-sd-stat__value { display: block; font-size: 1.3rem; font-weight: 700; color: var(--mvmp-primary, #6c47ff); }
.mvmp-sd-stat__label { display: block; font-size: .75rem; color: #64748b; margin-top: 4px; }

.mvmp-sd-redeem {
    background: linear-gradient(135deg, #f0edff 0%, #ece5ff 100%);
    border: 1px solid #d4c9ff; border-radius: 14px;
    padding: 20px 24px; display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.mvmp-sd-redeem strong { font-size: 1rem; }
.mvmp-sd-redeem p { margin: 6px 0 0; font-size: .88rem; color: #4b3b99; }

.mvmp-sd-actions { margin-bottom: 20px; }

.mvmp-sd-section {
    background: var(--mvmp-card, #fff);
    border: 1px solid var(--mvmp-border, #e2e8f0);
    border-radius: 14px; padding: 20px 24px; margin-bottom: 20px;
}
.mvmp-sd-section h3 { margin: 0 0 14px; }

/* Score badge */
.mvmp-score-badge {
    display: inline-flex; align-items: center; gap: 3px;
    background: #fef3c7; color: #d97706; padding: 2px 8px;
    border-radius: 20px; font-size: .8rem; font-weight: 700;
    margin-left: 8px;
}

/* Submission form */
.mvmp-submission-form { max-width: 700px; margin: 0 auto; }
.mvmp-sf-header { margin-bottom: 24px; }
.mvmp-sf-header h2 { margin: 0 0 8px; }

.mvmp-sf-step {
    background: var(--mvmp-card, #fff);
    border: 1px solid var(--mvmp-border, #e2e8f0);
    border-radius: 14px; padding: 20px 24px; margin-bottom: 20px;
}
.mvmp-sf-step__title { margin: 0 0 16px; font-size: 1rem; font-weight: 700; }

.mvmp-sf-field { margin-bottom: 14px; }
.mvmp-sf-field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; color: #374151; }
.mvmp-sf-field input[type="text"],
.mvmp-sf-field input[type="number"],
.mvmp-sf-field select,
.mvmp-sf-field textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--mvmp-border, #e2e8f0);
    border-radius: 8px; font-size: .9rem; box-sizing: border-box;
    transition: border-color .2s;
}
.mvmp-sf-field input:focus,
.mvmp-sf-field select:focus,
.mvmp-sf-field textarea:focus {
    outline: none; border-color: var(--mvmp-primary, #6c47ff);
    box-shadow: 0 0 0 3px rgba(108,71,255,.12);
}

.mvmp-sf-barcode-wrap { display: flex; gap: 10px; align-items: center; }
.mvmp-sf-barcode-wrap input { flex: 1; min-width: 0; }
.mvmp-sf-barcode-status { font-weight: 700; font-size: .88rem; white-space: nowrap; padding: 4px 10px; border-radius: 6px; }
.mvmp-sf-barcode-status.found { background: #d1fae5; color: #065f46; }
.mvmp-sf-barcode-status.new   { background: #fef3c7; color: #d97706; }

.mvmp-sf-price-wrap { display: flex; align-items: center; gap: 6px; }
.mvmp-sf-currency { font-size: 1.1rem; font-weight: 700; }
.mvmp-sf-price-wrap input { flex: 1; min-width: 0; }

/* Inline input + unit row (weight/volume value + unit dropdown).
   CRITICAL: flex children with width:100% still collapse to their
   intrinsic content size unless min-width:0 overrides the default
   min-width:auto. This was the actual cause of "measurement boxes
   too small" — width:100% in the rule above was being ignored. */
.mvmp-sf-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.mvmp-sf-input-row input {
    flex: 1 1 auto;
    min-width: 0;       /* allow shrinking below content size so width:100% actually applies */
    width: auto;        /* let flex-basis control width, not the 100% rule above */
}
.mvmp-sf-input-row select {
    flex: 0 0 auto;
    width: auto;
    min-width: 64px;
}

.mvmp-sf-map { border: 1px solid var(--mvmp-border, #e2e8f0); border-radius: 10px; }
.mvmp-sf-hint { font-size: .78rem; color: #94a3b8; margin: 4px 0 0; }
.mvmp-sf-note { font-size: .88rem; color: #64748b; margin: 0 0 12px; }
.mvmp-sf-new-note { background: #fef3c7; padding: 8px 12px; border-radius: 8px; font-size: .88rem; }

.mvmp-sf-product-preview {
    display: flex; align-items: center; gap: 12px;
    background: #f0edff; border-radius: 10px; padding: 12px 14px;
}
.mvmp-sf-product-preview img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }

.mvmp-sf-submit { text-align: center; margin-top: 10px; }

/* Shared table */
.mvmp-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.mvmp-table th { background: #f8fafc; padding: 8px 12px; text-align: left; font-weight: 700; border-bottom: 2px solid var(--mvmp-border, #e2e8f0); }
.mvmp-table td { padding: 8px 12px; border-bottom: 1px solid var(--mvmp-border, #e2e8f0); }
.mvmp-table tr:hover td { background: #f8fafc; }

/* ──────────────────────── v2.1.0 additions ──────────────────────── */

/* Locked / readonly fields when product is auto-populated */
.mvmp-locked,
.mvmp-sf-field input[readonly],
.mvmp-sf-field select:disabled {
    background: #f1f5f9;
    color: #475569;
    cursor: not-allowed;
    border-color: #cbd5e1;
}
.mvmp-sf-field--readonly { opacity: 0.85; }

/* Inline error messages */
.mvmp-sf-error {
    color: #dc2626;
    font-size: .82rem;
    margin-top: 4px;
    padding: 6px 10px;
    background: #fef2f2;
    border-radius: 6px;
    border-left: 3px solid #dc2626;
}

/* Fieldset (measurement, tax) */
.mvmp-sf-fieldset {
    border: 1px solid var(--mvmp-border, #e2e8f0);
    border-radius: 10px;
    padding: 14px 16px 8px;
    margin: 12px 0;
}
.mvmp-sf-fieldset legend {
    font-weight: 700;
    font-size: .9rem;
    padding: 0 8px;
    color: #475569;
}

/* Measurement 3-column grid */
.mvmp-sf-measure-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
@media (max-width: 600px) {
    .mvmp-sf-measure-grid { grid-template-columns: 1fr; }
}

/* Inline input + unit row */
.mvmp-sf-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.mvmp-sf-input-row input { flex: 1; min-width: 0; }
.mvmp-sf-input-row select { min-width: 70px; }

/* Tax radio group */
.mvmp-sf-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mvmp-sf-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s;
}
.mvmp-sf-radio:hover { background: #f8fafc; }
.mvmp-sf-radio input[type="radio"] { margin: 0; }

/* Suggest edit link */
.mvmp-sf-suggest-edit {
    margin: 8px 0 0;
    font-size: .85rem;
    text-align: right;
}
.mvmp-sf-suggest-edit a {
    color: #6c47ff;
    text-decoration: none;
}
.mvmp-sf-suggest-edit a:hover { text-decoration: underline; }

/* Modal */
.mvmp-sf-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mvmp-sf-modal[hidden] { display: none; }
.mvmp-sf-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.mvmp-sf-modal__dialog {
    position: relative;
    background: #fff;
    border-radius: 14px;
    padding: 28px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}
.mvmp-sf-modal__close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: #64748b;
    line-height: 1;
    padding: 4px 10px;
}
.mvmp-sf-modal__close:hover { color: #1e293b; }
.mvmp-sf-modal__intro {
    color: #64748b;
    font-size: .9rem;
    margin: 0 0 16px;
}
.mvmp-sf-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

/* Hidden helper */
.mvmp-sf-field--hidden { display: none; }

/* ── Red mandatory asterisks (v2.1.1) ──────────────────────────────── */
.required,
label > .required,
legend > .required {
    color: #dc2626;
    font-weight: 700;
}

/* ── Debug panel (shown on JS errors, toggleable with Ctrl+Shift+D) ── */
.mvmp-sf-debug-panel {
    background: #1e293b;
    color: #94a3b8;
    border-radius: 8px;
    padding: 12px 14px;
    margin: 0 0 16px;
    font-size: .78rem;
}
.mvmp-sf-debug-panel h4 {
    color: #e2e8f0;
    margin: 0 0 8px;
    font-size: .82rem;
}
#mvmp-sf-debug-log {
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
    font-family: monospace;
    font-size: .75rem;
    line-height: 1.5;
}

/* ── Disabled / locked store name field ─────────────────────────────── */
.mvmp-sf-field input[disabled],
.mvmp-sf-field input[readonly],
.mvmp-sf-field select[disabled],
.mvmp-locked {
    background: #f1f5f9 !important;
    color: #64748b !important;
    cursor: not-allowed !important;
    border-color: #cbd5e1 !important;
    opacity: 1 !important;       /* override browser default opacity for disabled */
}
.mvmp-sf-field--readonly label::after {
    content: ' (auto-filled)';
    font-size: .75rem;
    color: #94a3b8;
    font-weight: 400;
}

/* ── Frontend Login Box ────────────────────────────────────────── */
.mvmp-login-box {
    max-width: 440px;
    margin: 40px auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 36px 40px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.mvmp-login-box__title {
    margin: 0 0 24px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
}
.mvmp-login-box .mvmp-sf-field {
    margin-bottom: 18px;
}
.mvmp-login-box .mvmp-sf-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #374151;
    font-size: .9rem;
}
.mvmp-login-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color .15s;
    box-sizing: border-box;
}
.mvmp-login-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.mvmp-login-pass-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.mvmp-login-pass-wrap .mvmp-login-input {
    padding-right: 44px;
}
.mvmp-login-toggle-pass {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    color: #94a3b8;
    line-height: 1;
}
.mvmp-login-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: .875rem;
}
.mvmp-sf-check {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #374151;
}
.mvmp-login-forgot {
    color: #6366f1;
    text-decoration: none;
    font-size: .875rem;
}
.mvmp-login-forgot:hover { text-decoration: underline; }
.mvmp-login-submit {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
}
.mvmp-login-notice {
    margin-bottom: 16px;
}
.mvmp-login-box--signed-in {
    text-align: center;
}

/* ── Submission notices (success / error banners) ──────────────────
   These were previously unstyled, so the "please correct..." error
   rendered as nearly-invisible plain text and was easy to miss. */
.mvmp-sf-notices { margin: 0 0 18px; }
.mvmp-sf-notices:empty { margin: 0; }
.mvmp-notice {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: .95rem;
    line-height: 1.45;
    border-left: 4px solid transparent;
    animation: mvmpNoticeIn .25s ease;
}
.mvmp-notice p { margin: 0; }
.mvmp-notice--error {
    background: #fef2f2;
    color: #991b1b;
    border-left-color: #dc2626;
}
.mvmp-notice--success {
    background: #f0fdf4;
    color: #166534;
    border-left-color: #16a34a;
}
.mvmp-notice--info {
    background: #eff6ff;
    color: #1e40af;
    border-left-color: #3b82f6;
}
@keyframes mvmpNoticeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
