/* ============================================================
   PPST Resource Library — Stylesheet
   Matches ppstsolutions.com/library/ design
   ============================================================ */

.ppst-rl-wrapper {
    --rl-navy:        #0c2d57;
    --rl-navy-mid:    #12305a;
    --rl-blue:        #1565c0;
    --rl-accent:      #2979ff;
    --rl-teal:        #0288d1;
    --rl-circuit-bg:  #061529;
    --rl-circuit-2:   #0a1f3d;
    --rl-border:      #dde3ec;
    --rl-bg:          #f4f6fb;
    --rl-card-bg:     #ffffff;
    --rl-text:        #1a2535;
    --rl-muted:       #6b7a99;
    --rl-badge-bg:    #e8f4ff;
    --rl-badge-color: #1565c0;
    --rl-radius:      10px;
    --rl-shadow:      0 2px 14px rgba(12,45,87,.09);
    --rl-shadow-h:    0 8px 28px rgba(12,45,87,.18);
    --rl-sidebar-w:   270px;
    --rl-trans:       0.22s ease;
    font-family: inherit;
    color: var(--rl-text);
    width: 100% !important;
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
    box-sizing: border-box !important;
}

/* ── Search Bar ─────────────────────────────────────────── */
.ppst-rl-search-bar {
    margin-bottom: 28px;
}
.ppst-rl-search-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1.5px solid var(--rl-border);
    border-radius: 8px;
    padding: 10px 16px;
    max-width: 520px;
    box-shadow: var(--rl-shadow);
    transition: border-color var(--rl-trans);
}
.ppst-rl-search-inner:focus-within {
    border-color: var(--rl-teal);
}
.ppst-rl-search-inner svg { color: var(--rl-muted); flex-shrink: 0; }
.ppst-rl-search-input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 14px;
    color: var(--rl-text);
    background: transparent;
}
.ppst-rl-search-input::placeholder { color: var(--rl-muted); }

/* ── Layout ─────────────────────────────────────────────── */
.ppst-rl-layout {
    display: flex !important;
    gap: 32px;
    align-items: flex-start;
    width: 100%;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.ppst-rl-sidebar {
    width: var(--rl-sidebar-w);
    min-width: var(--rl-sidebar-w);
    flex-shrink: 0;
    background: var(--rl-card-bg);
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius);
    box-shadow: var(--rl-shadow);
    position: sticky;
    top: 90px;
    overflow: hidden;
}
.ppst-rl-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    background: var(--rl-navy);
    color: #fff;
}
.ppst-rl-sidebar-header > span {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.ppst-rl-clear {
    background: transparent;
    border: 1px solid rgba(255,255,255,.4);
    color: rgba(255,255,255,.9);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--rl-trans);
}
.ppst-rl-clear:hover { background: rgba(255,255,255,.15); border-color: #fff; }

/* ── Filter Groups ───────────────────────────────────────── */
.ppst-rl-filter-group {
    border-bottom: 1px solid var(--rl-border);
}
.ppst-rl-filter-group:last-child { border-bottom: none; }
.ppst-rl-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--rl-navy);
    transition: background var(--rl-trans);
}
.ppst-rl-group-header:hover { background: var(--rl-bg); }
.ppst-rl-chevron { transition: transform var(--rl-trans); flex-shrink: 0; }
.ppst-rl-group-header[aria-expanded="false"] .ppst-rl-chevron { transform: rotate(180deg); }
.ppst-rl-group-body { padding: 2px 16px 10px; }
.ppst-rl-group-body.collapsed { display: none; }

/* ── Checkboxes ──────────────────────────────────────────── */
.ppst-rl-check-label {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 0;
    cursor: pointer;
    user-select: none;
    position: relative;
}
.ppst-rl-check-label:hover .ppst-rl-check-text { color: var(--rl-blue); }
.ppst-rl-checkbox { position: absolute; opacity: 0; width: 0; height: 0; }
.ppst-rl-check-box {
    width: 17px; height: 17px; min-width: 17px;
    border: 2px solid #b0bdd6;
    border-radius: 3px;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--rl-trans);
}
.ppst-rl-checkbox:checked + .ppst-rl-check-box {
    background: var(--rl-blue);
    border-color: var(--rl-blue);
}
.ppst-rl-checkbox:checked + .ppst-rl-check-box::after {
    content: '';
    display: block;
    width: 4px; height: 8px;
    border: 2px solid #fff;
    border-top: none; border-left: none;
    transform: rotate(42deg) translateY(-1px);
}
.ppst-rl-check-text { font-size: 12.5px; color: var(--rl-text); line-height: 1.3; }

/* Hierarchical products */
.ppst-rl-prod-parent { margin-bottom: 2px; }
.ppst-rl-parent-label { font-weight: 600; }
.ppst-rl-prod-toggle {
    background: none; border: none; cursor: pointer;
    padding: 0; margin-left: auto; color: var(--rl-muted);
    display: flex; align-items: center;
    transition: transform var(--rl-trans);
}
.ppst-rl-prod-toggle[aria-expanded="true"] { transform: rotate(180deg); }
.ppst-rl-children {
    padding-left: 20px;
    border-left: 2px solid var(--rl-border);
    margin: 2px 0 4px 8px;
}
.ppst-rl-children.collapsed { display: none; }
.ppst-rl-child-label .ppst-rl-check-text { font-size: 12px; color: var(--rl-muted); }

/* ── Main Column ─────────────────────────────────────────── */
.ppst-rl-main { flex: 1; min-width: 0; position: relative; }

/* Toolbar */
.ppst-rl-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--rl-border);
    flex-wrap: wrap;
    gap: 10px;
}
.ppst-rl-count { font-size: 14px; color: var(--rl-muted); }
.ppst-rl-count strong { font-size: 17px; color: var(--rl-navy); }
.ppst-rl-sort-wrap { display: flex; align-items: center; gap: 8px; }
.ppst-rl-sort-label { font-size: 13px; font-weight: 600; color: var(--rl-muted); }
.ppst-rl-sort-select {
    border: 1px solid var(--rl-border);
    border-radius: 6px;
    padding: 7px 30px 7px 10px;
    font-size: 13px;
    color: var(--rl-text);
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230c2d57' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center;
    -webkit-appearance: none; appearance: none; cursor: pointer;
}

/* Mobile toggle */
.ppst-rl-mobile-toggle {
    display: none;
    align-items: center; gap: 8px;
    background: var(--rl-navy); color: #fff;
    border: none; border-radius: 6px;
    padding: 10px 18px; font-size: 14px; font-weight: 600;
    cursor: pointer; margin-bottom: 14px; width: 100%; justify-content: center;
}
.ppst-rl-badge {
    background: #ff5252; color: #fff;
    font-size: 11px; font-weight: 800;
    width: 19px; height: 19px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
}

/* Active tags */
.ppst-rl-active-tags {
    display: flex; flex-wrap: wrap; gap: 7px;
    margin-bottom: 14px; min-height: 0;
}
.ppst-rl-active-tags:empty { margin-bottom: 0; }
.ppst-rl-tag {
    display: inline-flex; align-items: center; gap: 6px;
    background: #e8f0fe; color: var(--rl-blue);
    border: 1px solid #bdd0f8; border-radius: 20px;
    padding: 4px 10px 4px 12px; font-size: 12px; font-weight: 600;
    animation: rl-tag-in .18s ease;
}
@keyframes rl-tag-in { from{opacity:0;transform:scale(.85)} to{opacity:1;transform:scale(1)} }
.ppst-rl-tag-remove {
    background: none; border: none; cursor: pointer; padding: 0;
    display: flex; align-items: center; color: var(--rl-blue);
    opacity: .7; transition: opacity var(--rl-trans);
}
.ppst-rl-tag-remove:hover { opacity: 1; }

/* ── Loading ─────────────────────────────────────────────── */
.ppst-rl-loading {
    display: none; justify-content: center; padding: 50px;
    position: absolute; top: 60px; left: 0; right: 0; z-index: 5;
}
.ppst-rl-loading.visible { display: flex; }
.ppst-rl-spinner {
    width: 38px; height: 38px;
    border: 3px solid var(--rl-border);
    border-top-color: var(--rl-blue);
    border-radius: 50%;
    animation: rl-spin .7s linear infinite;
}
@keyframes rl-spin { to { transform: rotate(360deg); } }

/* ── Resource Grid ───────────────────────────────────────── */
.ppst-rl-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 20px;
    transition: opacity .2s ease;
}
.ppst-rl-grid.loading { opacity: .3; pointer-events: none; }

/* ── Resource Card ───────────────────────────────────────── */
.ppst-rl-card {
    background: var(--rl-card-bg);
    border-radius: var(--rl-radius);
    overflow: hidden;
    box-shadow: var(--rl-shadow);
    border: 1px solid var(--rl-border);
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--rl-trans), transform var(--rl-trans);
    animation: rl-card-in .28s ease;
}
@keyframes rl-card-in { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
.ppst-rl-card:hover {
    box-shadow: var(--rl-shadow-h);
    transform: translateY(-3px);
}

/* Card Image Area — dark circuit board look */
.ppst-rl-card-img-link { display: block; text-decoration: none; }
.ppst-rl-card-img {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.ppst-rl-thumb {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* Circuit board background (when no thumbnail) */
.ppst-rl-circuit-bg {
    width: 100%; height: 100%;
    background:
        linear-gradient(135deg, #061529 0%, #0a1f3d 40%, #061a30 70%, #041020 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Circuit pattern using pseudo elements */
.ppst-rl-circuit-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        /* Horizontal lines */
        repeating-linear-gradient(0deg, transparent, transparent 28px, rgba(0,150,255,.06) 28px, rgba(0,150,255,.06) 29px),
        /* Vertical lines */
        repeating-linear-gradient(90deg, transparent, transparent 28px, rgba(0,150,255,.06) 28px, rgba(0,150,255,.06) 29px);
    background-size: 28px 28px;
}
.ppst-rl-circuit-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(0,120,255,.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0,180,255,.10) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(0,100,200,.06) 0%, transparent 70%);
}

/* Glowing dots on circuit bg */
.ppst-rl-circuit-bg .ppst-rl-center-icon {
    position: relative;
    z-index: 2;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 50%;
    width: 70px; height: 70px;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    color: rgba(255,255,255,.85);
    box-shadow: 0 0 20px rgba(0,150,255,.3);
}

/* Icon overlay on thumbnail */
.ppst-rl-icon-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 50%;
    width: 64px; height: 64px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    backdrop-filter: blur(6px);
}

/* Card Body */
.ppst-rl-card-body {
    padding: 14px 16px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0;
}

/* Type Badge — "DATASHEET", "SOFTWARE & INSTRUMENT DRIVER" */
.ppst-rl-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--rl-badge-color);
    background: var(--rl-badge-bg);
    border-radius: 4px;
    padding: 3px 8px;
    margin-bottom: 7px;
    line-height: 1.4;
}

.ppst-rl-card-title-link { text-decoration: none; }
.ppst-rl-card-title {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--rl-navy);
    margin: 0 0 auto;
    line-height: 1.4;
    padding-bottom: 12px;
    transition: color var(--rl-trans);
}
.ppst-rl-card-title-link:hover .ppst-rl-card-title { color: var(--rl-blue); }

/* Card Footer */
.ppst-rl-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--rl-border);
    padding-top: 11px;
    margin-top: 8px;
}
.ppst-rl-file-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--rl-muted);
}
.ppst-rl-view-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    color: var(--rl-navy);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: .06em;
    transition: color var(--rl-trans);
}
.ppst-rl-view-more:hover { color: var(--rl-blue); text-decoration: none; }
.ppst-rl-view-more svg { transition: transform var(--rl-trans); }
.ppst-rl-view-more:hover svg { transform: translateX(3px); }

/* ── No Results ──────────────────────────────────────────── */
.ppst-rl-no-results {
    grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--rl-muted);
}
.ppst-rl-no-results svg { color: #c5cee0; margin-bottom: 14px; }
.ppst-rl-no-results p { font-size: 15px; margin: 0 0 14px; }
.ppst-rl-clear-btn {
    background: var(--rl-blue); color: #fff; border: none;
    padding: 9px 20px; border-radius: 6px; font-size: 13px;
    font-weight: 600; cursor: pointer;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1100px) {
    .ppst-rl-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 900px) {
    .ppst-rl-mobile-toggle { display: flex; }
    .ppst-rl-layout { flex-direction: column; }
    .ppst-rl-sidebar { width: 100%; min-width: 0; position: static; display: none; }
    .ppst-rl-sidebar.open { display: block; }
    .ppst-rl-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 540px) {
    .ppst-rl-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .ppst-rl-toolbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 380px) {
    .ppst-rl-grid { grid-template-columns: 1fr !important; }
}

/* ── Theme Compatibility ─────────────────────────────────── */
.ppst-rl-wrapper *, .ppst-rl-wrapper *::before, .ppst-rl-wrapper *::after { box-sizing: border-box; }
.ppst-rl-wrapper h3 { margin-top: 0; }
.ppst-rl-wrapper ul { margin: 0; padding: 0; list-style: none; }
.ppst-rl-wrapper a { text-decoration: none; }
.ppst-rl-wrapper a:hover { text-decoration: none; }
.ppst-rl-wrapper button { line-height: 1; font-family: inherit; }
