/* ============================================================
 * BookBildr Plugin — My Books Gallery Styles
 * ============================================================ */

/* ─── Theme overrides ─────────────────────────────────────── */
.ast-separate-container .ast-article-post,
.ast-separate-container .ast-article-single {
    padding: 0;
}

.ast-separate-container .ast-article-single:not(.ast-related-post) {
    background: none !important;
}

.entry-header {
    display: none;
}

/* ─── Layout ──────────────────────────────────────────────── */
.bb-mybooks {
    max-width: 1200px;
}

/* ─── Header ──────────────────────────────────────────────── */
.bb-mybooks-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.bb-mybooks-intro h4 {
    font-size: 1.5em;
    font-weight: 400;
    margin: 0 0 4px;
    color: #1d2327;
}

.bb-mybooks-note {
    margin: 0;
    font-size: 13px;
    color: #8c8f94;
}

.bb-mybooks-toolbar {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* ─── Button group (split button) ─────────────────────────── */
.bb-btn-group {
    display: inline-flex;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
}

.bb-btn-group > .bb-btn:first-child {
    border-radius: 8px 0 0 8px;
}

.bb-btn-group > .bb-btn:last-child,
.bb-btn-group > .bb-dd > .bb-dd-trigger {
    border-radius: 0 8px 8px 0;
    border-left: 1px solid rgba(255,255,255,.2);
}

.bb-btn-group > .bb-dd {
    display: flex;
    align-self: stretch;
}

.bb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: background .15s ease, opacity .15s ease;
}

.bb-btn-primary {
    background: var(--bb-brand);
    color: #fff;
}

.bb-btn-primary:hover {
    color: #fff;
    opacity: .85;
}

.bb-dd-trigger {
    width: 40px;
    padding: 0;
    font-size: 12px;
    letter-spacing: 0;
}

/* ─── Dropdown menu ───────────────────────────────────────── */
.bb-dd {
    position: relative;
}

.bb-dd-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,.12);
    min-width: 290px;
    z-index: 200;
    padding: 6px;
}

.bb-dd.is-open .bb-dd-menu {
    display: block;
}

.bb-dd-header {
    padding: 8px 12px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #8c8f94;
}

.bb-dd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 6px;
    text-decoration: none;
    color: #1d2327;
    transition: background .1s ease;
}

.bb-dd-item:hover {
    background: #f0f6fc;
}

.bb-dd-item:active {
    background: #e2edf7;
}

.bb-dd-item-thumb {
    width: 42px;
    height: 54px;
    border-radius: 3px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.bb-dd-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bb-dd-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bb-dd-item-name {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
}

.bb-dd-item-dim {
    font-size: 11px;
    color: #8c8f94;
}

/* ─── Section title ───────────────────────────────────────── */
.bb-mybooks-title {
    font-size: 1.75em;
    font-weight: 300;
    margin-bottom: 24px;
    color: #1d2327;
}

/* ─── Book grid ───────────────────────────────────────────── */
.bb-mybooks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.bb-mybooks-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    transition: box-shadow .2s ease, transform .2s ease;
    display: flex;
    flex-direction: column;
}

.bb-mybooks-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
    transform: translateY(-3px);
}

.bb-mybooks-card-cover {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    text-align: center;
    padding: 16px 16px 0;
    min-height: 180px;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
}

.bb-mybooks-card-cover img {
    width: 100%;
    max-width: 180px;
    height: auto;
    border: 1px solid #f0f0f1;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    display: block;
    margin: 0 auto;
    position: relative;
}

.bb-mybooks-pages {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,.65);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    line-height: 1.5;
}

.bb-mybooks-badge {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 2px 10px;
    border-radius: 10px;
    line-height: 1.5;
    white-space: nowrap;
}

.bb-mybooks-badge.submitted {
    background: #fcf9e8;
    color: #996800;
}

.bb-mybooks-badge.printed {
    background: #edfaef;
    color: #1a7d36;
}

.bb-mybooks-card-body {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.bb-mybooks-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 10px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bb-mybooks-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: auto;
}

.bb-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 5px 10px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    background: #f6f7f7;
    color: #50575e;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
    white-space: nowrap;
}

.bb-action-btn:hover {
    background: #f0f0f1;
    border-color: #8c8f94;
    color: #1d2327;
}

.bb-action-btn svg {
    flex-shrink: 0;
}

.bb-action-order {
    border-color: var(--bb-brand);
    color: var(--bb-brand);
    background: #fff;
}

.bb-action-order:hover {
    background: var(--bb-brand);
    border-color: var(--bb-brand);
    color: #fff;
}

/* ─── Card 3-dot dropdown ─────────────────────────────────── */
.bb-card-dd {
    position: relative;
    margin-left: auto;
}

.bb-card-dd-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    background: #fff;
    color: #8c8f94;
    font-size: 12px;
    letter-spacing: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s ease, border-color .12s ease;
    font-family: inherit;
    line-height: 1;
    padding: 0;
}

.bb-card-dd-btn:hover {
    background: #f0f0f1;
    border-color: #8c8f94;
    color: #50575e;
}

.bb-card-dd-menu {
    display: none;
    position: absolute;
    right: 0;
    bottom: 100%;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.1);
    min-width: 140px;
    z-index: 999;
    padding: 4px;
}

.bb-card-dd.is-open .bb-card-dd-menu {
    display: block;
}

.bb-card-dd-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #50575e;
    text-decoration: none;
    transition: background .1s ease;
    white-space: nowrap;
}

.bb-card-dd-item:hover {
    background: #f0f0f1;
}

.bb-card-dd-danger:hover {
    color: #b32d2e;
    background: #fcf0f0;
}

.bb-card-dd-item svg {
    flex-shrink: 0;
}

/* ─── Empty state ─────────────────────────────────────────── */
.bb-mybooks-empty {
    text-align: center;
    padding: 80px 20px;
}

.bb-mybooks-empty-icon {
    margin-bottom: 16px;
}

.bb-mybooks-empty h2 {
    font-size: 1.5em;
    font-weight: 300;
    color: #646970;
    margin: 0;
}

/* ─── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .bb-mybooks-header {
        flex-direction: column;
        align-items: stretch;
    }
    .bb-mybooks-toolbar {
        justify-content: flex-end;
    }
    .bb-mybooks-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .bb-mybooks-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .bb-mybooks-card-cover {
        padding: 16px 16px 0;
    }
    .bb-mybooks-card-cover img {
        max-width: 160px;
    }
}
