/* Bookmark Bubble Component - Using EXACT Player Profile Styles */
/* Standardized bookmark button design for the entire application */

:root {
    --bookmark-icon-outline-url: url('/static/icons/not_bookmarked.svg');
    --bookmark-icon-filled-url: url('/static/icons/bookmarked.svg');
    --share-icon-url: url('/static/icons/share.svg');
    --bookmark-offset: 1rem;
    --bookmark-control-gap: 0.5rem;
    --bookmark-hit-area: 2rem;
    --bookmark-icon-size: 1.4rem;
    --bookmark-icon-white-filter: brightness(0) saturate(100%) invert(100%);
}

/* Container for bookmark bubble */
.bookmark-bubble-container {
    position: relative;
    display: inline-block;
}

/* Main bookmark bubble button - EXACT PLAYER PROFILE STYLES */
.bookmark-bubble,
.bookmark-btn,
.fs-bookmark-button {
    position: absolute;
    top: var(--bookmark-offset);
    right: var(--bookmark-offset);
    background: transparent !important;
    backdrop-filter: none !important;
    width: var(--bookmark-hit-area);
    height: var(--bookmark-hit-area);
    border-radius: 0;
    border: none !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    outline: none;
}

/* For non-absolute positioned contexts */
.bookmark-bubble-container .bookmark-bubble,
.bookmark-bubble-container .bookmark-btn {
    position: relative;
    top: auto;
    right: auto;
}

.share-btn {
    position: absolute;
    top: var(--bookmark-offset);
    right: calc(var(--bookmark-offset) + var(--bookmark-hit-area) + var(--bookmark-control-gap));
    background: transparent !important;
    backdrop-filter: none !important;
    width: var(--bookmark-hit-area);
    height: var(--bookmark-hit-area);
    border: none !important;
    border-radius: 0;
    box-shadow: none !important;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.3s ease;
    z-index: 10;
    pointer-events: auto;
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-btn:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.share-btn:focus:not(:focus-visible) {
    outline: none;
}

.share-btn .share-icon {
    width: var(--bookmark-icon-size);
    height: var(--bookmark-icon-size);
    display: block;
    background-image: var(--share-icon-url);
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    filter: var(--bookmark-icon-white-filter);
}

.bookmark-bubble-container .share-btn {
    top: 0;
    right: calc(100% + var(--bookmark-control-gap));
}

.search-header-actions .share-btn {
    top: 14px;
    right: calc(14px + var(--bookmark-hit-area) + var(--bookmark-control-gap));
}

/* Hover state - EXACT PLAYER PROFILE STYLES */
.bookmark-bubble:hover,
.bookmark-btn:hover,
.fs-bookmark-button:hover {
    background: transparent !important;
    transform: scale(1.1);
    border-color: transparent !important;
}

/* Bookmark icon inside bubble - EXACT PLAYER PROFILE STYLES */
.bookmark-bubble .bookmark-icon,
.bookmark-bubble i,
.bookmark-btn i,
.fs-bookmark-button i {
    font-size: var(--bookmark-icon-size);
    color: #ffffff !important;
    transition: all 0.3s ease;
}

.bookmark-bubble i.fa-bookmark::before,
.bookmark-btn i.fa-bookmark::before,
.fs-bookmark-button i.fa-bookmark::before {
    content: '' !important;
}

.bookmark-bubble i.fa-bookmark,
.bookmark-btn i.fa-bookmark,
.fs-bookmark-button i.fa-bookmark {
    display: block;
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    filter: var(--bookmark-icon-white-filter);
}

.bookmark-bubble i.far.fa-bookmark,
.bookmark-btn i.far.fa-bookmark,
.fs-bookmark-button i.far.fa-bookmark {
    background-image: var(--bookmark-icon-outline-url);
}

.bookmark-bubble i.fas.fa-bookmark,
.bookmark-btn i.fas.fa-bookmark,
.fs-bookmark-button i.fas.fa-bookmark {
    background-image: var(--bookmark-icon-filled-url);
}

/* Bookmarked state - EXACT PLAYER PROFILE STYLES */
.bookmark-bubble.bookmarked,
.bookmark-btn.bookmarked,
.fs-bookmark-button.bookmarked {
    background: transparent !important;
    border-color: transparent !important;
    animation: bookmarkBounce 0.5s ease;
}

.bookmark-bubble.bookmarked .bookmark-icon,
.bookmark-bubble.bookmarked i,
.bookmark-btn.bookmarked i,
.fs-bookmark-button.bookmarked i {
    color: #ffffff !important;
}

.bookmark-bubble.bookmarked:hover,
.bookmark-btn.bookmarked:hover,
.fs-bookmark-button.bookmarked:hover {
    background: transparent !important;
    transform: scale(1.1) rotate(5deg);
}

/* Bookmark Animation - EXACT PLAYER PROFILE ANIMATION */
@keyframes bookmarkBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); }
    50% { transform: scale(0.9); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Unbookmark Animation - EXACT PLAYER PROFILE ANIMATION */
.bookmark-bubble.unbookmarking,
.bookmark-btn.unbookmarking,
.fs-bookmark-button.unbookmarking {
    animation: unbookmarkShake 0.5s ease;
}

@keyframes unbookmarkShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

/* Loading state */
.bookmark-bubble.loading,
.bookmark-btn.loading,
.fs-bookmark-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.bookmark-bubble.loading .bookmark-icon,
.bookmark-btn.loading i,
.fs-bookmark-button.loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Tooltip - Optional */
.bookmark-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

/* Tooltip arrow */
.bookmark-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Show tooltip on hover */
.bookmark-bubble:hover .bookmark-tooltip,
.bookmark-btn:hover .bookmark-tooltip,
.fs-bookmark-button:hover .bookmark-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-15px);
}

/* For contexts where bookmark needs different background (e.g., dark sections) */
.dark-context .bookmark-bubble,
.dark-context .bookmark-btn,
.dark-context .fs-bookmark-button {
    background: transparent !important;
    border-color: transparent !important;
}

.dark-context .bookmark-bubble .bookmark-icon,
.dark-context .bookmark-bubble i,
.dark-context .bookmark-btn i,
.dark-context .fs-bookmark-button i {
    color: #ffffff !important;
}

.dark-context .bookmark-bubble:hover,
.dark-context .bookmark-btn:hover,
.dark-context .fs-bookmark-button:hover {
    background: transparent !important;
    border-color: transparent !important;
}

.dark-context .bookmark-bubble.bookmarked,
.dark-context .bookmark-btn.bookmarked,
.dark-context .fs-bookmark-button.bookmarked {
    background: transparent !important;
    border-color: transparent !important;
}

.dark-context .bookmark-bubble.bookmarked .bookmark-icon,
.dark-context .bookmark-bubble.bookmarked i,
.dark-context .bookmark-btn.bookmarked i,
.dark-context .fs-bookmark-button.bookmarked i {
    color: #ffffff !important;
}

/* Responsive adjustments - Maintain consistency */
@media (max-width: 768px) {
    .bookmark-bubble,
    .bookmark-btn,
    .fs-bookmark-button {
        width: calc(var(--bookmark-hit-area) - 0.1rem);
        height: calc(var(--bookmark-hit-area) - 0.1rem);
    }
    
    .bookmark-bubble .bookmark-icon,
    .bookmark-bubble i,
    .bookmark-btn i,
    .fs-bookmark-button i {
        font-size: calc(var(--bookmark-icon-size) - 0.1rem);
    }

    .share-btn {
        width: var(--bookmark-size-mobile, calc(var(--bookmark-hit-area) - 0.1rem));
        height: var(--bookmark-size-mobile, calc(var(--bookmark-hit-area) - 0.1rem));
        right: calc(var(--bookmark-offset) + var(--bookmark-size-mobile, calc(var(--bookmark-hit-area) - 0.1rem)) + var(--bookmark-control-gap));
    }

    .share-btn .share-icon {
        width: calc(var(--bookmark-icon-size) - 0.1rem);
        height: calc(var(--bookmark-icon-size) - 0.1rem);
    }
}

/* Accessibility improvements */
.bookmark-bubble:focus,
.bookmark-btn:focus,
.fs-bookmark-button:focus {
    outline: 3px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.bookmark-bubble:focus:not(:focus-visible),
.bookmark-btn:focus:not(:focus-visible),
.fs-bookmark-button:focus:not(:focus-visible) {
    outline: none;
}

/* Size variants - REMOVED to maintain consistency */
/* All bookmarks should be 48px as per player profile */

/* Color variants - REMOVED to maintain consistency */
/* All bookmarks should use the player profile styling */

/* Floating animation - REMOVED to maintain consistency */
/* No floating animation in player profile */

/* Star burst - REMOVED to maintain consistency */
/* Not in player profile implementation */

/* Badge - REMOVED to maintain consistency */
/* Not in player profile implementation */

/* Ripple - REMOVED to maintain consistency */
/* Not in player profile implementation */

/* Share modal + controls */
.share-modal-backdrop {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 100000;
}

.share-modal-backdrop[hidden] {
    display: none;
}

.share-modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.share-modal-card {
    position: relative;
    width: min(620px, 100%);
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 30px 80px -40px rgba(15, 23, 42, 0.7);
    padding: 1.35rem;
    max-height: 90vh;
    overflow: auto;
}

.share-modal-close {
    position: absolute;
    top: 0.55rem;
    right: 0.6rem;
    background: transparent;
    border: none;
    color: #475569;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.share-flow-shell {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.share-modal-title {
    margin: 0;
    color: #0f172a;
}

.share-modal-note {
    margin: 0;
    color: #334155;
    font-size: 0.95rem;
}

.share-image-panel {
    background: #ffffff;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.share-image-panel[hidden] {
    display: none !important;
}

.share-image-title {
    margin: 0;
    font-size: 0.95rem;
    color: #0f172a;
}

.share-image-note {
    margin: 0;
    color: #475569;
    font-size: 0.83rem;
}

.share-image-preview-wrap {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #e2e8f0;
}

.share-image-preview-wrap img {
    display: block;
    width: 100%;
    height: auto;
}

.share-link-block {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.share-link-label {
    color: #334155;
    font-size: 0.84rem;
    font-weight: 600;
}

.share-link-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0.62rem 0.72rem;
    color: #0f172a;
    background: #ffffff;
    font-size: 0.9rem;
}

.share-link-actions,
.share-image-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.share-action-btn {
    border-radius: 12px;
    padding: 0.62rem 1.05rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.share-action-btn-primary {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #ffffff;
}

.share-action-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px -12px rgba(15, 23, 42, 0.6);
}

.share-action-btn-secondary {
    background: #ffffff;
    color: #0f172a;
    border-color: #dbe3ef;
}

.share-action-btn-secondary:hover {
    background: #f1f5f9;
}

.share-status-text {
    margin: 0;
    font-size: 0.84rem;
    color: #334155;
    min-height: 1.1em;
}

.share-status-text.is-error {
    color: #b91c1c;
}

@media (max-width: 820px) {
    .search-header-actions .share-btn {
        top: var(--banner-inset-mobile, 12px);
        right: calc(var(--banner-inset-mobile, 12px) + var(--bookmark-size-mobile, var(--bookmark-hit-area)) + var(--bookmark-control-gap));
    }
}

/* Signed-out bookmark prompt modal (styled to match account reset password modal language) */
.bookmark-signup-modal-backdrop {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 100000;
}

.bookmark-signup-modal-backdrop[hidden] {
    display: none;
}

.bookmark-signup-modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.bookmark-signup-modal-card {
    position: relative;
    width: min(520px, 100%);
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 30px 80px -40px rgba(15, 23, 42, 0.7);
    padding: 1.35rem;
}

.bookmark-signup-modal-close {
    position: absolute;
    top: 0.55rem;
    right: 0.6rem;
    background: transparent;
    border: none;
    color: #475569;
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.bookmark-signup-shell {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.bookmark-signup-title {
    margin: 0;
    color: #0f172a;
}

.bookmark-signup-note {
    margin: 0;
    color: #334155;
    font-size: 0.95rem;
}

.bookmark-signup-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.bookmark-signup-btn {
    border-radius: 12px;
    padding: 0.68rem 1.2rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.bookmark-signup-btn-primary {
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #ffffff;
}

.bookmark-signup-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px -12px rgba(15, 23, 42, 0.6);
}

.bookmark-signup-btn-secondary {
    background: #ffffff;
    color: #0f172a;
    border-color: #dbe3ef;
}

.bookmark-signup-btn-secondary:hover {
    background: #f1f5f9;
}

.bookmark-signup-link {
    align-self: flex-start;
    background: transparent;
    border: none;
    color: #0a1931;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
}

@media (max-width: 560px) {
    .share-modal-card {
        padding: 1rem;
    }

    .share-link-actions,
    .share-image-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .share-action-btn {
        width: 100%;
        text-align: center;
    }

    .bookmark-signup-modal-card {
        padding: 1rem;
    }

    .bookmark-signup-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .bookmark-signup-btn {
        width: 100%;
    }
}
