/* SHIHSK Book Library - Frontend */

.sbl-home, .sbl-archive, .sbl-single {
    color: #222; font-size: 15px; line-height: 1.5;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px;
    box-sizing: border-box;
}
@media (max-width: 700px) {
    .sbl-home, .sbl-archive, .sbl-single { padding: 16px 12px; }
}

/* Search bar */
.sbl-search-form {
    display: flex;
    align-items: stretch;
    border: 2px solid #3CAA3C;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f5f5;
    margin: 0 auto 24px;
    max-width: 720px;
    height: 48px;
    box-sizing: border-box;
    box-shadow: none;
}
.sbl-search-form input.sbl-search-input,
.sbl-search-form input[type="search"].sbl-search-input {
    flex: 1;
    border: 0 !important;
    outline: none !important;
    background: transparent !important;
    padding: 0 16px !important;
    margin: 0 !important;
    font-size: 15px;
    color: #333;
    min-width: 0;
    height: 100%;
    line-height: 1;
    box-shadow: none !important;
    border-radius: 0 !important;
    -webkit-appearance: none;
            appearance: none;
}
.sbl-search-input::placeholder { color: #999; }
.sbl-search-form button.sbl-search-btn,
.sbl-search-form .sbl-search-btn {
    background: #3CAA3C !important;
    color: #fff !important;
    border: 0 !important;
    padding: 0 22px !important;
    margin: 0 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    border-radius: 0 !important;
    box-shadow: none !important;
    line-height: 1;
    min-width: 56px;
    text-transform: none;
    font-weight: 400;
}
.sbl-search-form button.sbl-search-btn:hover { background: #2d8b2d !important; }
.sbl-search-empty { color: #888; padding: 20px 0; }

/* Breadcrumb */
.sbl-breadcrumb { margin: 0 0 16px; font-size: 13px; color: #777; }
.sbl-breadcrumb ol {
    list-style: none; padding: 0; margin: 0;
    display: flex; flex-wrap: wrap; gap: 6px;
}
.sbl-breadcrumb li { display: inline-flex; align-items: center; gap: 6px; }
.sbl-breadcrumb a { color: #2980b9; text-decoration: none; }
.sbl-breadcrumb a:hover { color: #c0392b; text-decoration: underline; }
.sbl-breadcrumb [aria-current="page"] { color: #555; font-weight: 500; }
.sbl-bc-sep { color: #bbb; }

/* Layout grid: sidebar | main | leaderboard */
.sbl-home-grid {
    display: grid;
    grid-template-columns: 220px 1fr 240px;
    gap: 24px;
    align-items: start;
}
@media (max-width: 1100px) {
    .sbl-home-grid { grid-template-columns: 200px 1fr; }
    .sbl-leaderboard-side { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
    .sbl-home-grid { grid-template-columns: 1fr; }
    .sbl-sidebar { order: 2; }
}

/* Sidebar - categories */
.sbl-categories { background: #fff; border: 1px solid #eaeaea; border-radius: 4px; padding: 4px 0; position: relative; }
.sbl-cat-list { list-style: none; padding: 0; margin: 0; }
.sbl-cat-list > li { border-bottom: 1px solid #f0f0f0; position: relative; }
.sbl-cat-list > li:last-child { border-bottom: none; }
.sbl-cat-list a {
    display: flex; align-items: center; padding: 10px 14px;
    color: #333; text-decoration: none; gap: 8px;
}
.sbl-cat-list a:hover { background: #fafafa; color: #c00; }
.sbl-cat-name { flex: 1; }
.sbl-cat-count {
    background: #f1f1f1; border-radius: 10px; padding: 2px 8px;
    font-size: 12px; color: #666;
}
.sbl-cat-arrow { color: #999; }
.sbl-cat-list > li.has-children:hover > a { background: #f0f7ff; color: #2980b9; }
.sbl-cat-list > li.has-children:hover .sbl-cat-arrow { color: #2980b9; }

/* Flyout submenu */
.sbl-cat-submenu {
    position: absolute;
    left: 100%;
    top: -4px;
    min-width: 260px;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 6px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    padding: 4px 0;
    visibility: hidden;
    opacity: 0;
    transform: translateX(-8px);
    transition: opacity .15s, transform .15s, visibility .15s;
    z-index: 100;
    margin-left: 4px;
}
.sbl-cat-list > li.has-children:hover .sbl-cat-submenu {
    visibility: visible;
    opacity: 1;
    transform: translateX(0);
}
.sbl-cat-submenu ul { list-style: none; padding: 0; margin: 0; }
.sbl-cat-submenu li { border-bottom: 1px solid #f5f5f5; }
.sbl-cat-submenu li:last-child { border-bottom: none; }
.sbl-cat-submenu .sbl-cat-viewall { background: #fafafa; }
.sbl-cat-submenu .sbl-cat-viewall a { color: #2980b9; font-weight: 500; }
@media (max-width: 900px) {
    .sbl-cat-submenu { display: none; }
    .sbl-cat-list > li.has-children .sbl-cat-arrow { display: none; }
}

/* Section titles */
.sbl-section { margin-bottom: 32px; }
.sbl-section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; margin: 0 0 14px;
}
.sbl-section-title {
    color: #c0392b; font-size: 22px; font-weight: 600;
    margin: 0; padding-bottom: 4px;
}
.sbl-section-more {
    color: #2980b9; font-size: 13px; font-weight: 500;
    text-decoration: none; white-space: nowrap;
    flex-shrink: 0;
}
.sbl-section-more:hover { color: #c0392b; text-decoration: underline; }

/* Books grid */
.sbl-books-grid { display: grid; gap: 16px; }
.sbl-cols-2 { grid-template-columns: repeat(2, 1fr); }
.sbl-cols-3 { grid-template-columns: repeat(3, 1fr); }
.sbl-cols-4 { grid-template-columns: repeat(4, 1fr); }
.sbl-cols-5 { grid-template-columns: repeat(5, 1fr); }
.sbl-cols-6 { grid-template-columns: repeat(6, 1fr); }
.sbl-cols-7 { grid-template-columns: repeat(7, 1fr); }
.sbl-cols-8 { grid-template-columns: repeat(8, 1fr); }
@media (max-width: 1100px) {
    .sbl-cols-7, .sbl-cols-8 { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 900px) {
    .sbl-cols-5, .sbl-cols-6, .sbl-cols-7, .sbl-cols-8 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 700px) {
    .sbl-books-grid { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 480px) {
    .sbl-books-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* Book card */
.sbl-card { display: flex; flex-direction: column; }
.sbl-card-cover {
    display: block; aspect-ratio: 2/3; background: #f5f5f5;
    overflow: hidden; border-radius: 2px;
}
.sbl-card-cover img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .2s;
}
.sbl-card:hover .sbl-card-cover img { transform: scale(1.04); }
.sbl-card-body { padding: 8px 0 0; }
.sbl-card-title {
    display: block; color: #2980b9; font-weight: 500;
    font-size: 14px; line-height: 1.3; margin-bottom: 4px;
    text-decoration: none;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.sbl-card-title:hover { color: #c0392b; text-decoration: underline; }
.sbl-card-author { color: #666; font-size: 12px; margin-bottom: 4px; }
.sbl-card-price { color: #27ae60; font-weight: 600; font-size: 13px; }
.sbl-card-rating { display: flex; align-items: center; gap: 6px; margin-top: 4px; }

/* Stars */
.sbl-stars { display: inline-flex; gap: 1px; }
.sbl-star { font-size: 13px; line-height: 1; color: #ddd; }
.sbl-star-full, .sbl-star-half { color: #f39c12; }
.sbl-star-half { position: relative; }
.sbl-rating-count { font-size: 12px; color: #888; }

/* Leaderboard */
.sbl-leaderboard {
    background: #fff; border: 1px solid #eaeaea; border-radius: 6px;
    padding: 14px;
}
.sbl-leaderboard-title {
    margin: 0 0 12px; font-size: 15px; font-weight: 600;
    text-align: center; color: #333;
}
.sbl-leaderboard-list { list-style: none; padding: 0; margin: 0; counter-reset: lb; }
.sbl-leaderboard-list li {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0; border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
    counter-increment: lb;
}
.sbl-leaderboard-list li:last-child { border-bottom: none; }
.sbl-leaderboard-list li::before {
    content: counter(lb); width: 18px; color: #999; font-size: 12px;
}
.sbl-lb-avatar { width: 24px; height: 24px; border-radius: 50%; }
.sbl-lb-name { flex: 1; color: #333; }
.sbl-lb-points {
    background: #f1f1f1; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; color: #666;
}

/* Single book */
.sbl-single-layout {
    display: grid; grid-template-columns: 1fr 280px; gap: 32px;
    align-items: start;
}
@media (max-width: 900px) {
    .sbl-single-layout { grid-template-columns: 1fr; }
}
.sbl-single-grid {
    display: grid; grid-template-columns: 240px 1fr; gap: 32px;
    margin-bottom: 32px;
}
@media (max-width: 700px) {
    .sbl-single-grid { grid-template-columns: 1fr; }
}

/* Right sidebar - mini lists */
.sbl-single-sidebar { display: flex; flex-direction: column; gap: 20px; }
.sbl-mini-list {
    background: #fff; border: 1px solid #eaeaea; border-radius: 6px;
    padding: 14px;
}
.sbl-mini-title {
    margin: 0 0 12px; font-size: 15px; font-weight: 600;
    color: #c0392b; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0;
}
.sbl-mini-items { list-style: none; padding: 0; margin: 0; }
.sbl-mini-item {
    display: flex; gap: 10px; padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
}
.sbl-mini-item:last-child { border-bottom: none; }
.sbl-mini-thumb {
    flex: 0 0 50px; aspect-ratio: 2/3;
    background: #f5f5f5; overflow: hidden; border-radius: 2px;
    display: block;
}
.sbl-mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sbl-mini-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sbl-mini-name {
    color: #2980b9; font-size: 13px; font-weight: 500; line-height: 1.3;
    text-decoration: none;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.sbl-mini-name:hover { color: #c0392b; }
.sbl-mini-author { color: #888; font-size: 11px; }
.sbl-mini-rating { display: flex; align-items: center; gap: 4px; }
.sbl-mini-rating .sbl-star { font-size: 11px; }
.sbl-mini-stats { display: flex; align-items: center; gap: 8px; color: #888; font-size: 11px; }
.sbl-mini-stat { display: inline-flex; align-items: center; gap: 3px; }
.sbl-mini-stat svg { flex-shrink: 0; }
.sbl-cover { width: 100%; height: auto; box-shadow: 0 2px 12px rgba(0,0,0,.1); border-radius: 2px; }
.sbl-title { color: #c0392b; font-size: 28px; font-weight: 600; margin: 0 0 16px; }

.sbl-meta-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.sbl-meta-table th {
    text-align: left; font-weight: 600; color: #555; padding: 4px 12px 4px 0;
    width: 110px; vertical-align: top;
}
.sbl-meta-table td { padding: 4px 0; color: #333; }
.sbl-meta-table a { color: #2980b9; text-decoration: none; margin-right: 6px; }
.sbl-meta-table a:hover { text-decoration: underline; }
.sbl-tag { background: #f1f1f1; padding: 2px 8px; border-radius: 12px; font-size: 12px; }

.sbl-info-stats { list-style: none; padding: 0; margin: 0 0 16px; display: flex; gap: 16px; flex-wrap: wrap; color: #777; font-size: 13px; }

.sbl-rating-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.sbl-btn-preview {
    display: inline-flex; align-items: center; gap: 6px;
    background: #f1f8ff; color: #1e6fc4 !important;
    border: 1px solid #c5dcf5 !important;
    padding: 6px 14px !important; border-radius: 999px !important;
    font-size: 13px; font-weight: 600; cursor: pointer;
    text-decoration: none; line-height: 1;
    transition: background .15s, border-color .15s;
    box-shadow: none !important; margin: 0 !important;
}
.sbl-btn-preview:hover { background: #e3f0ff; border-color: #1e6fc4 !important; }
.sbl-btn-preview svg { flex-shrink: 0; }

/* Preview modal */
.sbl-preview-content {
    max-width: 900px; width: 100%;
    height: calc(100vh - 60px); max-height: 90vh;
    padding: 20px 20px 12px;
}
.sbl-preview-frame-wrap {
    flex: 1; min-height: 300px;
    background: #1e1e1e; border-radius: 8px; overflow: hidden;
}
.sbl-preview-iframe {
    width: 100%; height: 100%; border: 0; display: block;
}
.sbl-preview-note {
    color: #888; font-size: 12px; margin: 0; text-align: center;
}
.sbl-rating-summary .sbl-star { font-size: 18px; }

.sbl-description { margin: 16px 0; color: #444; }
.sbl-description p { margin: 0 0 12px; }

/* Modern action buttons (download + FB group) */
.sbl-actions {
    display: flex; flex-wrap: wrap; gap: 10px;
    margin: 14px 0 18px;
}
.sbl-actions-empty { color: #888; font-style: italic; }

.sbl-btn {
    display: inline-flex; align-items: center; gap: 10px;
    text-decoration: none !important;
    padding: 10px 16px; border-radius: 10px;
    font-weight: 600; font-size: 13px; line-height: 1;
    transition: transform .12s ease, box-shadow .12s ease, background .15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid transparent;
    min-height: 44px; box-sizing: border-box;
}
.sbl-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
.sbl-btn:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.sbl-btn-icon {
    flex-shrink: 0; width: 22px; height: 22px;
    display: inline-flex; align-items: center; justify-content: center;
}
.sbl-btn-icon svg { width: 100%; height: 100%; }
.sbl-btn-label { display: flex; flex-direction: column; gap: 2px; line-height: 1.2; }
.sbl-btn-format { font-size: 14px; font-weight: 700; letter-spacing: 0.2px; }
.sbl-btn-sub { font-size: 11px; font-weight: 500; opacity: 0.85; letter-spacing: 0.2px; }

.sbl-btn-download {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #fff !important;
    border-color: #b03020;
}
.sbl-btn-download:hover { background: linear-gradient(135deg, #d44637 0%, #a93226 100%); color: #fff !important; }

.sbl-btn-fb {
    background: linear-gradient(135deg, #1877F2 0%, #1463cc 100%);
    color: #fff !important;
    border-color: #1059b5;
}
.sbl-btn-fb:hover { background: linear-gradient(135deg, #1565d8 0%, #0f4fa8 100%); color: #fff !important; }

.sbl-download-login-hint {
    margin: 0 0 16px; padding: 12px 16px;
    background: #fff8e1; border-left: 3px solid #f39c12;
    color: #555; font-size: 13px; border-radius: 6px;
}
.sbl-download-login-hint a { color: #c0392b; font-weight: 600; }

/* Rating block */
.sbl-rating-block {
    background: #fafafa; border: 1px solid #eaeaea;
    padding: 18px; border-radius: 6px; margin: 20px 0;
}
.sbl-rating-big {
    display: grid; grid-template-columns: 100px 1fr; gap: 20px;
    align-items: center; margin-bottom: 16px;
}
.sbl-rating-avg { text-align: center; }
.sbl-avg-num { display: block; font-size: 36px; font-weight: 600; color: #333; }
.sbl-avg-of { font-size: 12px; color: #888; }
.sbl-rating-bars { display: flex; flex-direction: column; gap: 4px; }
.sbl-rating-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.sbl-bar-stars { color: #f39c12; width: 70px; letter-spacing: -1px; font-size: 11px; }
.sbl-bar-track {
    flex: 1; height: 8px; background: #e6e6e6; border-radius: 4px;
    overflow: hidden;
}
.sbl-bar-fill { display: block; height: 100%; background: #3498db; border-radius: 4px; transition: width .3s; }
.sbl-bar-pct { width: 36px; text-align: right; color: #888; font-size: 11px; }
.sbl-rating-total { color: #999; font-size: 12px; margin-top: 4px; }

.sbl-tap-rate { display: flex; flex-direction: column; align-items: center; gap: 6px; padding-top: 12px; border-top: 1px solid #eee; }
.sbl-tap-label { color: #666; font-size: 13px; }
.sbl-rate-stars { display: inline-flex; gap: 4px; cursor: pointer; }
.sbl-rate-star { font-size: 28px; color: #ddd; transition: color .1s, transform .1s; }
.sbl-rate-star:hover, .sbl-rate-star.hover, .sbl-rate-star.active { color: #f39c12; }
.sbl-rate-star:active { transform: scale(1.2); }
.sbl-rate-help { color: #888; font-size: 12px; margin: 4px 0 0; }
.sbl-rate-msg { color: #27ae60; font-size: 13px; min-height: 16px; }
.sbl-rate-msg.error { color: #c0392b; }

.sbl-pagination { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 6px; }
.sbl-pagination .sbl-page,
.sbl-pagination .page-numbers {
    display: inline-block; padding: 6px 12px; border: 1px solid #ddd;
    border-radius: 4px; color: #333; text-decoration: none; font-size: 13px;
    background: #fff; transition: all .15s;
}
.sbl-pagination a.sbl-page:hover,
.sbl-pagination a.page-numbers:hover { background: #fafafa; border-color: #c0392b; color: #c0392b; }
.sbl-pagination .sbl-page-current,
.sbl-pagination .page-numbers.current {
    background: #c0392b; color: #fff !important; border-color: #c0392b;
}
.sbl-reviews-pagination { margin-top: 16px; }

/* Reviews list */
.sbl-reviews-list { margin: 16px 0; }
.sbl-reviews-empty { color: #888; padding: 12px 0; font-style: italic; }
.sbl-review {
    display: flex; gap: 12px; padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
}
.sbl-review:last-child { border-bottom: none; }
.sbl-review-avatar img { border-radius: 50%; }
.sbl-review-body { flex: 1; min-width: 0; }
.sbl-review-head {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px; font-size: 13px; margin-bottom: 4px;
}
.sbl-review-name { font-weight: 600; color: #333; }
.sbl-review-verified { color: #27ae60; font-size: 11px; }
.sbl-review-date { color: #888; font-size: 12px; }
.sbl-review-stars { margin: 2px 0 4px; }
.sbl-review-stars .sbl-star { font-size: 13px; }
.sbl-review-content { color: #444; font-size: 14px; line-height: 1.5; word-wrap: break-word; }

/* Modal */
body.sbl-modal-open { overflow: hidden; }
.sbl-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.sbl-modal[hidden] { display: none !important; }
.sbl-modal-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
    cursor: pointer;
}
.sbl-modal-content {
    position: relative; background: #fff; border-radius: 12px;
    padding: 28px 24px 22px; max-width: 440px; width: 100%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; gap: 12px;
    max-height: calc(100vh - 40px); overflow-y: auto;
}
.sbl-modal-content h3 { margin: 0 0 4px; text-align: center; font-size: 18px; }
.sbl-modal-close {
    position: absolute; top: 8px; right: 8px;
    width: 32px; height: 32px; border: none; background: #f0f0f0;
    border-radius: 50%; font-size: 20px; line-height: 1; cursor: pointer;
    color: #666;
}
.sbl-modal-close:hover { background: #e0e0e0; }
.sbl-modal-stars {
    display: flex; justify-content: center; gap: 4px; margin: 4px 0 8px;
}
.sbl-modal-star {
    font-size: 36px; cursor: pointer; color: #ddd;
    transition: color .1s, transform .1s;
}
.sbl-modal-star:hover, .sbl-modal-star.hover, .sbl-modal-star.active { color: #f39c12; }
.sbl-modal-star:active { transform: scale(1.15); }

.sbl-modal-name, .sbl-modal-email, .sbl-modal-comment {
    width: 100%; box-sizing: border-box;
    padding: 10px 14px; font-size: 14px; color: #333;
    background: #f7f7f7 !important; border: 1px solid #e5e5e5 !important;
    border-radius: 6px !important; margin: 0 !important;
    font-family: inherit;
}
.sbl-modal-comment { resize: vertical; min-height: 90px; }
.sbl-modal-name[readonly], .sbl-modal-email[readonly] { color: #555; cursor: default; }
.sbl-modal-counter { text-align: right; color: #888; font-size: 12px; margin-top: -6px; }

.sbl-modal-submit {
    align-self: center;
    background: #c0392b !important; color: #fff !important;
    border: none !important; padding: 10px 32px !important; border-radius: 6px !important;
    font-size: 15px; font-weight: 600; cursor: pointer;
    transition: background .15s;
    margin: 4px 0 0 !important;
}
.sbl-modal-submit:hover:not(:disabled) { background: #a93226 !important; }
.sbl-modal-submit:disabled { opacity: 0.6; cursor: wait; }
.sbl-modal-msg { text-align: center; min-height: 18px; color: #27ae60; font-size: 13px; }
.sbl-modal-msg.error { color: #c0392b; }

.sbl-archive-header { margin-bottom: 24px; }
.sbl-archive-title { font-size: 26px; font-weight: 600; color: #c0392b; margin: 0 0 8px; }

.sbl-my-points {
    display: inline-block; background: #f39c12; color: #fff;
    padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600;
}
