/* =========================================================
   BookMarket Search — Stylesheet v3
   Woodmart + WCFM Marketplace compatible
   Two-page layout: Book Listings + Book Detail
   ========================================================= */

/* Suppress Woodmart's native search results panel */
.woodmart-search-results,
.wd-search-results { display: none !important; }

/* Design tokens */
:root {
    --bms-primary:      #ff8513;
    --bms-primary-dark: #ff8513;
    --bms-link:         #ff8513;
    --bms-bg:           #f9f9f9;
    --bms-white:        #ffffff;
    --bms-text:         #2c2c2c;
    --bms-text-light:   #666;
    --bms-border:       #e5e5e5;
    --bms-shadow:       0 2px 12px rgba(0,0,0,.07);
    --bms-radius:       8px;
    --bms-tr:           0.2s ease;
}

/* ── AUTOCOMPLETE DROPDOWN ─────────────────────────────── */
.bms-ac-dropdown {
    position: absolute;
    top: calc(100% + 4px); left: 0; right: 0;
    background: var(--bms-white);
    border: 1px solid var(--bms-border);
    border-radius: var(--bms-radius);
    box-shadow: 0 8px 32px rgba(0,0,0,.14);
    z-index: 999999; overflow: hidden;
    display: none;
    min-width: 280px;
    animation: bmsDropIn .14s ease;
}
@keyframes bmsDropIn { from{opacity:0;transform:translateY(-5px)} to{opacity:1;transform:translateY(0)} }

.bms-ac-list { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }

.bms-ac-item {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 13px; text-decoration: none;
    color: var(--bms-text); border-bottom: 1px solid #f2f2f2;
    transition: background var(--bms-tr); cursor: pointer;
}
.bms-ac-item:last-child { border-bottom: none; }
.bms-ac-item:hover, .bms-ac-item.is-active { background: #fef5f5; color: var(--bms-text); text-decoration: none; }

.bms-ac-thumb {
    width: 36px; height: 52px; object-fit: cover; border-radius: 2px;
    flex-shrink: 0; background: #eee; box-shadow: 1px 2px 5px rgba(0,0,0,.10);
}
.bms-ac-thumb--none {
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #ccc; background: #f4f4f4;
}
.bms-ac-info { flex:1; min-width:0; }
.bms-ac-title { font-size:13px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bms-ac-title mark { background:transparent; color:var(--bms-primary); font-weight:700; }
.bms-ac-author { font-size:12px; color:var(--bms-text-light); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bms-ac-isbn   { font-size:11px; color:#aaa; font-family:monospace; margin-top:1px; }

.bms-ac-loading {
    display:flex; align-items:center; gap:9px;
    padding:13px 16px; color:var(--bms-text-light); font-size:13px;
}
.bms-ac-spinner {
    width:15px; height:15px; flex-shrink:0;
    border:2px solid #e5e5e5; border-top-color:var(--bms-primary);
    border-radius:50%; animation:bmsSpin .55s linear infinite;
}
@keyframes bmsSpin { to{transform:rotate(360deg)} }
.bms-ac-empty { padding:14px 16px; text-align:center; color:var(--bms-text-light); font-size:13px; }
.bms-ac-footer {
    display:block; padding:10px 16px; text-align:center;
    font-size:13px; font-weight:600;
    color:var(--bms-white)!important; background:var(--bms-primary);
    text-decoration:none; border-top:1px solid var(--bms-primary-dark);
    transition:background var(--bms-tr);
}
.bms-ac-footer:hover { background:var(--bms-primary-dark); color:var(--bms-white)!important; }

/* ── OUR SEARCH BAR ────────────────────────────────────── */
.bms-search-wrap { position:relative; width:700px; max-width:700px; }
.bms-search-form { position:relative; width:100%; }

.bms-search-input-wrap {
    display:flex; align-items:center;
    background:var(--bms-white);
    border:2px solid var(--bms-border);
    border-radius:50px; overflow:hidden;
    box-shadow:0 2px 8px rgba(0,0,0,.06);
    transition:border-color var(--bms-tr),box-shadow var(--bms-tr);
}
.bms-search-input-wrap:focus-within {
    border-color:var(--bms-primary);
    box-shadow:0 0 0 3px rgba(192,57,43,.10);
}
.bms-search-input {
    flex:1; border:none!important; outline:none!important;
    background:transparent!important;
    font-size:15px!important; color:var(--bms-text)!important;
    box-shadow:none!important; min-width:0;
}
.bms-search-input::placeholder { color:#b0b0b0; }
.bms-search-btn {
    flex-shrink:0; background:#fff !important; border:none; cursor:pointer;
    padding:10px 18px; color:#fff; display:flex; align-items:center; justify-content:center;
    border-radius:0 50px 50px 0; transition:background var(--bms-tr); height:100%;
}

/* ── PAGE WRAPPER ──────────────────────────────────────── */
.bms-page__search-header { background:var(--bms-primary); padding:24px 20px; }
.bms-page__search-inner  { max-width:800px; margin:0 auto; }
.bms-page__search-header .bms-search-input-wrap {
    border-color:transparent; box-shadow:0 4px 20px rgba(0,0,0,.16);
}
.bms-page__body { max-width:1000px; margin:0 auto; padding:28px 20px 60px; }

/* ── EMPTY STATE ───────────────────────────────────────── */
.bms-empty-state { text-align:center; padding:60px 20px; }
.bms-empty-state__icon { font-size:52px; margin-bottom:14px; }
.bms-empty-state h2    { font-size:20px; color:var(--bms-text); margin-bottom:8px; }
.bms-empty-state p     { color:var(--bms-text-light); font-size:14px; }

/* ── BREADCRUMB (back link) ────────────────────────────── */
.bms-breadcrumb { margin-bottom:18px; }
.bms-breadcrumb__back {
    display:inline-flex; align-items:center; gap:5px;
    font-size:13px; color:var(--bms-text-light);
    text-decoration:none;
    transition:color var(--bms-tr);
}
.bms-breadcrumb__back:hover { color:var(--bms-primary); }

/* ══════════════════════════════════════════════════════════
   BOOK LISTINGS PAGE
══════════════════════════════════════════════════════════ */
.bms-listings__meta {
    font-size:14px; color:var(--bms-text-light);
    margin-bottom:22px;
    padding-bottom:14px;
    border-bottom:1px solid var(--bms-border);
}

/* Card grid — single-column list (like metabook.gr search results) */
.bms-listings__grid {
    display:flex; flex-direction:column; gap:14px;
}

.bms-listing-card {
    display:flex; gap:20px; align-items:flex-start;
    background:var(--bms-white);
    border:1px solid var(--bms-border);
    border-radius:var(--bms-radius);
    padding:18px 20px;
    box-shadow:var(--bms-shadow);
    text-decoration:none; color:var(--bms-text);
    transition:box-shadow var(--bms-tr), transform var(--bms-tr);
    animation:bmsCardIn .2s ease both;
}
.bms-listing-card:hover {
    box-shadow:0 6px 24px rgba(0,0,0,.12);
    transform:translateY(-2px);
    text-decoration:none; color:var(--bms-text);
}
@keyframes bmsCardIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

/* Stagger */
.bms-listings__grid .bms-listing-card:nth-child(1) { animation-delay:.03s }
.bms-listings__grid .bms-listing-card:nth-child(2) { animation-delay:.07s }
.bms-listings__grid .bms-listing-card:nth-child(3) { animation-delay:.11s }
.bms-listings__grid .bms-listing-card:nth-child(4) { animation-delay:.15s }
.bms-listings__grid .bms-listing-card:nth-child(n+5){ animation-delay:.18s }

.bms-listing-card__cover-wrap { flex-shrink:0; width:80px; }
.bms-listing-card__cover {
    width:80px; height:115px; object-fit:cover;
    border-radius:4px; display:block;
    box-shadow:2px 4px 12px rgba(0,0,0,.14);
}
.bms-listing-card__cover--placeholder {
    background:#f0ede8; display:flex;
    align-items:center; justify-content:center;
    font-size:32px; color:#ccc;
}

.bms-listing-card__info { flex:1; min-width:0; }

.bms-listing-card__title {
    font-size:16px!important; font-weight:700!important;
    color:var(--bms-text)!important;
    margin:0 0 4px!important; line-height:1.3!important;
    transition:color var(--bms-tr);
}
.bms-listing-card:hover .bms-listing-card__title { color:var(--bms-primary)!important; }

.bms-listing-card__author {
    font-size:13.5px;
    margin:0 0 6px; font-weight:500;
}
.bms-listing-card__meta {
    display:flex; flex-wrap:wrap; gap:6px; margin-bottom:5px;
    font-size:12px; color:var(--bms-text-light);
}
.bms-listing-card__meta span::after { content:'·'; margin-left:6px; }
.bms-listing-card__meta span:last-child::after { content:''; }

.bms-listing-card__isbn {
    font-size:11.5px; color:#aaa;
    font-family:monospace; margin-bottom:6px;
}
.bms-listing-card__desc {
    font-size:13px; color:var(--bms-text-light);
    line-height:1.55; margin:0 0 8px;
    display:-webkit-box; -webkit-line-clamp:2;
    -webkit-box-orient:vertical; overflow:hidden;
}
.bms-listing-card__cta {
    font-size:12.5px; font-weight:600;
    color:var(--bms-primary);
    display:inline-block; margin-top:2px;
}

/* ══════════════════════════════════════════════════════════
   BOOK DETAIL PAGE
══════════════════════════════════════════════════════════ */
.bms-detail {
    background:var(--bms-white);
    border:1px solid var(--bms-border);
    border-radius:var(--bms-radius);
    padding:28px 28px 24px;
    margin-bottom:32px;
    box-shadow:var(--bms-shadow);
}
.bms-detail__breadcrumb {
    font-size:12px; color:var(--bms-text-light);
    margin-bottom:18px; text-transform:uppercase; letter-spacing:.03em;
}
.bms-detail__breadcrumb a { color:var(--bms-link); text-decoration:none; }
.bms-detail__breadcrumb a:hover { text-decoration:underline; }

.bms-detail__inner { display:flex; gap:30px; align-items:flex-start; }

.bms-detail__cover-col { flex-shrink:0; width:140px; }
.bms-detail__cover {
    width:140px; height:210px; object-fit:cover;
    border-radius:5px; display:block;
    box-shadow:3px 5px 18px rgba(0,0,0,.18);
}
.bms-detail__cover--placeholder {
    background:linear-gradient(135deg,#f0ede8,#e0dbd4);
    display:flex; align-items:center; justify-content:center; font-size:48px;
}
.bms-detail__meta-col { flex:1; min-width:0; }

.bms-detail__title {
    font-size:22px!important; font-weight:700!important;
    color:var(--bms-text)!important; margin:0 0 6px!important; line-height:1.3!important;
}
.bms-detail__subtitle {
    display:block; font-size:15px; font-weight:400;
    color:var(--bms-text-light); margin-top:4px;
}
.bms-detail__author { font-size:15px; font-weight:500; margin:0 0 14px; }
.bms-detail__author a { color:var(--bms-link); text-decoration:none; }
.bms-detail__author a:hover { text-decoration:underline; }

/* Description */
.bms-detail__desc-wrap { margin-bottom:16px; }
.bms-detail__desc {
    font-size:14px; line-height:1.65; color:var(--bms-text-light);
    max-height:4.8em; overflow:hidden;
    transition:max-height .3s ease; position:relative;
}
.bms-detail__desc::after {
    content:''; position:absolute; bottom:0; left:0; right:0; height:1.8em;
    background:linear-gradient(transparent,var(--bms-white)); pointer-events:none;
}
.bms-detail__desc.is-expanded { max-height:800px; }
.bms-detail__desc.is-expanded::after { display:none; }
.bms-detail__desc-toggle {
    background:none; border:none; cursor:pointer;
    color:var(--bms-link); font-size:13px; padding:3px 0; font-weight:600;
}
.bms-detail__desc-toggle:hover { text-decoration:underline; }

/* Metadata table */
.bms-detail__table { width:100%; border-collapse:collapse; font-size:13.5px; margin:4px 0 16px; }
.bms-detail__table tr { border-bottom:1px solid #f4f4f4; }
.bms-detail__table tr:last-child { border-bottom:none; }
.bms-detail__table th {
    padding:7px 14px 7px 0; font-weight:600; color:var(--bms-text);
    white-space:nowrap; vertical-align:top; width:110px;
}
.bms-detail__table td { padding:7px 0; color:var(--bms-text-light); vertical-align:top; }
.bms-detail__link, .bms-cat-link {
    color:var(--bms-link); text-decoration:none; margin-right:6px;
}
.bms-detail__link:hover, .bms-cat-link:hover { text-decoration:underline; }

.bms-detail__actions { margin-top:12px; display:flex; gap:10px; flex-wrap:wrap; }

/* ── BUTTONS ───────────────────────────────────────────── */
.bms-btn {
    display:inline-flex; align-items:center; gap:6px;
    padding:9px 20px; border-radius:5px;
    font-size:13px; font-weight:600;
    text-decoration:none; cursor:pointer; border:none;
    transition:background var(--bms-tr), transform var(--bms-tr); white-space:nowrap;
}
.bms-btn--primary { background:var(--bms-primary); color:#fff; }
.bms-btn--primary:hover { background:var(--bms-primary-dark); color:#fff; transform:translateY(-1px); }
.bms-btn--outline { background:transparent; color:var(--bms-text); border:1.5px solid var(--bms-border); }
.bms-btn--outline:hover { border-color:var(--bms-primary); color:var(--bms-primary); }
.bms-btn--full { width:100%; justify-content:center; }

/* ── OFFERS SECTION ────────────────────────────────────── */
.bms-offers__heading {
    font-size:19px!important; font-weight:700!important;
    color:var(--bms-text)!important; margin:0 0 18px!important;
    display:flex; align-items:center; gap:10px;
}
.bms-offers__count {
    background:var(--bms-primary); color:#fff;
    font-size:12px; font-weight:600; border-radius:20px; padding:2px 9px;
}
.bms-offers__empty {
    background:var(--bms-white); border:1px solid var(--bms-border);
    border-radius:var(--bms-radius); padding:24px;
    color:var(--bms-text-light); font-size:14px;
}
.bms-offers__list { display:flex; flex-direction:column; gap:16px; }

/* ── OFFER CARD ────────────────────────────────────────── */
.bms-offer {
    display:flex; gap:18px; align-items:flex-start;
    background:var(--bms-white); border:1px solid var(--bms-border);
    border-radius:var(--bms-radius); padding:18px 20px;
    box-shadow:var(--bms-shadow);
    transition:box-shadow var(--bms-tr), transform var(--bms-tr);
    animation:bmsCardIn .22s ease both;
}
.bms-offer:hover { box-shadow:0 6px 24px rgba(0,0,0,.11); transform:translateY(-2px); }
.bms-offer--oos { opacity:.7; }
.bms-offers__list .bms-offer:nth-child(1) { animation-delay:.04s }
.bms-offers__list .bms-offer:nth-child(2) { animation-delay:.08s }
.bms-offers__list .bms-offer:nth-child(3) { animation-delay:.12s }
.bms-offers__list .bms-offer:nth-child(n+4) { animation-delay:.16s }

.bms-offer__thumb { flex-shrink:0; width:70px; }
.bms-offer__thumb img {
    width:70px; height:100px; object-fit:cover;
    border-radius:4px; display:block;
    box-shadow:1px 3px 10px rgba(0,0,0,.12);
}
.bms-offer__thumb-ph {
    width:70px; height:100px; background:#f0ede8; border-radius:4px;
    display:flex; align-items:center; justify-content:center; font-size:28px; color:#ccc;
}

.bms-offer__info { flex:1; min-width:0; }
.bms-offer__seller-row { display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.bms-offer__avatar {
    width:36px; height:36px; border-radius:50%; object-fit:cover;
    border:2px solid var(--bms-border); flex-shrink:0;
}
.bms-offer__seller-name { font-size:14px; font-weight:700; color:var(--bms-text); text-decoration:none; }
.bms-offer__seller-name:hover { color:var(--bms-primary); }
.bms-offer__badge {
    display:inline-block; background:#27ae60; color:#fff;
    font-size:10px; font-weight:700; border-radius:3px; padding:1px 4px; margin-left:4px;
}
.bms-offer__stars { display:flex; align-items:center; gap:1px; font-size:13px; margin-top:1px; }
.bms-offer__stars .star      { color:#ddd; }
.bms-offer__stars .star--on  { color:#f39c12; }
.bms-offer__stars small { color:var(--bms-text-light); font-size:11px; margin-left:4px; }

.bms-offer__perk {
    display:flex; align-items:center; gap:5px;
    font-size:12px; color:#27ae60; margin-bottom:4px;
}
.bms-offer__condition { font-size:12.5px; color:var(--bms-text-light); margin-bottom:4px; }
.bms-offer__short-desc { font-size:12.5px; color:var(--bms-text-light); line-height:1.5; margin-top:4px; }

.bms-offer__price-col {
    flex-shrink:0; text-align:right;
    display:flex; flex-direction:column; align-items:flex-end; gap:10px; min-width:110px;
}
.bms-offer__price-amount,
.bms-offer__price-sale { display:block; font-size:20px; font-weight:700; color:var(--bms-primary); }
.bms-offer__price-was  { display:block; font-size:13px; color:#aaa; text-decoration:line-through; }
.bms-offer__price-na   { font-size:14px; color:var(--bms-text-light); }
.bms-offer__oos-label  { font-size:12px; color:#aaa; border:1px solid #ddd; border-radius:4px; padding:5px 10px; }
.bms-offer__cta { margin-top:4px; }

/* ── WOODMART COMPAT ───────────────────────────────────── */
.wd-header .bms-search-wrap,
.woodmart-header .bms-search-wrap { margin:0 10px; max-width:380px; }
.bms-search-input-wrap input[type="search"].bms-search-input { margin:0!important; box-shadow:none!important; }

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width:700px) {
    .bms-detail__inner { flex-direction:column; gap:20px; }
    .bms-detail__cover-col { width:100%; display:flex; justify-content:center; }
    .bms-detail__cover { width:100%; }
    .bms-detail__title { font-size:18px!important; }
    .bms-detail { padding:18px 16px; }
    .bms-offer__thumb { width: 100%;}
    .bms-offer__thumb img { width: 100%;  height: auto;}

    .bms-listing-card { flex-direction:column; gap:14px; }
    .bms-listing-card__cover-wrap { width:100%; display:flex; justify-content:center; }
    .bms-listing-card__cover { width:100%; height:130px; }

    .bms-offer { flex-wrap:wrap; }
    .bms-offer__price-col {
        flex-direction:row; align-items:center; width:100%; min-width:unset; justify-content:space-between;
    }
    .bms-page__search-header { padding:16px; }
    .bms-page__body { padding:16px 14px 40px; }
}


/* ══════════════════════════════════════════════════════════
   LOAD MORE  — appended to bookmarket-search.css
══════════════════════════════════════════════════════════ */

/* Wrapper centres the button */
.bms-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 32px;
}

/* The button */
.bms-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 200px;
    padding: 13px 36px;
    background: var(--bms-white);
    color: var(--bms-primary);
    border: 2px solid var(--bms-primary);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .02em;
    transition: background var(--bms-tr), color var(--bms-tr), box-shadow var(--bms-tr), transform var(--bms-tr);
    box-shadow: 0 2px 10px rgba(192,57,43,.10);
    position: relative;
    overflow: hidden;
}

.bms-load-more-btn:hover:not(:disabled) {
    background: var(--bms-primary);
    color: #fff;
    box-shadow: 0 4px 18px rgba(192,57,43,.25);
    transform: translateY(-1px);
}

.bms-load-more-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(192,57,43,.15);
}

.bms-load-more-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

/* Spinner inside button */
.bms-load-more-btn__spinner {
    width: 17px;
    height: 17px;
    border: 2.5px solid rgba(192,57,43,.25);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: bmsSpin .55s linear infinite;
    flex-shrink: 0;
}

/* "No more results" end state */
.bms-load-more-end {
    text-align: center;
    margin-top: 32px;
    padding: 12px 20px;
    font-size: 13px;
    color: var(--bms-text-light);
    border-top: 1px solid var(--bms-border);
}

/* Error state */
.bms-load-more-error {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--bms-primary);
    font-weight: 500;
}
.bms-load-more-error button {
    background: none;
    border: none;
    color: var(--bms-primary);
    cursor: pointer;
    font-weight: 700;
    text-decoration: underline;
    font-size: 13px;
    padding: 0; margin-left: 4px;
}

/* Newly loaded cards fade-slide in */
.bms-listing-card.is-new {
    animation: bmsCardIn .28s ease both;
}
