/* ============================================
   Books Search Plugin – v1.2.0
   Author: Sreeja
   ============================================ */

/* ── Wrapper ── */
.bksearch-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    width: 100%;
    margin: 20px 0 30px;
    box-sizing: border-box;
}

/* ── Search Bar ── */
.bksearch-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    max-width: 520px;
}

.bksearch-input-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.bksearch-icon {
    position: absolute;
    left: 11px;
    color: #aab0bc;
    pointer-events: none;
}

.bksearch-input {
    width: 100%;
    padding: 9px 34px 9px 36px;
    font-size: 13.5px;
    border: 1.5px solid #e2e5ec;
    border-radius: 8px;
    outline: none;
    background: #fff;
    color: #1c2333;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
}
.bksearch-input::placeholder { color: #aab0bc; }
.bksearch-input:focus {
    border-color: #2d6a4f;
    box-shadow: 0 0 0 3px rgba(45,106,79,.10);
}

.bksearch-clear {
    position: absolute;
    right: 9px;
    background: none;
    border: none;
    font-size: 13px;
    color: #aab0bc;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
}
.bksearch-clear:hover { color: #4b5563; }

.bksearch-btn {
    padding: 9px 18px;
    background: #2d6a4f;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s, transform .1s;
    flex-shrink: 0;
}
.bksearch-btn:hover  { background: #1b4332; }
.bksearch-btn:active { transform: scale(.97); }

/* ── Status ── */
.bksearch-status {
    font-size: 12.5px;
    color: #8a94a6;
    margin: 0 0 16px;
    min-height: 16px;
}

/* ── Grid ── */
.bksearch-grid { display: grid; gap: 22px; }
.bksearch-cols-1 { grid-template-columns: 1fr; }
.bksearch-cols-2 { grid-template-columns: repeat(2, 1fr); }
.bksearch-cols-3 { grid-template-columns: repeat(3, 1fr); }
.bksearch-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Horizontal layout ── */
.bksearch-layout-horizontal .bksearch-grid { grid-template-columns: 1fr !important; gap: 16px; }
.bksearch-layout-horizontal .bksearch-result-card { flex-direction: row; align-items: flex-start; }
.bksearch-layout-horizontal .bksearch-thumb { width: 130px; min-width: 130px; flex-shrink: 0; }
.bksearch-layout-horizontal .bksearch-thumb img,
.bksearch-layout-horizontal .bksearch-no-thumb { height: 170px; }

/* ── Card ── */
.bksearch-result-card {
    background: #ffffff;
    border: 1px solid #e8ecf0;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .22s ease, box-shadow .22s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,.055);
}
.bksearch-result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 32px rgba(0,0,0,.10);
}

/* ── Thumbnail ── */
.bksearch-thumb {
    display: block;
    background: #f0f4f0;
    text-decoration: none;
    overflow: hidden;
}
.bksearch-thumb img {
    width: 100%;
    height: 210px;
    object-fit: cover;
    display: block;
    transition: transform .35s ease;
}
.bksearch-result-card:hover .bksearch-thumb img { transform: scale(1.05); }

.bksearch-no-thumb {
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 46px;
    background: linear-gradient(135deg, #f0f4f0 0%, #e8f0e8 100%);
}

/* ── Card body ── */
.bksearch-content {
    padding: 16px 18px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 3px solid #2d6a4f;
}

.bksearch-content h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    color: #1c2333;
}
.bksearch-content h3 a {
    text-decoration: none;
    color: inherit;
    transition: color .15s;
}
.bksearch-content h3 a:hover { color: #2d6a4f; }

/* ── Meta tags ── */
.bksearch-book-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 2px 0;
}
.bksearch-book-meta span {
    font-size: 11.5px;
    font-weight: 500;
    background: #f0f7f4;
    color: #2d6a4f;
    border: 1px solid #d0e8dc;
    border-radius: 5px;
    padding: 3px 9px;
    white-space: nowrap;
}

/* ── Excerpt ── */
.bksearch-content p {
    margin: 0;
    font-size: 13px;
    color: #5a6478;
    line-height: 1.65;
    flex: 1;
}

/* ── View Details link ── */
.bksearch-read-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #2d6a4f;
    text-decoration: none;
    width: fit-content;
    padding: 6px 14px;
    border: 1.5px solid #2d6a4f;
    border-radius: 6px;
    transition: background .18s, color .18s;
}
.bksearch-read-more:hover {
    background: #2d6a4f;
    color: #fff;
}

/* ── Loading ── */
.bksearch-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 52px 0;
    color: #8a94a6;
    font-size: 14px;
}
.bksearch-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid #e2e8e4;
    border-top-color: #2d6a4f;
    border-radius: 50%;
    animation: bkspin .65s linear infinite;
    flex-shrink: 0;
}
@keyframes bkspin { to { transform: rotate(360deg); } }

/* ── Empty state ── */
.bksearch-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}
.bksearch-empty svg { display: block; margin: 0 auto 14px; opacity: .3; }
.bksearch-empty p { font-size: 14px; margin: 0; color: #8a94a6; }

/* ── Elementor editor notice ── */
.bksearch-editor-notice {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 44px 20px;
    text-align: center;
    background: #f8faf8;
    border: 2px dashed #d0e8dc;
    border-radius: 10px;
    gap: 10px;
}
.bksearch-editor-notice span { font-size: 36px; }
.bksearch-editor-notice p { margin: 0; font-size: 13.5px; color: #6b7280; line-height: 1.65; }
.bksearch-editor-notice strong { color: #1c2333; }

/* ── Pagination ── */
.bksearch-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 28px;
}
.bksearch-page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    border: 1.5px solid #e2e5ec;
    border-radius: 7px;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    cursor: pointer;
    transition: all .18s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.bksearch-page-btn:hover:not(:disabled) {
    border-color: #2d6a4f;
    color: #2d6a4f;
    background: #f0f7f4;
}
.bksearch-page-btn.active {
    background: #2d6a4f;
    border-color: #2d6a4f;
    color: #fff;
    font-weight: 700;
}
.bksearch-page-btn:disabled { opacity: .38; cursor: default; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .bksearch-cols-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
    .bksearch-cols-3,
    .bksearch-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .bksearch-bar { max-width: 100%; }
}
@media (max-width: 480px) {
    .bksearch-cols-2,
    .bksearch-cols-3,
    .bksearch-cols-4 { grid-template-columns: 1fr; }
    .bksearch-layout-horizontal .bksearch-result-card { flex-direction: column; }
    .bksearch-layout-horizontal .bksearch-thumb { width: 100%; min-width: 100%; }
}
