/* ===== SOCIAL SHARE STYLES ===== */

/* Share Button Container */
.social-share {
    position: relative;
    display: inline-block;
}

/* Main Share Button */
.share-trigger {
    background: linear-gradient(135deg, var(--gold-color, #d4af37), #f4e17a);
    color: #1a1a1a;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    position: relative;
    overflow: hidden;
}

.share-trigger:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.share-trigger:active {
    transform: translateY(0) scale(0.98);
}

.share-trigger i {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.share-trigger:hover i {
    transform: rotate(15deg) scale(1.1);
}

/* Share Options Popup */
.share-options {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    padding: 16px;
    display: none;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
    z-index: 1000;
    border: 1px solid rgba(212, 175, 55, 0.2);
    margin-bottom: 8px;
}

body.dark-mode .share-options {
    background: #1e293b;
    border-color: #374151;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.share-options.show {
    display: flex;
    animation: shareSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Force hide when not showing */
.share-options:not(.show) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

@keyframes shareSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* Share Option Item */
.share-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

body.dark-mode .share-option {
    color: #e2e8f0;
}

.share-option:hover {
    background: #f8fafc;
    color: #1f2937;
    text-decoration: none;
    transform: translateY(-1px);
    border-color: rgba(212, 175, 55, 0.2);
}

body.dark-mode .share-option:hover {
    background: #374151;
    color: #ffffff;
}

/* Social Platform Icons */
.share-option i {
    font-size: 18px;
    width: 24px;
    text-align: center;
    transition: transform 0.2s ease;
}

.share-option:hover i {
    transform: scale(1.15);
}

/* Platform-specific colors */
.share-option.whatsapp i {
    color: #25D366;
}

.share-option.facebook i {
    color: #1877F2;
}

.share-option.twitter i {
    color: #1DA1F2;
}

.share-option.telegram i {
    color: #0088CC;
}

.share-option.copy-link i {
    color: var(--gold-color, #d4af37);
}

.share-option.instagram i {
    color: #E4405F;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .share-trigger {
        width: 40px;
        height: 40px;
    }
    
    .share-trigger i {
        font-size: 14px;
    }
    
    .share-options {
        min-width: 140px;
        padding: 8px;
        gap: 4px;
    }
    
    .share-option {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .share-option i {
        font-size: 14px;
        width: 18px;
    }
}

/* Extra Small Mobile Optimizations */
@media (max-width: 480px) {
    .share-options {
        bottom: 16px !important;
        left: 12px !important;
        right: 12px !important;
        padding: 12px 8px !important;
    }
    
    .share-option {
        min-width: 50px !important;
        max-width: 60px !important;
        padding: 10px 6px !important;
    }
    
    .share-option i {
        font-size: 18px !important;
    }
    
    .share-option span {
        font-size: 9px !important;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .share-options {
        bottom: 12px !important;
        padding: 14px 10px !important;
    }
    
    .share-option {
        padding: 10px 6px !important;
    }
    
    .share-option i {
        font-size: 18px !important;
    }
    
    .share-option span {
        font-size: 9px !important;
    }
}

/* Toast Notification for Copy Success */
.share-toast {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    right: max(20px, env(safe-area-inset-right));
    background: var(--gold-color, #d4af37);
    color: #1a1a1a;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100vw - 40px);
    word-wrap: break-word;
}

.share-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.share-toast i {
    font-size: 16px;
}

/* Mobile Toast Adjustments */
@media (max-width: 768px) {
    .share-toast {
        top: max(16px, env(safe-area-inset-top));
        right: max(16px, env(safe-area-inset-right));
        left: max(16px, env(safe-area-inset-left));
        padding: 10px 16px;
        font-size: 14px;
        border-radius: 10px;
        max-width: none;
        text-align: center;
        justify-content: center;
    }
    
    .share-toast i {
        font-size: 14px;
    }
}

/* Product Card Integration */
.product-card .social-share {
    position: absolute;
    top: 12px;
    right: 12px;
    opacity: 1; /* Always visible for now */
    transition: opacity 0.3s ease;
    z-index: 10;
}

.product-card:hover .social-share {
    opacity: 1;
}

/* Ensure product cards don't hide social share */
.product-card {
    overflow: visible !important;
    position: relative !important;
}

/* Featured Product Integration */
.featured-product-card .social-share {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 1; /* Always visible for now */
    transition: opacity 0.3s ease;
    z-index: 10;
}

.featured-product-card:hover .social-share {
    opacity: 1;
}

/* Ensure featured product cards don't hide social share */
.featured-product-card {
    overflow: visible !important;
    position: relative !important;
}

/* Share Analytics (optional) */
.share-option[data-platform] {
    position: relative;
}

.share-option[data-platform]::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* Dark Mode Adjustments */
body.dark-mode .share-trigger {
    background: linear-gradient(135deg, #d4af37, #b8941f);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

body.dark-mode .share-trigger:hover {
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

body.dark-mode .share-toast {
    background: #d4af37;
    color: #1a1a1a;
}

/* Accessibility */
.share-trigger:focus,
.share-option:focus {
    outline: 2px solid var(--gold-color, #d4af37);
    outline-offset: 2px;
}

/* Animation for share button pulse */
@keyframes sharePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.share-trigger.pulse {
    animation: sharePulse 2s infinite;
}

/* Overlay for mobile */
@media (max-width: 768px) {
    .share-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.6);
        /* Keep overlay below the sheet and chat widget */
        z-index: 99990;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }
    
    .share-overlay.show {
        display: block;
        opacity: 1;
    }
    
    .share-options {
        position: fixed !important;
        bottom: max(20px, env(safe-area-inset-bottom)) !important;
        left: max(16px, env(safe-area-inset-left)) !important;
        right: max(16px, env(safe-area-inset-right)) !important;
        top: auto !important;
        transform: none !important;
        margin-bottom: 0 !important;
        flex-direction: row !important;
        justify-content: space-evenly !important;
        padding: 14px 10px !important;
        border-radius: 18px !important;
        /* Make sure the sheet is above any overlay/widgets */
        z-index: 100000 !important;
        background: #ffffff !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25) !important;
        max-width: none !important;
        min-width: auto !important;
        will-change: transform, opacity;
        border: 1px solid rgba(212, 175, 55, 0.2) !important;
    }
    
    body.dark-mode .share-options {
        background: #1e293b !important;
        border-color: #374151 !important;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
    }
    
    .share-options.show {
        animation: shareSlideUpMobile 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
        display: flex !important;
    }
    
    /* Force hide mobile modal when not showing */
    .share-options:not(.show) {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(100px) !important;
    }
    
    @keyframes shareSlideUpMobile {
        from {
            opacity: 0;
            transform: translateY(100px) scale(0.9);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
    
    .share-option {
        flex-direction: column !important;
        gap: 3px !important;
        text-align: center !important;
        min-width: 55px !important;
        max-width: 65px !important;
        padding: 10px 6px !important;
        pointer-events: auto !important;
        position: relative !important;
        /* Ensure individual options sit above any overlapping elements */
        z-index: 100001 !important;
        border-radius: 10px !important;
        background: transparent !important;
        border: none !important;
        flex: 1 !important;
        transition: all 0.2s ease !important;
    }
    
    .share-option:hover {
        background: rgba(212, 175, 55, 0.15) !important;
        transform: translateY(-1px) scale(1.02) !important;
    }
    
    body.dark-mode .share-option:hover {
        background: rgba(212, 175, 55, 0.25) !important;
    }
    
    .share-option:active {
        transform: translateY(0) scale(0.98) !important;
        transition: transform 0.1s ease !important;
    }
    
    .share-option i {
        font-size: 22px !important;
        margin-bottom: 1px !important;
        display: block !important;
    }
    
    .share-option span {
        font-size: 9px !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        display: block !important;
        word-wrap: break-word !important;
        max-width: 100% !important;
        text-transform: capitalize !important;
    }
}
