/* LeadMagnet – Library / Marketplace CSS */

/* ------------------------------------------------------------------ */
/* Controls bar (search + category pills)                              */
/* ------------------------------------------------------------------ */
.lm-library {
    font-family: inherit;
    max-width: 1200px;
    margin: 0 auto;
}

.lm-lib-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}

/* Search */
.lm-lib-search-wrap {
    position: relative;
    flex: 1 1 260px;
    min-width: 200px;
}

.lm-lib-search {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.lm-lib-search:focus {
    border-color: #0073aa;
}

.lm-lib-search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 16px;
    opacity: 0.55;
}

/* Category pills */
.lm-lib-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.lm-cat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 2px solid #d0d0d0;
    border-radius: 20px;
    background: #fff;
    color: #444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.lm-cat-pill:hover {
    border-color: #0073aa;
    color: #0073aa;
}

.lm-cat-pill.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.lm-cat-count {
    display: inline-block;
    background: rgba(255,255,255,0.25);
    border-radius: 10px;
    padding: 0 7px;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
}

.lm-cat-pill.active .lm-cat-count {
    background: rgba(255,255,255,0.3);
}

/* Results count */
.lm-lib-results-count {
    color: #777;
    font-size: 13px;
    margin: 0 0 16px;
}

/* ------------------------------------------------------------------ */
/* Grid                                                                 */
/* ------------------------------------------------------------------ */
.lm-lib-grid {
    display: grid;
    gap: 24px;
}

.lm-lib-cols-1 { grid-template-columns: 1fr; }
.lm-lib-cols-2 { grid-template-columns: repeat(2, 1fr); }
.lm-lib-cols-3 { grid-template-columns: repeat(3, 1fr); }
.lm-lib-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .lm-lib-cols-3,
    .lm-lib-cols-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 580px) {
    .lm-lib-cols-2,
    .lm-lib-cols-3,
    .lm-lib-cols-4 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/* Resource card                                                        */
/* ------------------------------------------------------------------ */
.lm-lib-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e8e8e8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}

.lm-lib-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

/* Thumbnail area */
.lm-card-thumb {
    position: relative;
    background: #f3f4f6;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.lm-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Placeholder with first-letter initial */
.lm-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0073aa 0%, #00a0d2 100%);
    color: #fff;
    font-size: 52px;
    font-weight: 800;
    user-select: none;
}

.lm-card-paid .lm-thumb-placeholder {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
}

/* Badge (FREE / Price) */
.lm-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.lm-badge-free {
    background: #16a34a;
    color: #fff;
}

.lm-badge-paid {
    background: #7c3aed;
    color: #fff;
}

/* Card body */
.lm-card-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}

.lm-card-cat {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #0073aa;
}

.lm-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.3;
}

.lm-card-desc {
    font-size: 14px;
    color: #555;
    line-height: 1.55;
    margin: 0;
    flex: 1;
}

.lm-card-guidance {
    font-size: 13px;
    color: #0073aa;
    text-decoration: none;
}

.lm-card-guidance:hover {
    text-decoration: underline;
}

.lm-card-cta {
    display: block;
    width: 100%;
    padding: 11px 14px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    text-align: center;
}

.lm-card-cta-free {
    background: #0073aa;
    color: #fff;
}

.lm-card-cta-free:hover { background: #005f8d; }

.lm-card-cta-paid {
    background: #7c3aed;
    color: #fff;
}

.lm-card-cta-paid:hover { background: #6d28d9; }

/* Empty / no-results */
.lm-lib-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: #888;
    font-size: 16px;
}

.lm-library-empty {
    text-align: center;
    padding: 32px;
    color: #888;
}

/* ------------------------------------------------------------------ */
/* Modal overlay                                                        */
/* ------------------------------------------------------------------ */
.lm-lib-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    backdrop-filter: blur(2px);
}

.lm-lib-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
    animation: lm-modal-in 0.22s ease;
}

@keyframes lm-modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.lm-lib-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 32px;
    height: 32px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #444;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.lm-lib-modal-close:hover { background: #e5e7eb; }

.lm-lib-modal-body {
    padding: 28px 28px 24px;
}

/* Inside modal: widget styling tweaks */
.lm-lib-widget .lm-widget {
    box-shadow: none;
    border: none;
    padding: 0;
}

.lm-lib-form-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 6px;
    padding-right: 32px;
    color: #1a1a1a;
}

.lm-paid-notice {
    background: #faf5ff;
    border-left: 4px solid #7c3aed;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    color: #444;
    margin-bottom: 12px;
}

/* Card hidden animation */
.lm-lib-card.lm-hidden {
    display: none;
}
