/* ─── Police Custom Search v1.0 ──────────────────────────────────────────── */

:root {
    --pcs-blue:      #0073aa;
    --pcs-blue-dk:   #005580;
    --pcs-blue-lt:   #e6f2f8;
    --pcs-green:     #10b981;
    --pcs-orange:    #EE7311;
    --pcs-text:      #111827;
    --pcs-muted:     #6b7280;
    --pcs-border:    #e5e7eb;
    --pcs-radius:    10px;
    --pcs-shadow:    0 8px 30px rgba(0,0,0,0.14);
}

/* ─── Wrapper ─── */

.pcs-search-wrap { width: 100%; font-family: inherit; }

.pcs-search-bar-wrap {
    position: relative;
    max-width: 680px;
    margin: 0 auto;
}

/* ─── Input bar ─── */

.pcs-search-form { margin: 0; }

.pcs-search-input-wrap {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid var(--pcs-blue);
    border-radius: 50px;
    box-shadow: 0 2px 12px rgba(0,115,170,0.18);
    transition: box-shadow .2s, border-color .2s;
    overflow: hidden;
}

.pcs-search-input-wrap:focus-within {
    box-shadow: 0 2px 20px rgba(0,115,170,0.32);
    border-color: var(--pcs-blue-dk);
}

.pcs-search-icon {
    width: 19px; height: 19px;
    margin: 0 8px 0 18px;
    color: var(--pcs-blue);
    flex-shrink: 0;
}

.pcs-search-input {
    flex: 1;
    border: none; outline: none;
    padding: 13px 6px;
    font-size: 15px;
    color: var(--pcs-text);
    background: transparent;
    min-width: 0;
}

.pcs-search-input::placeholder { color: #94a3b8; }

.pcs-search-clear {
    background: none; border: none;
    color: #94a3b8; font-size: 19px;
    padding: 0 6px; cursor: pointer; flex-shrink: 0;
    line-height: 1;
}
.pcs-search-clear:hover { color: var(--pcs-text); }

.pcs-search-btn {
    background: var(--pcs-blue);
    color: #fff; border: none;
    padding: 0 22px;
    min-height: 48px;
    font-size: 14px; font-weight: 700;
    cursor: pointer;
    border-radius: 0 50px 50px 0;
    transition: background .2s;
    white-space: nowrap; flex-shrink: 0;
}
.pcs-search-btn:hover { background: var(--pcs-blue-dk); }

/* ─── Dropdown ─── */

.pcs-search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0; right: 0;
    background: #fff;
    border: 1px solid var(--pcs-border);
    border-radius: var(--pcs-radius);
    box-shadow: var(--pcs-shadow);
    z-index: 99999;
    max-height: 480px;
    overflow-y: auto;
    animation: pcs-dd-in .13s ease;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

@keyframes pcs-dd-in {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Rows ─── */

.pcs-dd-row {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 10px 14px;
    text-decoration: none !important;
    color: var(--pcs-text) !important;
    border-bottom: 1px solid #f1f5f9;
    transition: background .1s;
}

.pcs-dd-row:last-child { border-bottom: none; }
.pcs-dd-row:hover { background: var(--pcs-blue-lt); }

/* Brand row — slightly highlighted */
.pcs-dd-brand {
    background: #f8fbfd;
    border-bottom: 2px solid var(--pcs-border) !important;
}
.pcs-dd-brand:hover { background: var(--pcs-blue-lt); }

/* ─── Logo ─── */

.pcs-dd-logo-wrap {
    width: 42px; height: 42px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #f4f6f9;
    border-radius: 8px;
    border: 1px solid var(--pcs-border);
    overflow: hidden;
    margin-top: 2px;
}

.pcs-dd-logo {
    max-width: 100%; max-height: 100%;
    object-fit: contain; display: block;
}

.pcs-dd-initial {
    font-size: 17px; font-weight: 800;
    color: var(--pcs-blue);
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: var(--pcs-blue-lt);
}

.pcs-dd-page-icon::before {
    content: '📄';
    font-size: 18px;
}

/* ─── Text body ─── */

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

.pcs-dd-title {
    font-size: 13px; font-weight: 600;
    color: var(--pcs-text);
    white-space: normal;
    word-break: break-word;
    display: block;
    line-height: 1.4;
}

.pcs-dd-brand .pcs-dd-title { font-size: 14px; }

.pcs-dd-sub {
    display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
    font-size: 11px; color: var(--pcs-muted);
}

/* ─── Badges ─── */

.pcs-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 20px;
    font-size: 10px; font-weight: 800;
    letter-spacing: .04em;
    flex-shrink: 0;
}

.pcs-badge-code  { background: #fef9c3; color: #854d0e; border: 1px solid #fcd34d; }
.pcs-badge-deal  { background: #dcfce7; color: #166534; border: 1px solid #86efac; }

/* ─── Code copy button ─── */

.pcs-copy-btn {
    background: var(--pcs-blue-lt);
    color: var(--pcs-blue-dk);
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    padding: 1px 7px;
    font-size: 11px; font-weight: 700;
    cursor: pointer;
    font-family: monospace;
    letter-spacing: .04em;
    transition: background .15s, color .15s;
}
.pcs-copy-btn:hover,
.pcs-copy-btn.copied { background: var(--pcs-green); color: #fff; border-color: var(--pcs-green); }

/* ─── Expiry ─── */

.pcs-expiry { font-size: 11px; color: var(--pcs-muted); }

/* ─── Placeholder logo ─── */

.pcs-dd-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: #f1f5f9;
}
.pcs-dd-placeholder svg {
    width: 20px; height: 20px;
    color: #94a3b8;
}

/* ─── Direct affiliate offer ─── */

.pcs-dd-offer-direct {
    border-left: 3px solid var(--pcs-orange);
}

/* ─── CTA label ─── */

.pcs-dd-cta-label {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 700;
    color: var(--pcs-blue);
    white-space: nowrap;
    flex-shrink: 0;
    opacity: .7;
    transition: opacity .15s;
}
.pcs-dd-cta-label svg { width: 13px; height: 13px; }
.pcs-dd-row:hover .pcs-dd-cta-label { opacity: 1; }

/* ─── Arrow ─── */

.pcs-dd-arrow {
    flex-shrink: 0;
    color: var(--pcs-blue);
    opacity: .5;
    transition: opacity .15s, transform .15s;
}
.pcs-dd-arrow svg { width: 14px; height: 14px; display: block; }
.pcs-dd-row:hover .pcs-dd-arrow { opacity: 1; transform: translateX(2px); }

/* ─── Loading / empty ─── */

.pcs-dd-state {
    padding: 16px 18px;
    font-size: 13px;
    color: var(--pcs-muted);
    display: flex; align-items: center; gap: 10px;
}

.pcs-dd-empty { color: #64748b; }
.pcs-dd-empty strong { color: var(--pcs-text); }

.pcs-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid var(--pcs-blue-lt);
    border-top-color: var(--pcs-blue);
    border-radius: 50%;
    animation: pcs-spin .7s linear infinite;
    flex-shrink: 0;
}
@keyframes pcs-spin { to { transform: rotate(360deg); } }

/* ─── Skeleton loading (ghost cards + shimmer) ─── */

.pcs-skel-wrap { padding: 2px 0; }

.pcs-skel-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 14px;
    border-bottom: 1px solid #f1f5f9;
}
.pcs-skel-row:last-child { border-bottom: none; }

.pcs-skel-logo {
    width: 42px; height: 42px;
    border-radius: 8px;
    flex-shrink: 0;
}

.pcs-skel-body {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 8px;
}

.pcs-skel-line { height: 10px; border-radius: 5px; }
.pcs-skel-title { width: 72%; }
.pcs-skel-sub   { width: 42%; height: 8px; }

.pcs-skel-cta {
    width: 64px; height: 14px;
    border-radius: 5px;
    flex-shrink: 0;
}

/* Shimmer applied to every ghost element */
.pcs-skel-logo,
.pcs-skel-line,
.pcs-skel-cta {
    background: linear-gradient(90deg, #eef1f5 25%, #e2e8f0 37%, #eef1f5 63%);
    background-size: 400% 100%;
    animation: pcs-shimmer 1.4s ease infinite;
}

@keyframes pcs-shimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* Rotating reassurance line — sits at the top, just under the search bar */
.pcs-loading-msg {
    text-align: center;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--pcs-blue);
    padding: 12px 14px 10px;
    border-bottom: 1px solid #f1f5f9;
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .pcs-skel-logo, .pcs-skel-line, .pcs-skel-cta { animation: none; }
}

/* ════════════════════════════════════════════════════════════════════════════
   Stay BEHIND the PDO content locker when a page is locked.
   The locker adds body.pdo-lock-active; its modal sits at z-index 10000, so we
   hide the floating search UI (which sits far higher) while content is locked.
   ════════════════════════════════════════════════════════════════════════════ */

body.pdo-lock-active #pcs-mobile-sticky,
body.pdo-lock-active .pcs-search-dropdown {
    display: none !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   MOBILE STICKY SEARCH BAR
   ════════════════════════════════════════════════════════════════════════════ */

#pcs-mobile-sticky {
    display: none; /* hidden on desktop — JS moves it into place */
}

@media (max-width: 768px) {

    #pcs-mobile-sticky {
        display: block;
        position: sticky;
        top: 0;
        z-index: 99990;
        background: var(--pcs-blue);
        padding: 8px 12px 10px;
        box-shadow: 0 3px 12px rgba(0,0,0,0.22);
        transition: box-shadow .2s;
    }

    #pcs-mobile-sticky .pcs-mobile-sticky-inner {
        max-width: 100%;
        margin: 0;
    }

    #pcs-mobile-sticky .pcs-search-input-wrap {
        border-color: rgba(255,255,255,0.5);
        box-shadow: none;
    }
    #pcs-mobile-sticky .pcs-search-input-wrap:focus-within {
        border-color: #fff;
        box-shadow: 0 0 0 3px rgba(255,255,255,0.25);
    }

    #pcs-mobile-sticky .pcs-search-icon {
        color: var(--pcs-blue);
        margin-left: 14px;
    }

    #pcs-mobile-sticky .pcs-search-input {
        font-size: 14px;
        padding: 10px 4px;
        color: var(--pcs-text);
    }

    #pcs-mobile-sticky .pcs-search-btn {
        min-height: 42px;
        padding: 0 16px;
        font-size: 13px;
        background: var(--pcs-blue-dk);
        border-radius: 0 50px 50px 0;
    }
    #pcs-mobile-sticky .pcs-search-btn:hover {
        background: #003e5e;
    }

    #pcs-mobile-sticky .pcs-search-dropdown {
        left: -12px;
        right: -12px;
        border-radius: 0 0 var(--pcs-radius) var(--pcs-radius);
        max-height: 60vh;
        border-top: none;
    }

    /* ── Standard mobile tweaks for main search ── */
    .pcs-search-input { font-size: 14px; padding: 11px 4px; }
    .pcs-search-icon  { margin: 0 6px 0 12px; width: 17px; height: 17px; }
    .pcs-search-btn   { padding: 0 14px; font-size: 13px; min-height: 44px; }
    .pcs-search-dropdown { max-height: 380px; }
    .pcs-dd-row { padding: 9px 12px; gap: 9px; }
    .pcs-dd-logo-wrap { width: 36px; height: 36px; }
    .pcs-dd-title { font-size: 12px; }
}
