/* =========================================================================
 * Pixel Company Selector — premium SaaS UI
 * All class names namespaced with .pcs- so they don't collide with theme/Elementor.
 * Override anything via Elementor Custom CSS or your theme.
 * ========================================================================= */

.pcs-wrap {
    --pcs-bg:           transparent;
    --pcs-surface:      #ffffff;
    --pcs-text:         #0a2348;
    --pcs-text-soft:    #4b5673;
    --pcs-muted:        #6b7591;
    --pcs-border:       #e3e8f2;
    --pcs-border-soft:  #eef1f7;
    --pcs-soft:         #f3f5fa;
    --pcs-primary:      #1d40c4;
    --pcs-primary-2:    #3858da;
    --pcs-tag-bg:       #eaf0fb;
    --pcs-tag-text:     #1d40c4;
    --pcs-danger:       #ef4444;
    --pcs-shadow-sm:    0 1px 2px rgba(15, 32, 70, .04), 0 1px 3px rgba(15, 32, 70, .06);
    --pcs-shadow-md:    0 6px 24px rgba(15, 32, 70, .08);
    --pcs-radius:       12px;
    --pcs-radius-lg:    16px;

    /* Card height controls "2 row" scroll cap. Adjust if you want taller cards. */
    --pcs-card-h:        310px;
    --pcs-card-h-mobile: 270px;
    --pcs-grid-gap:      18px;

    box-sizing: border-box;
    color: var(--pcs-text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    width: 100%;
    background: var(--pcs-bg);
}
.pcs-wrap *,
.pcs-wrap *::before,
.pcs-wrap *::after { box-sizing: border-box; }

/* HARD HIDE — must beat .pcs-modal/.pcs-bottombar/.pcs-controls__selection
   which use display:flex and would otherwise override the [hidden] UA rule.
   Includes explicit per-element selectors so this can't be defeated by
   theme/cache/CSS-load-order weirdness. */
.pcs-wrap [hidden],
.pcs-modal[hidden],
.pcs-bottombar[hidden],
.pcs-controls__selection[hidden],
.pcs-empty[hidden] { display: none !important; }

/* ---------- Header ----------------------------------------------------- */
.pcs-header { margin: 0 0 18px; }
.pcs-header__title {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--pcs-text);
}
.pcs-header__subtitle {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--pcs-text-soft);
    max-width: 520px;
}

/* ---------- Controls row ---------------------------------------------- */
.pcs-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 16px;
    margin: 0 0 18px;
}
.pcs-controls__filters {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
}

/* Sector dropdown */
.pcs-select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.pcs-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: #fff;
    border: 1px solid var(--pcs-border);
    border-radius: 8px;
    height: 40px;
    padding: 0 32px 0 14px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--pcs-text);
    line-height: 1;
    cursor: pointer;
    min-width: 160px;
    box-shadow: var(--pcs-shadow-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.pcs-select:focus {
    outline: none;
    border-color: var(--pcs-primary);
    box-shadow: 0 0 0 3px rgba(29, 64, 196, .15);
}
.pcs-select-arrow {
    position: absolute;
    inset-inline-end: 12px;
    pointer-events: none;
    color: var(--pcs-muted);
    display: inline-flex;
}
.pcs-wrap.pcs-rtl .pcs-select { padding: 0 14px 0 32px; }

/* Search input */
.pcs-search {
    display: flex;
    align-items: stretch;
    background: #fff;
    border: 1px solid var(--pcs-border);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--pcs-shadow-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.pcs-search:focus-within {
    border-color: var(--pcs-primary);
    box-shadow: 0 0 0 3px rgba(29, 64, 196, .15);
}
.pcs-search__input {
    flex: 1;
    border: none;
    background: transparent;
    height: 38px;
    padding: 0 12px;
    font-size: 13.5px;
    color: var(--pcs-text);
    min-width: 200px;
}
.pcs-search__input::placeholder { color: #98a0b8; }
.pcs-search__input:focus { outline: none; }
.pcs-search__btn {
    background: transparent;
    border: none;
    border-inline-start: 1px solid var(--pcs-border-soft);
    width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--pcs-muted);
    cursor: pointer;
    transition: color .15s ease, background .15s ease;
}
.pcs-search__btn:hover { color: var(--pcs-primary); background: var(--pcs-soft); }

/* Selection counter (top-right) */
.pcs-controls__selection {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    animation: pcs-fade .2s ease both;
}
.pcs-controls__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--pcs-text);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}
.pcs-controls__count-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--pcs-text);
}
.pcs-controls__clear {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    color: var(--pcs-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 4px;
    border-radius: 6px;
    transition: opacity .15s ease;
}
.pcs-controls__clear:hover { opacity: .75; }
.pcs-controls__clear svg { display: block; }

/* ---------- Grid (2-row scroll cap) ------------------------------------
   The CSS sets up the layout. The actual max-height + overflow rules are
   ALSO applied inline by JavaScript on page load (with `!important`) so
   nothing in the theme or Elementor can disable the internal scroll. */
.pcs-wrap .pcs-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: var(--pcs-card-h);
    gap: var(--pcs-grid-gap);
    /* These two rules are reinforced inline by JS — see ensureScrollCap() */
    max-height: calc((var(--pcs-card-h) * 2) + var(--pcs-grid-gap) + 6px);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 3px;
    margin: 0 -3px;
    /* Firefox scrollbar */
    scrollbar-width: auto;
    scrollbar-color: var(--pcs-primary) #eef1f7;
}
/* WebKit scrollbar — deliberately prominent so users SEE there's more */
.pcs-wrap .pcs-grid::-webkit-scrollbar {
    width: 12px;
}
.pcs-wrap .pcs-grid::-webkit-scrollbar-track {
    background: #eef1f7;
    border-radius: 6px;
    margin: 4px 0;
}
.pcs-wrap .pcs-grid::-webkit-scrollbar-thumb {
    background: var(--pcs-primary);
    border-radius: 6px;
    border: 2px solid #eef1f7;
    min-height: 40px;
}
.pcs-wrap .pcs-grid::-webkit-scrollbar-thumb:hover {
    background: var(--pcs-primary-2);
}

/* Responsive column counts. Selectors must match the specificity of the
   base `.pcs-wrap .pcs-grid` rule so they actually win at the right
   breakpoints. Otherwise the 4-column desktop rule applies on mobile. */
@media (max-width: 1180px) { .pcs-wrap .pcs-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 880px)  { .pcs-wrap .pcs-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 600px)  {
    .pcs-wrap .pcs-grid {
        grid-template-columns: 1fr !important;          /* one card per row */
        grid-auto-rows: var(--pcs-card-h-mobile);
    }
}

/* ---------- Card ------------------------------------------------------- */
.pcs-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--pcs-surface);
    border: 1px solid var(--pcs-border);
    border-radius: var(--pcs-radius-lg);
    padding: 18px 18px 16px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
    outline: none;
    height: 100%;
}
.pcs-card:hover  { transform: translateY(-1px); box-shadow: var(--pcs-shadow-md); border-color: #cdd5e8; }
.pcs-card:focus-visible { box-shadow: 0 0 0 3px rgba(29, 64, 196, .25); }

.pcs-card.is-selected {
    border-color: var(--pcs-primary);
    box-shadow: 0 0 0 1px var(--pcs-primary), 0 8px 24px rgba(29, 64, 196, .18);
}

/* Checkbox (top-right) */
.pcs-card__check {
    position: absolute;
    top: 14px;
    inset-inline-end: 14px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    background: #fff;
    border: 1.5px solid var(--pcs-border);
    color: transparent;
    cursor: pointer;
    padding: 0;
    transition: all .18s ease;
    z-index: 2;
}
.pcs-card:hover .pcs-card__check { border-color: #b6c0d8; }
.pcs-card.is-selected .pcs-card__check {
    background: var(--pcs-primary);
    border-color: var(--pcs-primary);
    color: #fff;
}
.pcs-card__check svg { display: block; }

/* Logo
   ---------------------------------------------------------------
   Show the FULL logo without cropping, regardless of its aspect
   ratio. The `!important` rules on the img are deliberate — they
   beat Elementor / theme global image rules (e.g. `width: 100%`)
   that would otherwise force the logo wider than its container. */
.pcs-card__logo {
    height: 72px;
    margin: 0 0 14px;
    /* Just enough space at the right so wide logos don't run into
       the checkbox button (which is 22px wide + 14px right offset). */
    padding-inline-end: 38px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    overflow: visible;
}
.pcs-card__logo img {
    display: block !important;
    max-width: 100% !important;
    max-height: 72px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    object-position: left center !important;
    background: transparent !important;
    border-radius: 0 !important;   /* defeat circular-avatar themes */
}
.pcs-wrap.pcs-rtl .pcs-card__logo img { object-position: right center !important; }
.pcs-card__logo-fallback {
    font-size: 22px;
    font-weight: 800;
    color: var(--pcs-primary);
    letter-spacing: .02em;
    text-transform: uppercase;
}

.pcs-card__title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.005em;
    color: var(--pcs-text);
    text-transform: uppercase;
    /* Single line, ellipsis if too long */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pcs-card__desc {
    margin: 0 0 14px;
    font-size: 13px;
    line-height: 1.55;
    color: var(--pcs-text-soft);
    flex: 1;
    /* Clamp to 3 lines */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
}

.pcs-card__footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}
.pcs-card__tag {
    align-self: flex-start;
    background: var(--pcs-tag-bg);
    color: var(--pcs-tag-text);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pcs-card__label {
    align-self: flex-start;
    color: var(--pcs-muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.pcs-card__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--pcs-primary);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    align-self: flex-start;
    transition: opacity .15s ease;
}
.pcs-card__link:hover  { opacity: .8; }
.pcs-card__link svg    { display: block; flex: 0 0 auto; }

/* ---------- Empty state ----------------------------------------------- */
.pcs-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--pcs-muted);
    font-size: 14px;
    background: var(--pcs-surface);
    border: 1px dashed var(--pcs-border);
    border-radius: var(--pcs-radius);
    margin-top: 4px;
}

/* ---------- Bottom action bar (in-flow) ------------------------------- */
.pcs-bottombar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: var(--pcs-surface);
    border: 1px solid var(--pcs-border);
    border-radius: var(--pcs-radius-lg);
    padding: 18px 22px;
    margin-top: 22px;
    box-shadow: var(--pcs-shadow-sm);
    animation: pcs-rise .25s ease both;
}
.pcs-bottombar__left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1 1 auto;
}
.pcs-bottombar__icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--pcs-tag-bg);
    color: var(--pcs-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pcs-bottombar__copy { min-width: 0; }
.pcs-bottombar__title {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--pcs-text);
}
.pcs-bottombar__desc {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--pcs-text-soft);
}
.pcs-bottombar__actions {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ---------- Buttons --------------------------------------------------- */
.pcs-btn {
    --bg: transparent;
    --col: var(--pcs-text);
    --bd: var(--pcs-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    background: var(--bg);
    color: var(--col);
    border: 1px solid var(--bd);
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    transition: transform .12s ease, box-shadow .15s ease, opacity .15s ease, background .15s ease, color .15s ease;
    white-space: nowrap;
}
.pcs-btn:disabled { opacity: .5; cursor: not-allowed; }
.pcs-btn:not(:disabled):hover { transform: translateY(-1px); }
.pcs-btn__icon { display: inline-block; }
.pcs-wrap.pcs-rtl .pcs-btn__icon { transform: scaleX(-1); }

.pcs-btn--primary { --bg: var(--pcs-primary); --col: #fff; --bd: var(--pcs-primary); box-shadow: 0 6px 18px rgba(29, 64, 196, .25); }
.pcs-btn--primary:not(:disabled):hover { --bg: var(--pcs-primary-2); --bd: var(--pcs-primary-2); }

.pcs-btn--outline { --bg: #fff; --col: var(--pcs-primary); --bd: var(--pcs-primary); }
.pcs-btn--outline:not(:disabled):hover { --bg: var(--pcs-tag-bg); }

.pcs-btn--ghost   { --bg: transparent; --col: var(--pcs-muted); --bd: var(--pcs-border); }
.pcs-btn--ghost:not(:disabled):hover  { --bg: var(--pcs-soft); --col: var(--pcs-text); }

/* spinner */
.pcs-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: pcs-spin .7s linear infinite;
    opacity: .8;
}
.pcs-btn.is-loading .pcs-btn__label,
.pcs-btn.is-loading .pcs-btn__icon { opacity: .5; }
@keyframes pcs-spin { to { transform: rotate(360deg); } }
@keyframes pcs-rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pcs-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Modal ----------------------------------------------------- */
.pcs-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: pcs-fade .15s ease both;
}
.pcs-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 35, 72, .55);
    backdrop-filter: blur(2px);
}
.pcs-modal__panel {
    position: relative;
    background: #fff;
    color: var(--pcs-text);
    border-radius: var(--pcs-radius-lg);
    box-shadow: 0 24px 60px rgba(10, 35, 72, .35);
    padding: 28px;
    max-width: 440px;
    width: 100%;
    animation: pcs-pop .22s cubic-bezier(.2,.7,.2,1.1) both;
}
.pcs-modal__close {
    position: absolute;
    top: 10px;
    inset-inline-end: 12px;
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: var(--pcs-muted);
    cursor: pointer;
    padding: 4px 8px;
}
.pcs-modal__close:hover { color: var(--pcs-text); }
.pcs-modal__title {
    margin: 0 0 6px;
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -.01em;
}
.pcs-modal__desc {
    margin: 0 0 18px;
    color: var(--pcs-text-soft);
    font-size: 13.5px;
    line-height: 1.55;
}
.pcs-field { display: block; margin: 0 0 14px; }
.pcs-field__label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--pcs-muted);
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.pcs-field input {
    width: 100%;
    height: 44px;
    border: 1px solid var(--pcs-border);
    border-radius: 8px;
    padding: 0 14px;
    font-size: 14px;
    color: var(--pcs-text);
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.pcs-field input:focus {
    outline: none;
    border-color: var(--pcs-primary);
    box-shadow: 0 0 0 3px rgba(29, 64, 196, .18);
}
.pcs-modal__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 6px;
}
.pcs-modal__feedback {
    min-height: 20px;
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.4;
}
.pcs-modal__feedback.is-success { color: #16a06e; }
.pcs-modal__feedback.is-error   { color: var(--pcs-danger); }

@keyframes pcs-pop  { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- RTL -------------------------------------------------------- */
.pcs-wrap.pcs-rtl { direction: rtl; text-align: right; }
.pcs-wrap.pcs-rtl .pcs-modal__actions      { justify-content: flex-start; }
.pcs-wrap.pcs-rtl .pcs-bottombar__actions  { justify-content: flex-start; }
.pcs-wrap.pcs-rtl .pcs-card__title         { text-align: right; }

/* ---------- Mobile / responsive --------------------------------------- */
@media (max-width: 720px) {
    .pcs-wrap .pcs-controls { flex-direction: column; align-items: stretch; }
    .pcs-wrap .pcs-controls__filters { width: 100%; }
    .pcs-wrap .pcs-controls__filters .pcs-search,
    .pcs-wrap .pcs-controls__filters .pcs-select-wrap { flex: 1 1 auto; }
    .pcs-wrap .pcs-search__input { min-width: 0; }
    .pcs-wrap .pcs-controls__selection { justify-content: flex-end; }
    .pcs-wrap .pcs-bottombar { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
    .pcs-wrap .pcs-bottombar__actions { justify-content: stretch; flex-direction: column; gap: 10px; }
    .pcs-wrap .pcs-bottombar__actions .pcs-btn {
        flex: 1 1 auto;
        width: 100%;
        height: 50px;
        font-size: 14.5px;
        padding: 0 18px;
    }
}
@media (max-width: 600px) {
    /* On a single-column layout, give each card more room and slimmer chrome. */
    .pcs-wrap .pcs-card { padding: 16px 18px 18px; }
    .pcs-wrap .pcs-card__title { font-size: 17px; }
    .pcs-wrap .pcs-card__desc  { font-size: 14px; -webkit-line-clamp: 4; line-clamp: 4; }
    .pcs-wrap .pcs-card__logo  { height: 64px; padding-inline-end: 36px; }
    .pcs-wrap .pcs-header__title    { font-size: 16px; }
    .pcs-wrap .pcs-header__subtitle { font-size: 13px; }
    .pcs-wrap .pcs-bottombar__title { font-size: 13px; }
    .pcs-wrap .pcs-bottombar__desc  { font-size: 12px; }
}
