/* ── GNIS Marketplace — Vendor Portal Styles ───────────────────── */

.mkt-vendor-portal {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 1100px;
    margin: 0 auto;
    color: #1a1a2e;
}

/* ── Gate ───────────────────────────────────────────────────────── */
.mkt-vendor-gate {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* ── Portal Header ──────────────────────────────────────────────── */
.mkt-portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0 20px;
    border-bottom: 2px solid #e8ecf0;
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 16px;
}
.mkt-portal-greeting {
    display: flex;
    align-items: center;
    gap: 14px;
}
.mkt-portal-icon { font-size: 36px; }
.mkt-portal-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
}
.mkt-portal-sub {
    margin: 2px 0 0;
    color: #666;
    font-size: 14px;
}
.mkt-portal-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.mkt-stat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f4f7fb;
    border: 1px solid #dde3ec;
    border-radius: 10px;
    padding: 10px 20px;
    min-width: 90px;
}
.mkt-stat-num {
    font-size: 22px;
    font-weight: 700;
    color: #1a73e8;
}
.mkt-stat-lbl {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ── Tab Bar ────────────────────────────────────────────────────── */
.mkt-tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #dde3ec;
    margin-bottom: 28px;
}
.mkt-tab {
    background: none;
    border: none;
    padding: 14px 26px;
    font-size: 15px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: color .2s, border-color .2s;
    position: relative;
}
.mkt-tab:hover { color: #1a73e8; }
.mkt-tab.active {
    color: #1a73e8;
    border-bottom-color: #1a73e8;
}
.mkt-tab-icon { font-size: 16px; }
.mkt-tab-badge {
    background: #e53935;
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 700;
}

/* ── Panel Toolbar ──────────────────────────────────────────────── */
.mkt-panel-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}
.mkt-panel-intro {
    margin: 0;
    color: #666;
    font-size: 14px;
}
.mkt-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Card ───────────────────────────────────────────────────────── */
.mkt-card {
    background: #fff;
    border: 1px solid #dde3ec;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.mkt-form-heading {
    margin: 0 0 20px;
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

/* ── Form Grid ──────────────────────────────────────────────────── */
.mkt-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 24px;
}
.mkt-field { display: flex; flex-direction: column; gap: 5px; }
.mkt-col-2 { grid-column: span 2; }
.mkt-label { font-size: 13px; font-weight: 600; color: #333; }
.mkt-req { color: #e53935; }
.mkt-input, .mkt-select {
    padding: 9px 12px;
    border: 1px solid #cdd4de;
    border-radius: 6px;
    font-size: 14px;
    color: #1a1a2e;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    width: 100%;
    box-sizing: border-box;
}
.mkt-input:focus, .mkt-select:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}
textarea.mkt-input { resize: vertical; }
.mkt-select-sm { width: auto; min-width: 160px; }
.mkt-field-hint { font-size: 12px; color: #888; }

/* ── Toggle Checkbox ────────────────────────────────────────────── */
.mkt-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}
.mkt-toggle-input { display: none; }
.mkt-toggle {
    width: 42px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    position: relative;
    flex-shrink: 0;
    transition: background .2s;
}
.mkt-toggle::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: left .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.mkt-toggle-input:checked + .mkt-toggle { background: #1a73e8; }
.mkt-toggle-input:checked + .mkt-toggle::after { left: 21px; }

/* ── Form Footer ────────────────────────────────────────────────── */
.mkt-form-footer {
    display: flex;
    gap: 10px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid #eee;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.mkt-btn {
    padding: 9px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .2s, opacity .2s;
    text-decoration: none;
    display: inline-block;
}
.mkt-btn:disabled { opacity: .55; cursor: not-allowed; }
.mkt-btn-primary { background: #1a73e8; color: #fff; }
.mkt-btn-primary:hover { background: #1558b0; }
.mkt-btn-ghost { background: #f4f7fb; color: #333; border: 1px solid #cdd4de; }
.mkt-btn-ghost:hover { background: #e8ecf0; }
.mkt-btn-sm { padding: 5px 12px; font-size: 12px; }
.mkt-btn-danger { background: #fdecea; color: #c62828; border: 1px solid #f5c6cb; }
.mkt-btn-danger:hover { background: #f5c6cb; }
.mkt-btn-confirm { background: #e8f5e9; color: #1b5e20; border: 1px solid #c8e6c9; }
.mkt-btn-confirm:hover { background: #c8e6c9; }

/* ── Message ────────────────────────────────────────────────────── */
.mkt-msg {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 10px;
}
.mkt-msg.success { background: #e8f5e9; border: 1px solid #c8e6c9; color: #1b5e20; }
.mkt-msg.error   { background: #fdecea; border: 1px solid #f5c6cb; color: #c62828; }

/* ── Status Badges ──────────────────────────────────────────────── */
.mkt-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.mkt-badge-active,
.mkt-badge-delivered,
.mkt-badge-paid        { background: #e8f5e9; color: #1b5e20; }
.mkt-badge-inactive,
.mkt-badge-cancelled,
.mkt-badge-failed      { background: #fdecea; color: #c62828; }
.mkt-badge-pending,
.mkt-badge-on_hold     { background: #fff8e1; color: #f57f17; }
.mkt-badge-confirmed,
.mkt-badge-processing  { background: #e3f2fd; color: #0d47a1; }
.mkt-badge-dispatched  { background: #f3e5f5; color: #4a148c; }

/* ── Table ──────────────────────────────────────────────────────── */
.mkt-table-wrap { overflow-x: auto; }
.mkt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.mkt-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #888;
    border-bottom: 2px solid #e8ecf0;
    white-space: nowrap;
}
.mkt-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}
.mkt-table tr:last-child td { border-bottom: none; }
.mkt-table tr:hover td { background: #fafbfc; }
.mkt-loading-cell { text-align: center; color: #aaa; padding: 30px !important; font-style: italic; }
.mkt-empty-cell   { text-align: center; color: #aaa; padding: 40px !important; }
.mkt-item-name { font-weight: 600; color: #1a1a2e; }
.mkt-item-barcode { font-size: 12px; color: #888; }
.mkt-actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Earnings Summary ───────────────────────────────────────────── */
.mkt-earnings-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.mkt-earn-card {
    background: #fff;
    border: 1px solid #dde3ec;
    border-radius: 10px;
    padding: 22px 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.mkt-earn-label { font-size: 13px; color: #888; margin-bottom: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.mkt-earn-value { font-size: 28px; font-weight: 700; color: #1a1a2e; }
.mkt-earn-pending { color: #f57f17; }
.mkt-earn-paid    { color: #2e7d32; }

/* ── Drawer (Order Detail) ──────────────────────────────────────── */
.mkt-drawer {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9999;
    display: flex;
    justify-content: flex-end;
}
.mkt-drawer-box {
    background: #fff;
    width: 420px;
    max-width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 28px;
    box-shadow: -4px 0 20px rgba(0,0,0,.15);
    animation: mkt-slide-in .25s ease;
}
@keyframes mkt-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.mkt-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eee;
}
.mkt-drawer-header h4 { margin: 0; font-size: 17px; }
.mkt-drawer-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #888;
    padding: 4px 8px;
    border-radius: 4px;
}
.mkt-drawer-close:hover { background: #f4f7fb; }
.mkt-drawer-row {
    display: flex;
    justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}
.mkt-drawer-row:last-child { border-bottom: none; }
.mkt-drawer-key { color: #888; font-weight: 600; }
.mkt-drawer-val { color: #1a1a2e; text-align: right; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .mkt-portal-header { flex-direction: column; align-items: flex-start; }
    .mkt-form-grid { grid-template-columns: 1fr; }
    .mkt-col-2 { grid-column: span 1; }
    .mkt-earnings-summary { grid-template-columns: 1fr; }
    .mkt-tab { padding: 12px 14px; font-size: 13px; }
    .mkt-tab-bar { gap: 0; }
    .mkt-panel-toolbar { flex-direction: column; align-items: flex-start; }
}


/* ═══════════════════════════════════════════════════════════════════
   SEARCHABLE ITEM PICKER  (v1.2.0)
   Replaces the plain <select> in the New Listing / Edit Listing form.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Wrapper ─────────────────────────────────────────────────────── */
.mkt-item-picker {
    position: relative;
    width: 100%;
    font-family: inherit;
    font-size: 14px;
}

/* ── Text input row ──────────────────────────────────────────────── */
.mkt-item-picker-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.mkt-item-search-input {
    width: 100%;
    padding: 10px 40px 10px 14px; /* room for chevron + clear */
    border: 1.5px solid #cdd4de;
    border-radius: 8px;
    font-size: 14px;
    color: #1a1a2e;
    background: #fff;
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
    cursor: pointer;
}

.mkt-item-search-input:focus {
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, .13);
    cursor: text;
}

.mkt-item-search-input:disabled {
    background: #f4f7fb;
    color: #aaa;
    cursor: not-allowed;
}

/* Chevron icon */
.mkt-item-picker-chevron {
    position: absolute;
    right: 30px;
    color: #9aa5b4;
    pointer-events: all;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    padding: 4px 6px;
    transition: color .15s;
}
.mkt-item-picker-chevron:hover { color: #1a73e8; }

/* Clear (✕) icon */
.mkt-item-picker-clear {
    position: absolute;
    right: 8px;
    color: #9aa5b4;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 6px;
    border-radius: 50%;
    line-height: 1;
    transition: background .15s, color .15s;
}
.mkt-item-picker-clear:hover {
    background: #f0f0f0;
    color: #c62828;
}

/* ── Dropdown listbox ────────────────────────────────────────────── */
.mkt-item-listbox {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #cdd4de;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    z-index: 9999;
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
}

/* ── Individual option ───────────────────────────────────────────── */
.mkt-picker-option {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f4f8;
    transition: background .12s;
    outline: none;
}
.mkt-picker-option:last-child { border-bottom: none; }

.mkt-picker-option:hover,
.mkt-picker-option-focus {
    background: #f0f6ff;
}

/* Already-listed items get a subtle tint */
.mkt-picker-option-listed {
    background: #f5fff5;
}
.mkt-picker-option-listed:hover,
.mkt-picker-option-listed.mkt-picker-option-focus {
    background: #e8f5e9;
}

/* Option text parts */
.mkt-picker-name {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.mkt-picker-barcode {
    font-size: 12px;
    color: #888;
    font-weight: 400;
    font-family: monospace;
}

.mkt-picker-desc {
    font-size: 12px;
    color: #9aa5b4;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* "✓ Listed" badge inside option */
.mkt-picker-listed-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    border: 1px solid #c8e6c9;
    white-space: nowrap;
}

/* Search match highlight */
mark.mkt-picker-hl {
    background: #fff176;
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* No-results message */
.mkt-picker-no-results {
    padding: 20px 14px;
    text-align: center;
    color: #9aa5b4;
    font-style: italic;
    font-size: 13px;
}

/* ── Error / warning helpers ─────────────────────────────────────── */
.mkt-picker-error {
    color: #c62828;
    font-size: 13px;
    margin-top: 6px;
}
.mkt-picker-warn {
    color: #f57f17;
    font-size: 13px;
    margin-top: 6px;
}

/* ── Selected item info chip ─────────────────────────────────────── */
.mkt-selected-item-info {
    margin-top: 8px;
}

.mkt-selected-chip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    align-items: center;
    background: #f0f6ff;
    border: 1px solid #c9ddfb;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
}

.mkt-chip-name {
    font-weight: 700;
    color: #1a1a2e;
    font-size: 14px;
    flex-basis: 100%;
}

.mkt-chip-detail {
    color: #555;
}

.mkt-chip-listed {
    flex-basis: 100%;
    color: #e65100;
    font-size: 12px;
    font-weight: 600;
    background: #fff3e0;
    border-radius: 4px;
    padding: 4px 8px;
    border: 1px solid #ffcc80;
}
