/* ── Ingram Product Selector – Admin CSS ── */

.ingram-wrap { max-width: 1400px; }

.ingram-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.ingram-header h1 { margin: 0; }

/* Stats */
.ingram-stats {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.stat-box {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 14px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 150px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.stat-n { font-size: 2em; font-weight: 700; color: #1d2327; line-height: 1.1; }
.stat-l { font-size: 11px; color: #646970; margin-top: 3px; text-align: center; }
.stat-box.sel .stat-n { color: #0073aa; }
.stat-box.imp .stat-n { color: #00a32a; }

/* Filters */
.ingram-filters {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.filter-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.fg { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 170px; }
.fg label { font-size: 11px; font-weight: 600; color: #646970; text-transform: uppercase; letter-spacing: .4px; }
.fg input, .fg select { height: 34px; border-radius: 4px; border: 1px solid #c3c4c7; padding: 0 8px; font-size: 13px; }
.fg input { min-width: 240px; }

.filter-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid #f0f0f1;
}
.sep { color: #ccc; }
.filter-actions .button { height: 32px; line-height: 30px; }

/* Table */
.ingram-table-wrap {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.ingram-tbl { margin: 0 !important; border: none !important; }
.ingram-tbl th { background: #f6f7f7; padding: 9px 10px; font-size: 12px; white-space: nowrap; }
.ingram-tbl td { padding: 7px 10px; vertical-align: middle; font-size: 13px; }

.col-chk   { width: 30px !important; }
.col-img   { width: 46px !important; }
.col-sku   { width: 85px !important; }
.col-mfr-p { width: 110px !important; }
.col-brand { width: 110px !important; }
.col-cat   { width: 150px !important; }
.col-price { width: 90px !important; text-align: right; }
.col-stock { width: 65px !important; text-align: center; }
.col-btn   { width: 60px !important; text-align: center; }

.loading { text-align: center; padding: 40px !important; color: #646970; font-style: italic; }

.thumb {
    width: 38px; height: 38px;
    object-fit: contain;
    border-radius: 4px;
    background: #f6f7f7;
    border: 1px solid #eee;
}
.thumb-ph {
    width: 38px; height: 38px;
    background: #f0f0f1;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    color: #c3c4c7; font-size: 18px;
}

.sku-code  { font-family: monospace; font-size: 12px; color: #1d2327; }
.mfr-code  { font-family: monospace; font-size: 11px; color: #646970; }
.cat-label { font-size: 11px; color: #646970; }

.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge-in  { background: #d1fae5; color: #065f46; }
.badge-low { background: #fef3c7; color: #92400e; }
.badge-out { background: #fee2e2; color: #991b1b; }

.price-val { font-weight: 600; }

/* Toggle button */
.toggle-btn {
    width: 30px; height: 30px;
    border-radius: 50%;
    border: 2px solid #dcdcde;
    background: #fff;
    cursor: pointer;
    font-size: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    padding: 0;
}
.toggle-btn:hover { border-color: #0073aa; }
.toggle-btn.is-selected { background: #0073aa; border-color: #0073aa; color: #fff; }
.toggle-btn.is-imported { background: #00a32a; border-color: #00a32a; color: #fff; }

/* Pager */
.ingram-pager {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 6px 0;
}
.result-cnt { color: #646970; font-size: 13px; margin-left: auto; }

/* Sync page */
.ingram-sync-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 16px;
}
@media (max-width: 1100px) { .ingram-sync-grid { grid-template-columns: 1fr; } }

.sync-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 18px 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.sync-card h2 { margin-top: 0; font-size: 15px; }
.sync-card .widefat td { padding: 8px 12px; vertical-align: middle; }

.import-actions { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.import-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    background: #f6f7f7;
    border-radius: 6px;
}
.import-action p { margin: 4px 0 0; font-size: 12px; color: #646970; }
.import-action .button { white-space: nowrap; flex-shrink: 0; }

.progress-wrap {
    height: 8px;
    background: #f0f0f1;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-bar {
    height: 100%;
    background: #0073aa;
    width: 0%;
    transition: width .3s;
    border-radius: 4px;
}

#import-result {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    display: none;
}
#import-result.ok  { background: #d1fae5; color: #065f46; }
#import-result.err { background: #fee2e2; color: #991b1b; }

.ingram-notice { margin: 0 0 16px; }
.ingram-spinner { display: none; }
.ingram-spinner.is-active { display: inline-block; }

/* ── Import-spinner ── */
.wc-import-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ingram-spin .7s linear infinite;
    vertical-align: middle;
    margin-left: 6px;
}
@keyframes ingram-spin {
    to { transform: rotate(360deg); }
}
#btn-import:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

/* ── Ingram Variants Shortcode ───────────────────── */
.ingram-variants { margin: 16px 0; }
.ingram-variants__group { margin-bottom: 14px; }
.ingram-variants__label { display: block; font-size: 13px; color: #555; margin-bottom: 8px; }
.ingram-variants__label strong { color: #111; }

/* Färgrutor */
.ingram-variants__swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.ingram-swatch {
    display: block; width: 80px; height: 80px;
    border: 2px solid transparent; border-radius: 6px;
    overflow: hidden; transition: border-color .15s, transform .15s;
    text-decoration: none; padding: 2px; background: #fff;
    box-sizing: border-box;
}
.ingram-swatch img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 4px; }
.ingram-swatch span { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-size: 10px; text-align: center; padding: 2px; color: #333; }
.ingram-swatch:hover { border-color: #aaa; transform: scale(1.05); }
.ingram-swatch--active { border-color: #222 !important; box-shadow: 0 0 0 1px #222; }

/* Knappar */
.ingram-variants__buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.ingram-btn {
    display: inline-flex; flex-direction: column; align-items: center;
    padding: 8px 18px 7px;
    border: 1px solid #ddd; border-radius: 4px;
    font-size: 13px; font-weight: 600; color: #60696F; background: #fff;
    text-decoration: none; transition: all .15s;
    white-space: nowrap; min-width: 90px; line-height: 1.3;
}
.ingram-btn__stock { font-size: 10px; font-weight: 400; color: #999; margin-top: 3px; }
.ingram-btn:hover { border-color: #F24162; color: #F24162; }
.ingram-btn--active { background: #F24162; color: #fff !important; border-color: #F24162; }
.ingram-btn--active .ingram-btn__stock { color: rgba(255,255,255,0.8); }

/* ── Ingram Stock Shortcode ───────────────────── */
.ingram-stock { margin: 8px 0; }
.ingram-stock__badge {
    display: inline-block; padding: 6px 12px;
    border-radius: 4px; font-size: 13px; font-weight: 500;
}
.ingram-stock__badge--in    { background: #e8f5e9; color: #2e7d32; }
.ingram-stock__badge--eta   { background: #fff3e0; color: #e65100; }
.ingram-stock__badge--order { background: #f5f5f5; color: #555; }

/* ── Ingram Cost Shortcode ───────────────────── */
.ingram-cost { margin: 8px 0; font-size: 13px; color: #555; line-height: 1.8; }
.ingram-cost__row { }


/* ── Produktverktyg (från team8-products) ───────────────────── */
/* ── Reset & base ─────────────────────────────────── */
.t8p-wrap * { box-sizing: border-box; }
.t8p-wrap { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; max-width: 100%; padding-bottom: 40px; }

/* ── Top bar ──────────────────────────────────────── */
.t8p-topbar { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 14px; flex-wrap: wrap; gap: 10px; }
.t8p-title { margin: 0 !important; font-size: 22px !important; color: #1d2327; }
.t8p-topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Buttons ──────────────────────────────────────── */
.t8p-btn { border: none; border-radius: 5px; cursor: pointer; font-size: 13px; font-weight: 500; padding: 7px 14px; transition: opacity .15s; }
.t8p-btn:hover { opacity: .85; }
.t8p-btn-green   { background: #1D9E75; color: #fff; }
.t8p-btn-primary { background: #2271b1; color: #fff; }
.t8p-btn-secondary { background: #f0f0f1; color: #1d2327; border: 1px solid #c3c4c7; }
.t8p-btn-danger  { background: #d63638; color: #fff; }
.t8p-btn-sm { padding: 4px 10px; font-size: 12px; }
.t8p-btn-icon { background: transparent; border: none; cursor: pointer; padding: 3px 5px; color: #646970; font-size: 16px; border-radius: 4px; }
.t8p-btn-icon:hover { background: #f0f0f1; color: #1d2327; }

/* ── Bulk bar ─────────────────────────────────────── */
.t8p-bulk-bar { display: flex; align-items: center; gap: 8px; background: #f0f6fc; border: 1px solid #72aee6; border-radius: 6px; padding: 6px 14px; font-size: 13px; flex-wrap: wrap; }
.t8p-bulk-bar label { display: flex; align-items: center; gap: 5px; }
.t8p-bulk-bar input[type=number] { width: 56px; border: 1px solid #c3c4c7; border-radius: 4px; padding: 4px 6px; font-size: 13px; }

/* ── Filters ──────────────────────────────────────── */
.t8p-filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.t8p-filters input[type=search],
.t8p-filters select { border: 1px solid #c3c4c7; border-radius: 5px; padding: 7px 10px; font-size: 13px; background: #fff; height: 34px; }
.t8p-filters input[type=search] { min-width: 220px; }
.t8p-filters select { min-width: 160px; }
.t8p-result-count { font-size: 12px; color: #646970; margin-left: 4px; }

/* ── Notice ───────────────────────────────────────── */
.t8p-notice { padding: 10px 16px; border-radius: 5px; margin-bottom: 12px; font-size: 13px; font-weight: 500; }
.t8p-notice.success { background: #edfaef; color: #0a6b2e; border: 1px solid #68de7c; }
.t8p-notice.error   { background: #fceaea; color: #8a1f1f; border: 1px solid #f86368; }

/* ── Table wrap ───────────────────────────────────── */
.t8p-table-wrap { overflow-x: auto; border: 1px solid #c3c4c7; border-radius: 6px; background: #fff; }

/* ── Table ────────────────────────────────────────── */
.t8p-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.t8p-table thead tr { background: #f6f7f7; border-bottom: 2px solid #c3c4c7; }
.t8p-table th { padding: 10px 12px; text-align: left; font-weight: 600; color: #1d2327; white-space: nowrap; user-select: none; }
.t8p-table th.t8p-sortable { cursor: pointer; }
.t8p-table th.t8p-sortable:hover { color: #2271b1; }
.t8p-table th.t8p-sort-active { color: #2271b1; }
.t8p-table td { padding: 8px 12px; vertical-align: middle; border-bottom: 1px solid #f0f0f1; color: #1d2327; }
.t8p-table tbody tr:last-child td { border-bottom: none; }
.t8p-table tbody tr:hover > td { background: #f6f7f7; }
.t8p-table tbody tr.t8p-selected > td { background: #f0f6fc; }

/* Row types */
.t8p-table tr.t8p-row-parent > td:first-child { border-left: 3px solid #1D9E75; }
.t8p-table tr.t8p-row-variant > td { background: #fafafa; color: #50575e; }
.t8p-table tr.t8p-row-variant > td:first-child { border-left: 3px solid #bfcfe0; padding-left: 28px; }
.t8p-table tr.t8p-row-variant:hover > td { background: #f0f4f8; }
.t8p-table tr.t8p-row-new > td { background: #f0fbf5; }
.t8p-table tr.t8p-row-new > td:first-child { border-left: 3px solid #68de7c; }

/* Column widths */
.t8p-col-cb     { width: 36px; }
.t8p-col-img    { width: 52px; }
.t8p-col-name   { min-width: 200px; }
.t8p-col-sku    { min-width: 130px; }
.t8p-col-type   { width: 80px; }
.t8p-col-cat    { min-width: 160px; }
.t8p-col-brand  { min-width: 120px; }
.t8p-col-price  { width: 110px; }
.t8p-col-sale   { width: 100px; }
.t8p-col-cost   { width: 100px; }
.t8p-col-markup { width: 90px; }
.t8p-col-status { width: 100px; }
.t8p-col-actions { width: 80px; white-space: nowrap; }

/* Thumbnail */
.t8p-thumb { width: 36px; height: 36px; object-fit: cover; border-radius: 4px; border: 1px solid #e0e0e0; display: block; }
.t8p-thumb-empty { width: 36px; height: 36px; background: #f0f0f1; border-radius: 4px; border: 1px solid #e0e0e0; display: flex; align-items: center; justify-content: center; color: #c3c4c7; font-size: 18px; cursor: pointer; }

/* Inline price edit */
.t8p-price-cell { position: relative; }
.t8p-price-val { cursor: pointer; }
.t8p-price-val:hover { text-decoration: underline dotted; color: #2271b1; }
.t8p-price-input { width: 90px; border: 2px solid #2271b1; border-radius: 4px; padding: 3px 6px; font-size: 13px; }

/* Type badge */
.t8p-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.t8p-badge-simple   { background: #e8f5e9; color: #2e7d32; }
.t8p-badge-variable { background: #e3f2fd; color: #1565c0; }
.t8p-badge-variant  { background: #f3e5f5; color: #6a1b9a; }

/* Status badge */
.t8p-status { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.t8p-status-publish { background: #edfaef; color: #0a6b2e; }
.t8p-status-draft   { background: #f6f7f7; color: #646970; border: 1px solid #dcdcde; }
.t8p-status-private { background: #fff8e5; color: #8a5f0a; }

/* Variant toggle arrow */
.t8p-toggle-variants { cursor: pointer; background: none; border: none; padding: 0 6px 0 0; color: #646970; font-size: 14px; vertical-align: middle; }
.t8p-toggle-variants:hover { color: #1d2327; }

/* Loading / empty */
.t8p-loading, .t8p-empty { text-align: center; color: #646970; padding: 40px !important; font-style: italic; }

/* Disabled cell (variant, not applicable) */
.t8p-na { color: #c3c4c7; font-size: 12px; }

/* New row inline inputs */
.t8p-new-input, .t8p-new-select { width: 100%; border: 1px solid #c3c4c7; border-radius: 4px; padding: 5px 7px; font-size: 13px; background: #fff; }
.t8p-new-input:focus, .t8p-new-select:focus { border-color: #2271b1; outline: none; }

/* Pagination */
.t8p-pagination { display: flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 13px; flex-wrap: wrap; }
.t8p-page-btn { border: 1px solid #c3c4c7; background: #fff; border-radius: 4px; padding: 5px 10px; cursor: pointer; font-size: 13px; }
.t8p-page-btn:hover { background: #f0f0f1; }
.t8p-page-btn.active { background: #2271b1; color: #fff; border-color: #2271b1; }
.t8p-page-btn:disabled { opacity: .4; cursor: default; }

/* ── Modal ────────────────────────────────────────── */
.t8p-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100000; display: flex; align-items: center; justify-content: center; }
.t8p-modal { background: #fff; border-radius: 8px; width: 700px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 8px 40px rgba(0,0,0,.25); }
.t8p-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px 14px; border-bottom: 1px solid #dcdcde; }
.t8p-modal-header h2 { margin: 0; font-size: 17px; }
.t8p-modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #646970; line-height: 1; padding: 2px 6px; border-radius: 4px; }
.t8p-modal-close:hover { background: #f0f0f1; color: #1d2327; }
.t8p-modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.t8p-modal-footer { padding: 14px 24px; border-top: 1px solid #dcdcde; display: flex; gap: 10px; }

/* Modal form grid */
.t8p-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.t8p-form-grid .t8p-full { grid-column: 1 / -1; }
.t8p-field label { display: block; font-size: 12px; font-weight: 600; color: #1d2327; margin-bottom: 5px; }
.t8p-field input, .t8p-field select, .t8p-field textarea {
    width: 100%; border: 1px solid #c3c4c7; border-radius: 5px; padding: 8px 10px; font-size: 13px; background: #fff;
}
.t8p-field input:focus, .t8p-field select:focus, .t8p-field textarea:focus { border-color: #2271b1; outline: none; box-shadow: 0 0 0 1px #2271b1; }
.t8p-field textarea { min-height: 80px; resize: vertical; }

/* Modal image picker */
.t8p-img-picker { display: flex; align-items: center; gap: 14px; }
.t8p-img-preview { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid #dcdcde; display: block; }
.t8p-img-preview-empty { width: 72px; height: 72px; background: #f0f0f1; border-radius: 6px; border: 2px dashed #c3c4c7; display: flex; align-items: center; justify-content: center; color: #c3c4c7; font-size: 28px; }

/* Variant section in modal */
.t8p-variants-section { margin-top: 20px; border-top: 1px solid #dcdcde; padding-top: 16px; }
.t8p-variants-section h3 { font-size: 14px; margin: 0 0 12px; color: #1d2327; }
.t8p-variants-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.t8p-variants-table th { background: #f6f7f7; padding: 6px 10px; text-align: left; font-weight: 600; border-bottom: 1px solid #dcdcde; }
.t8p-variants-table td { padding: 6px 10px; border-bottom: 1px solid #f0f0f1; }
.t8p-variants-table input { width: 90px; border: 1px solid #dcdcde; border-radius: 4px; padding: 3px 6px; font-size: 12px; }

/* Variant modal */
.t8p-variants-section h3 { font-size: 14px; margin: 0 0 12px; color: #1d2327; }
.t8p-variants-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.t8p-variants-table th { background: #f6f7f7; padding: 6px 10px; text-align: left; font-weight: 600; border-bottom: 1px solid #dcdcde; }
.t8p-variants-table td { padding: 6px 8px; border-bottom: 1px solid #f0f0f1; vertical-align: middle; }
.t8p-variants-table input[type=number],
.t8p-variants-table input[type=text] { width: 86px; border: 1px solid #dcdcde; border-radius: 4px; padding: 3px 6px; font-size: 12px; }
.t8p-variants-table input:focus { border-color: #2271b1; outline: none; }
.t8p-variant-img-cell { width: 40px; }
.t8p-variant-thumb { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; border: 1px solid #e0e0e0; cursor: pointer; display: block; }
.t8p-variant-thumb-empty { width: 32px; height: 32px; background: #f0f0f1; border-radius: 4px; border: 2px dashed #c3c4c7; display: flex; align-items: center; justify-content: center; color: #c3c4c7; font-size: 16px; cursor: pointer; }
.t8p-add-variant-row td { background: #f0fbf5; }
.t8p-add-variant-row select { width: 100%; border: 1px solid #c3c4c7; border-radius: 4px; padding: 4px 6px; font-size: 12px; }
/* Multi-select categories */
.t8p-cat-select { height: 90px !important; }

.t8p-col-stock { width: 80px; text-align: center; }
