/* Meijer Shopper — style.css
   Mobile-first, clean professional design */

/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
    --primary: #003087;
    --primary-light: #0057b8;
    --success: #16a34a;
    --success-bg: #dcfce7;
    --warn: #b45309;
    --warn-bg: #fef3c7;
    --error: #dc2626;
    --error-bg: #fee2e2;
    --text: #111827;
    --text-muted: #6b7280;
    --bg: #f0f4f9;
    --card: #ffffff;
    --border: #e5e7eb;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,48,135,0.08);
    --shadow-md: 0 4px 16px rgba(0,48,135,0.15);
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.app-header {
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 640px;
    margin: 0 auto;
}
.app-title { font-size: 1.15rem; font-weight: 700; color: #fff; }

/* ── Container ─────────────────────────────────────────────────────────────── */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 20px 16px 100px;
}

/* ── Step visibility ───────────────────────────────────────────────────────── */
.step { display: none; }
.step.active { display: block; }
.hidden { display: none !important; }

.step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.step-header h2 { font-size: 1.2rem; font-weight: 700; }
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
}
.step-desc { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 18px; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid transparent;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary-light); }

.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { filter: brightness(1.1); }

.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; border-radius: 6px; border-width: 1.5px; }
.btn-sm.btn-outline { color: rgba(255,255,255,0.9); border-color: rgba(255,255,255,0.5); }
.btn-sm.btn-outline:hover { background: rgba(255,255,255,0.15); color: #fff; }

.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: 10px; }
.btn-block { width: 100%; }

/* ── Action Bar ────────────────────────────────────────────────────────────── */
.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
}
.sticky-bar {
    position: sticky;
    bottom: 16px;
    background: var(--bg);
    padding: 12px 0 4px;
    border-top: 1px solid var(--border);
    z-index: 10;
}
.count-badge {
    background: var(--border);
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ── Keyword Input ─────────────────────────────────────────────────────────── */
.keyword-actions { margin-bottom: 14px; }
.divider-text { text-align: center; color: var(--text-muted); font-size: 0.82rem; margin: 10px 0; }
.keyword-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Inter', monospace;
    font-size: 0.95rem;
    line-height: 1.75;
    resize: vertical;
    min-height: 200px;
    background: var(--card);
    color: var(--text);
    transition: border-color 0.2s;
}
.keyword-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,48,135,0.1);
}

/* ── Match Cards ───────────────────────────────────────────────────────────── */
.match-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}
.match-card.match-exact   { border-left: 4px solid var(--success); }
.match-card.match-multiple { border-left: 4px solid #d97706; }
.match-card.match-none    { border-left: 4px solid var(--error); }

.match-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.match-keyword { font-weight: 600; font-size: 0.93rem; }
.match-status {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.status-ok   { background: var(--success-bg); color: var(--success); }
.status-warn { background: var(--warn-bg);    color: var(--warn); }
.status-err  { background: var(--error-bg);   color: var(--error); }

.match-product { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.match-product strong { font-size: 0.92rem; }
.match-category {
    display: inline-block;
    font-size: 0.74rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 7px;
    border-radius: 4px;
}
.match-url { font-size: 0.7rem; color: var(--primary); word-break: break-all; opacity: 0.65; text-decoration: none; }
.match-hint { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 8px; }

/* ── Radio Options ─────────────────────────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
}
.radio-option.selected { border-color: var(--primary); background: #eff6ff; }
.radio-option input[type=radio] { margin-top: 3px; accent-color: var(--primary); flex-shrink: 0; }
.radio-label { display: flex; flex-direction: column; gap: 2px; }
.radio-label strong { font-size: 0.88rem; }
.radio-label small { font-size: 0.76rem; color: var(--text-muted); }

/* ── Retry / Skip ──────────────────────────────────────────────────────────── */
.retry-row { display: flex; gap: 8px; margin-bottom: 10px; }
.retry-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.88rem;
    background: var(--card);
    transition: border-color 0.2s;
}
.retry-input:focus { outline: none; border-color: var(--primary); }
.skip-option { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-muted); cursor: pointer; }
.skip-option input { accent-color: var(--primary); }

/* ── Status Messages ───────────────────────────────────────────────────────── */
.status-msg {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    margin-top: 14px;
    border: 1.5px solid transparent;
}
.status-msg.info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.status-msg.success { background: var(--success-bg); border-color: #86efac; color: var(--success); }
.status-msg.error   { background: var(--error-bg); border-color: #fca5a5; color: var(--error); }

/* ── Item Table (cart.php) ─────────────────────────────────────────────────── */
.item-table-wrapper { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: var(--shadow);
}
.item-num {
    min-width: 26px;
    height: 26px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
}
.item-info { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.item-info strong { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-info small { font-size: 0.74rem; color: var(--text-muted); }
.item-link { font-size: 1.1rem; text-decoration: none; flex-shrink: 0; opacity: 0.5; }
.item-link:hover { opacity: 1; }

/* ── Extension hint ────────────────────────────────────────────────────────── */
.extension-hint {
    margin-top: 12px;
    background: var(--warn-bg);
    border: 1.5px solid #fcd34d;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.82rem;
    color: var(--warn);
}

/* ── Progress Log ──────────────────────────────────────────────────────────── */
.progress-log {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 12px;
}
.log-entry {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}
.log-entry.log-added    { border-color: #86efac; }
.log-entry.log-out_of_stock { border-color: #fcd34d; }
.log-entry.log-error    { border-color: #fca5a5; }
.log-icon { font-size: 1.2rem; flex-shrink: 0; }
.log-info { flex: 1; display: flex; flex-direction: column; }
.log-info strong { font-size: 0.88rem; }
.log-info small { font-size: 0.74rem; color: var(--text-muted); }
.log-label { font-size: 0.76rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; }

/* ── Report ────────────────────────────────────────────────────────────────── */
.report-list { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.report-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}
.report-icon { font-size: 1.2rem; flex-shrink: 0; }
.report-info { flex: 1; display: flex; flex-direction: column; }
.report-info strong { font-size: 0.88rem; }
.report-detail { font-size: 0.74rem; color: var(--text-muted); }
.badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}
.badge.status-ok   { background: var(--success-bg); color: var(--success); }
.badge.status-warn { background: var(--warn-bg); color: var(--warn); }
.badge.status-err  { background: var(--error-bg); color: var(--error); }

.empty-msg, .loading-msg, .error-msg { text-align: center; color: var(--text-muted); padding: 24px; }
.empty-msg a, .error-msg a { color: var(--primary); }

/* ── Responsive tweaks ─────────────────────────────────────────────────────── */
@media (max-width: 400px) {
    .action-bar { flex-direction: column; }
    .action-bar .btn { width: 100%; }
    .match-card-header { flex-direction: column; align-items: flex-start; }
}
