/* ── Base ── */

.ksc-wrap {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1d2327;
}

/* ── Search Bar ── */

.ksc-search-bar {
    position: relative;
    margin-bottom: 24px;
}

.ksc-search-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid #dcdcde;
    border-radius: 10px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
    box-sizing: border-box;
    background: #fff;
}

.ksc-search-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,.12);
}

.ksc-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid #dcdcde;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
    max-height: 360px;
    overflow-y: auto;
}

.ksc-search-dropdown--open {
    display: block;
}

.ksc-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    color: inherit;
    transition: background .1s;
}

.ksc-search-item:hover {
    background: #f0f6fc;
}

.ksc-search-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.ksc-search-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ksc-search-item-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ksc-search-item-price {
    font-size: 12px;
    color: #50575e;
}

/* ── Breadcrumb ── */

.ksc-breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    font-size: 13px;
}

.ksc-crumb {
    padding: 4px 10px;
    border-radius: 6px;
    transition: background .15s;
}

.ksc-crumb--active {
    color: #fff;
    background: #2271b1;
    font-weight: 600;
}

.ksc-crumb--done {
    color: #2271b1;
    cursor: pointer;
}

.ksc-crumb--done:hover {
    background: #e5f0fa;
}

.ksc-crumb-sep {
    color: #c3c4c7;
    font-weight: 300;
    font-size: 14px;
}

/* ── Steps ── */

.ksc-step-heading {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 24px;
}

/* ── Category Cards ── */

.ksc-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.ksc-cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 44px 24px;
    background: #fff;
    border: 2px solid #dcdcde;
    border-radius: 16px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .15s;
    user-select: none;
}

.ksc-cat-card:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 16px rgba(34,113,177,.12);
    transform: translateY(-2px);
}

.ksc-cat-card:active {
    transform: translateY(0);
}

.ksc-cat-icon {
    font-size: 52px;
    line-height: 1;
    color: #2271b1;
}

.ksc-cat-label {
    font-size: 20px;
    font-weight: 600;
    color: #1d2327;
}

/* ── Grid Select (Brands / Models) ── */

.ksc-grid-select {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.ksc-loading-msg {
    display: flex;
    align-items: center;
    justify-content: center;
    grid-column: 1 / -1;
    padding: 48px 20px;
    color: #8c8f94;
    font-size: 15px;
}

.ksc-opt-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 14px;
    background: #fff;
    border: 2px solid #dcdcde;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .15s;
    user-select: none;
    text-align: center;
    min-height: 56px;
}

.ksc-opt-card:hover {
    border-color: #2271b1;
    box-shadow: 0 3px 12px rgba(34,113,177,.1);
    transform: translateY(-1px);
}

.ksc-opt-card:active {
    transform: translateY(0);
}

.ksc-opt-label {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

/* ── Compat Cards ── */

.ksc-options-compat {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.ksc-compat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 36px 48px;
    background: #fff;
    border: 2px solid #dcdcde;
    border-radius: 16px;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s, transform .15s;
    user-select: none;
    min-width: 180px;
}

.ksc-compat-card:hover {
    border-color: #2271b1;
    box-shadow: 0 4px 16px rgba(34,113,177,.12);
    transform: translateY(-2px);
}

.ksc-compat-card:active {
    transform: translateY(0);
}

.ksc-compat-card--selected {
    border-color: #2271b1;
    background: #f0f6fc;
}

.ksc-compat-icon {
    font-size: 40px;
    line-height: 1;
    color: #2271b1;
}

.ksc-compat-label {
    font-size: 18px;
    font-weight: 600;
}

.ksc-compat-card--disabled {
    opacity: .45;
    cursor: default;
    pointer-events: none;
    border-color: #dcdcde;
    filter: grayscale(.7);
}

.ksc-compat-notice {
    font-size: 11px;
    color: #8c8f94;
    text-align: center;
    line-height: 1.3;
}

/* ── Results ── */

.ksc-results {
    margin-top: 4px;
}

.ksc-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dcdcde;
}

.ksc-count {
    font-size: 14px;
    color: #50575e;
}

.ksc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.ksc-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    font-size: 16px;
    color: #50575e;
}

/* ── Product Card ── */

.ksc-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow .2s, transform .15s;
    display: flex;
    flex-direction: column;
}

.ksc-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
    transform: translateY(-2px);
}

.ksc-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 16px;
    flex: 1;
}

.ksc-card-img {
    text-align: center;
    margin-bottom: 12px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.ksc-card-img img {
    max-width: 100%;
    height: auto;
    max-height: 140px;
    object-fit: contain;
}

.ksc-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ksc-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    margin: 0;
    line-height: 1.4;
}

.ksc-card-brand {
    font-size: 12px;
    color: #8c8f94;
}

.ksc-card-sku {
    font-size: 11px;
    color: #a7aaad;
    font-family: monospace;
}

.ksc-card-stock {
    font-size: 12px;
}

.ksc-stock-yes {
    color: #008a20;
    font-weight: 600;
}

.ksc-stock-no {
    color: #d63638;
    font-weight: 600;
}

.ksc-card-desc {
    font-size: 12px;
    color: #50575e;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ksc-card-tags {
    margin-top: 2px;
}

.ksc-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1.6;
}

.ksc-badge-compat {
    background: #edfaef;
    color: #008a20;
    border: 1px solid #b8e6bf;
}

.ksc-badge-original {
    background: #f0f6fc;
    color: #043959;
    border: 1px solid #c5d9ed;
}

.ksc-card-price {
    font-size: 16px;
    font-weight: 700;
    color: #2c3338;
    margin-top: 4px;
}

.ksc-card-footer {
    border-top: 1px solid #f0f0f1;
    padding: 10px 16px;
    text-align: center;
}

.ksc-card-btn {
    display: inline-block;
    padding: 8px 24px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: #2271b1;
    border-radius: 8px;
    text-decoration: none;
    transition: background .15s;
}

.ksc-card-btn:hover {
    background: #135e96;
}

/* ── Pagination ── */

.ksc-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.ksc-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    font-size: 14px;
    color: #2271b1;
    background: #f6f7f7;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: background .1s;
}

.ksc-page:hover {
    background: #f0f6fc;
}

.ksc-page.ksc-active {
    color: #fff;
    background: #2271b1;
    border-color: #2271b1;
    font-weight: 600;
}

.ksc-page.ksc-disabled {
    color: #a7aaad;
    cursor: default;
    pointer-events: none;
}

.ksc-loading {
    opacity: .5;
    pointer-events: none;
}

/* ── Responsive ── */

@media (max-width: 768px) {
    .ksc-wrap {
        padding: 16px 0;
    }

    .ksc-categories {
        gap: 14px;
    }

    .ksc-cat-card {
        padding: 32px 16px;
    }

    .ksc-cat-icon {
        font-size: 40px;
    }

    .ksc-cat-label {
        font-size: 17px;
    }

    .ksc-grid-select {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .ksc-opt-card {
        padding: 14px 10px;
        min-height: 48px;
    }

    .ksc-compat-card {
        padding: 28px 32px;
        min-width: 140px;
    }

    .ksc-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 14px;
    }
}

@media (max-width: 480px) {
    .ksc-categories {
        grid-template-columns: 1fr;
    }

    .ksc-grid-select {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    .ksc-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .ksc-card-link {
        padding: 10px;
    }

    .ksc-card-title {
        font-size: 12px;
    }

    .ksc-options-compat {
        flex-direction: column;
        align-items: center;
    }

    .ksc-breadcrumb {
        font-size: 12px;
        padding: 10px 12px;
    }
}

/* Admin page overrides */
#wpbody .ksc-wrap {
    max-width: 100%;
    padding: 0;
}

/* ── Import Preview Cards ── */

.ksc-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin: 16px 0;
}

.ksc-preview-card {
    position: relative;
    display: flex;
    gap: 14px;
    padding: 16px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 10px;
    transition: box-shadow .15s;
}

.ksc-preview-card:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

.ksc-preview-img {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f6f7f7;
    border-radius: 6px;
    overflow: hidden;
}

.ksc-preview-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ksc-preview-noimg {
    width: 36px;
    height: 36px;
    background: #dcdcde;
    border-radius: 4px;
}

.ksc-preview-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ksc-preview-name {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ksc-preview-meta {
    font-size: 11px;
    color: #8c8f94;
}

.ksc-preview-cat {
    font-size: 11px;
    color: #2271b1;
    font-weight: 500;
}

.ksc-preview-price {
    font-size: 14px;
    font-weight: 700;
    color: #2c3338;
}

.ksc-preview-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
    padding: 1px 8px;
    border-radius: 4px;
    line-height: 1.7;
    width: fit-content;
}

.ksc-preview-badge-original {
    background: #edfaef;
    color: #008a20;
    border: 1px solid #b8e6bf;
}

.ksc-preview-badge-compat {
    background: #f0f6fc;
    color: #043959;
    border: 1px solid #c5d9ed;
}

.ksc-preview-badge-unknown {
    background: #f6f7f7;
    color: #8c8f94;
    border: 1px solid #dcdcde;
}

.ksc-preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    color: #a7aaad;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .1s, background .1s;
}

.ksc-preview-remove:hover {
    color: #d63638;
    background: #fcf0f1;
}

.ksc-confirm-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 16px 0;
    border-top: 1px solid #dcdcde;
}

@media (max-width: 768px) {
    .ksc-preview-grid {
        grid-template-columns: 1fr;
    }
}
