/* =============================================================================
   Buddypress Bookmarks — Stylesheet  v1.2.0
   Author: Americary LLC — https://americary.com
   ============================================================================= */


/* ── 1. BOOKMARK BUTTON — bottom of single post content ──────────────────── */

.bpbk-btn-wrapper {
    margin-top: -20px;
    padding-top: 22px;
    border-top: 0px solid #e8e8e8;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.bpbk-bookmark-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 2px solid #d0d0d0;
    border-radius: 50px;
    padding: 10px 22px 10px 18px;
    cursor: pointer;
    font-size: 15px;
    font-family: inherit;
    color: #888;
    line-height: 1;
    transition: border-color .25s ease, color .25s ease,
                box-shadow .25s ease, background .25s ease;
    outline: none;
    user-select: none;
}

.bpbk-bookmark-btn:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.bpbk-bookmark-btn:focus-visible {
    outline: 3px solid rgba(231, 76, 60, .45);
    outline-offset: 3px;
}

/* Icons — outline shown by default, filled hidden */
.bpbk-icon-outline { display: inline-block; font-size: 1.1em; color: #e4b096 !important; }
.bpbk-icon-filled  { display: none !important; color: #e4b096 !important; font-size: 1.1em; }

/* Active / bookmarked state */
.bpbk-bookmark-btn.bpbk-active {
    border-color: #e74c3c;
    color: #a94203;
    background: #eae3d98a;
}

.bpbk-bookmark-btn.bpbk-active:hover {
    background: #e8dcd6ba;
}

.bpbk-bookmark-btn.bpbk-active .bpbk-icon-outline { display: none !important; }
.bpbk-bookmark-btn.bpbk-active .bpbk-icon-filled  { display: inline-block !important; }

/* Loading / processing state */
.bpbk-bookmark-btn.bpbk-loading {
    opacity: .5;
    pointer-events: none;
    cursor: not-allowed;
}

/* Button text label */
.bpbk-btn-label {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .01em;
    line-height: 1.2;
    margin: 0 auto;
}


/* ── 2. CONFIRMATION POPUP ────────────────────────────────────────────────── */

/* Full-screen overlay — semi-transparent white */
.bpbk-overlay {
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
}

.bpbk-overlay.bpbk-overlay--visible {
    opacity: 1;
    pointer-events: auto;
}

/* Popup box — white background */
.bpbk-popup {
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .16), 0 2px 8px rgba(0, 0, 0, .08);
    padding: 36px 40px 32px;
    max-width: 420px;
    width: calc(100% - 40px);
    text-align: center;
    transform: translateY(16px) scale(.97);
    transition: transform .22s ease, opacity .22s ease;
    opacity: 0;
}

.bpbk-overlay.bpbk-overlay--visible .bpbk-popup {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* Popup title */
.bpbk-popup-title {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.3;
}

/* Popup message */
.bpbk-popup-message {
    margin: 0 0 28px;
    font-size: 15px;
    color: #555;
    line-height: 1.6;
}

/* Buttons row */
.bpbk-popup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/*
 * Both buttons inherit the active theme's base button appearance.
 * GeneratePress / most WP themes style .button already.
 * We only add shape, size, and semantic color on top.
 */
.bpbk-btn-cancel,
.bpbk-btn-confirm {
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 26px;
    border: 2px solid transparent;
    min-width: 130px;
    text-align: center;
    line-height: 1.4;
    transition: background .2s, border-color .2s, opacity .2s;
}

/* Cancel — inherits theme secondary / ghost look */
.bpbk-btn-cancel {
    background: #fff;
    color: #444 !important;
    border-color: #ccc;
}

.bpbk-btn-cancel:hover {
    background: #f5f5f5;
    border-color: #aaa;
}

.bpbk-btn-cancel:focus-visible {
    outline: 3px solid rgba(0,0,0,.15);
    outline-offset: 2px;
}

/* Confirm — red background, black text for legibility */
.bpbk-btn-confirm {
    background: #e74c3c;
    color: #111 !important;
    border-color: #e74c3c;
}

.bpbk-btn-confirm:hover {
    background: #db9877b2;
    border-color: #c0392b;
}

.bpbk-btn-confirm:focus-visible {
    outline: 3px solid rgba(231, 76, 60, .4);
    outline-offset: 2px;
}

.bpbk-btn-confirm.bpbk-loading {
    opacity: .6;
    pointer-events: none;
}

/* Close × button (top-right) */
.bpbk-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 20px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 4px 6px;
    transition: color .15s;
}

.bpbk-popup-close:hover { color: #555; }


/* ── 3. TOAST NOTIFICATION ────────────────────────────────────────────────── */

.bpbk-toast {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 32px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    background: #2c3e50;
    box-shadow: 0 8px 32px rgba(0,0,0,.14);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .28s ease, transform .28s ease;
    pointer-events: none;
    max-width: 380px;
}

.bpbk-toast.bpbk-toast--show {
    opacity: 1;
    transform: translateY(0);
}

/* Saturated green + transparency — opacity tones it into a natural shade */
.bpbk-toast.bpbk-toast--success { background: rgba(39, 174, 96, 0.82); }
.bpbk-toast.bpbk-toast--error   { background: #e74c3c; }


/* ── 4. BUDDYPRESS NAV TAB — force Font Awesome heart icon via CSS ────────── */

/*
 * BuddyPress sanitizes nav item names and strips HTML tags, so injecting
 * <i class="fa-..."> in PHP is unreliable. We force the icon here instead
 * using ::before with explicit Font Awesome font declarations.
 */
.bp-navs li[id$="-bookmarks-personal-li"] > a::before,
.bp-navs li[id*="bookmarks"] > a::before,
#nav-bookmarks > a::before,
#bp-nav-li-bookmarks > a::before {
    font-family: "Font Awesome 6 Free" !important;
    font-weight: 400 !important;           /* 400 = fa-regular (outline heart) */
    font-style: normal !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    content: "\f02e" !important;           /* FA unicode for fa-bookmark */
    display: inline-block !important;
    margin-right: 5px !important;
    vertical-align: middle;
    font-size: .95em;
}

/* Prevent double-icon if theme also injects one */
.bp-navs li[id*="bookmarks"] > a i { display: none !important; }


/* ── 5. BOOKMARKS PAGE — card grid ───────────────────────────────────────── */

.bpbk-bookmarks-wrap {
    padding: 4px 0 20px;
    margin-top: -40px;
}

/* ── Privacy toggle bar ───────────────────────────────────────────────────── */

.bpbk-privacy-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 0 22px;
    margin-top: -10px;
    margin-bottom: 10px;
}

/* Outer oval track */
.bpbk-privacy-switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
    flex-shrink: 0;
    cursor: pointer;
}

/* Hide native checkbox */
.bpbk-privacy-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

/* Oval track background */
.bpbk-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 28px;
    transition: background .28s ease;
}

/* Sliding circle (thumb) */
.bpbk-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 4px;
    top: 4px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,.22);
    transition: transform .28s ease;
}

/* Checked = Public — track turns green, thumb slides right */
.bpbk-privacy-switch input:checked + .bpbk-slider {
    background: rgba(124, 154, 87, 0.64);
}

.bpbk-privacy-switch input:checked + .bpbk-slider::before {
    transform: translateX(26px);
}

/* Keyboard focus ring */
.bpbk-privacy-switch input:focus-visible + .bpbk-slider {
    outline: 3px solid rgba(39, 174, 96, .45);
    outline-offset: 2px;
}

/* Privacy label text */
.bpbk-privacy-label {
    font-size: 14px;
    color: #666;
    user-select: none;
    line-height: 1.4;
}

.bpbk-privacy-label strong {
    color: #333;
    font-weight: 700;
}

.bpbk-empty,
.bpbk-notice {
    color: #888;
    font-size: 15px;
    font-style: italic;
    padding: 16px 0 8px;
}

.bpbk-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

/* No separator between cards — clean flush list */
.bpbk-card + .bpbk-card {
    padding-top: 18px;
    margin-top: 14px;
}

/* Card */
.bpbk-card {
    display: flex;
    gap: 18px;
    padding: 0;
    background: #fff;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transition: none;
    align-items: flex-start;
    margin-bottom: 10px;
}

/* Thumbnail link */
.bpbk-thumb-link {
    flex-shrink: 0;
    display: block;
    width: 130px;
    height: 95px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f3f3;
    text-decoration: none;
}

img.bpbk-thumb {
    width: 130px;
    height: 95px;
    object-fit: cover;
    display: block;
    border-radius: 8px;
}

.bpbk-no-thumb {
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 36px;
}

/* Card body */
.bpbk-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: -20px;
}

.bpbk-card-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    color: #a40000 !important;
}

.bpbk-card-title a {
    color: #a40000 !important;
    text-decoration: none;
    transition: color .2s;
}

.bpbk-card-title a:hover { color: #d5a04e !important; }

.bpbk-card-excerpt {
    margin: -15px 0 0 0;
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bpbk-card-meta {
    margin: 0 0 -15px 0;
    font-size: 15px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.bpbk-meta-sep { color: #ccc; }

.bpbk-card-meta a {
    color: #555;
    text-decoration: none;
    font-weight: 600;
    transition: color .2s;
}

.bpbk-card-meta a:hover { color: #e74c3c; }

/*
 * "Remove Bookmark" — styled as an inline text link, not a button.
 * Appears below the author/date meta line.
 */
.bpbk-remove-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    align-self: flex-start;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #aaa;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: transparent;
    transition: color .2s ease, text-decoration-color .2s ease;
}

button.bpbk-remove-link {
    background: #fff !important;
    color: #57653c;
    padding: 0 !important;
    font-size: 16px !important;
}

.bpbk-remove-link:hover {
    color: #e74c3c;
    text-decoration-color: #e74c3c;
}

.bpbk-remove-link:focus-visible {
    outline: 2px solid rgba(231, 76, 60, .4);
    outline-offset: 3px;
    border-radius: 3px;
}

.bpbk-remove-link i {
    font-size: .9em;
    flex-shrink: 0;
}

/* Dimming the card while the AJAX+reload is in progress */
.bpbk-card.bpbk-removing {
    opacity: .4;
    pointer-events: none;
    transition: opacity .25s ease;
}


/* ── 6. RESPONSIVE ────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
    .bpbk-card {
        flex-direction: column;
    }

    .bpbk-thumb-link,
    img.bpbk-thumb {
        width: 100%;
        height: 180px;
    }

    .bpbk-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }
    .bpbk-popup {
        padding: 28px 22px 24px;
    }

    .bpbk-popup-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
