/* Lightweight Custom Floating Share Bar */

/* Desktop Floating Sidebar */
.desktop-share-bar {
    position: fixed;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%) translateX(0);
    z-index: var(--z-sticky-bar);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, visibility 0.4s;
    opacity: 1;
    visibility: visible;
}

/* Hidden state for desktop share bar (e.g. when header/footer are visible) */
.desktop-share-bar.share-bar-hidden {
    transform: translateY(-50%) translateX(-120%);
    opacity: 0;
    visibility: hidden;
}

/* Prevent layout transition flash on load */
.desktop-share-bar.no-transition {
    transition: none !important;
}

.share-bar-inner {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 50px;
    /* Light Mode Only (Round 55): was dark glass by default with a
       never-applying .light-theme override and a prefers-color-scheme
       fallback; folded to the light surface for every visitor. */
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.1);
}

.share-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.share-btn svg {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover effects with brand specific colors */
.share-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.share-btn-facebook:hover { color: #1877f2; background: rgba(24, 119, 242, 0.15); }
.share-btn-x:hover { color: var(--text-primary); background: rgba(148, 163, 184, 0.15); }
.share-btn-linkedin:hover { color: #0a66c2; background: rgba(10, 102, 194, 0.15); }
.share-btn-whatsapp:hover { color: #25d366; background: rgba(37, 211, 102, 0.15); }
.share-btn-copy:hover { color: #4338CA; background: rgba(99, 102, 241, 0.15); }
.share-btn-print:hover { color: #15803D; background: rgba(16, 185, 129, 0.15); }
.share-btn-bookmark:hover { color: #A16207; background: rgba(245, 158, 11, 0.15); }

.share-btn:active svg {
    transform: scale(0.9);
}

/* Custom Tooltips for buttons */
.share-btn .tooltip {
    position: absolute;
    left: 100%;
    margin-left: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-8px);
    transition: all 0.2s ease;
    pointer-events: none;
    border: 1px solid var(--border-color);
}

.share-btn:hover .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Mobile Share Bottom Trigger & Overlay Sheet */
.mobile-share-bar-container {
    display: none;
}

@media (max-width: 768px) {
    .desktop-share-bar {
        display: none !important;
    }
    
    .mobile-share-bar-container {
        display: block;
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        z-index: var(--z-header);
    }
    
    .mobile-share-trigger {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.75rem 1.25rem;
        border-radius: 50px;
        background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
        color: #ffffff;
        border: none;
        font-weight: 600;
        font-family: var(--font-sans);
        box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
        cursor: pointer;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    .mobile-share-trigger:active {
        transform: scale(0.95);
    }
    
    /* Bottom Sheet Fallback styling */
    .mobile-share-bottom-sheet {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: var(--z-toast);
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .mobile-share-bottom-sheet.sheet-open {
        pointer-events: auto;
        opacity: 1;
        visibility: visible;
    }
    
    .bottom-sheet-backdrop {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
    }
    
    .bottom-sheet-content {
        position: relative;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        padding: 1.5rem;
        width: 100%;
        max-height: 80vh;
        overflow-y: auto;
        box-sizing: border-box;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.2);
    }
    
    .mobile-share-bottom-sheet.sheet-open .bottom-sheet-content {
        transform: translateY(0);
    }
    
    .bottom-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 1.5rem;
    }
    
    .bottom-sheet-header .sheet-title {
        margin: 0;
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--text-primary);
        font-family: var(--font-sans);
    }
    
    .bottom-sheet-close {
        background: none;
        border: none;
        color: var(--text-secondary);
        font-size: 1.75rem;
        cursor: pointer;
        padding: 0.25rem;
        line-height: 1;
    }
    
    .mobile-share-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 1.25rem;
        justify-content: center;
    }
    
    @media (max-width: 480px) {
        .mobile-share-grid {
            grid-template-columns: repeat(3, 1fr);
        }
    }
    
    .mobile-share-grid-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        text-decoration: none;
        cursor: pointer;
        color: var(--text-secondary);
        transition: color 0.2s ease;
    }
    
    .mobile-share-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 50px;
        height: 50px;
        border-radius: 16px;
        background: var(--bg-primary);
        border: 1px solid var(--border-color);
        transition: all 0.2s ease;
    }
    
    .mobile-share-grid-item:hover .mobile-share-icon,
    .mobile-share-grid-item:active .mobile-share-icon {
        transform: translateY(-2px);
    }
    
    /* Active colors on mobile buttons */
    .mobile-share-grid-item.share-btn-facebook .mobile-share-icon { color: #1877f2; }
    .mobile-share-grid-item.share-btn-x .mobile-share-icon { color: var(--text-primary); }
    .mobile-share-grid-item.share-btn-linkedin .mobile-share-icon { color: #0a66c2; }
    .mobile-share-grid-item.share-btn-whatsapp .mobile-share-icon { color: #25d366; }
    .mobile-share-grid-item.share-btn-copy .mobile-share-icon { color: #4338CA; }
    .mobile-share-grid-item.share-btn-print .mobile-share-icon { color: #15803D; }
    .mobile-share-grid-item.share-btn-bookmark .mobile-share-icon { color: #A16207; }
    
    .mobile-share-label {
        font-size: 0.75rem;
        font-weight: 500;
        text-align: center;
        font-family: var(--font-sans);
    }
}
