/**
 * Share button styles for blog posts
 */

/* Share Button and Popup Styles */
.share-button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.3s ease;
    padding: 5px 12px;
    border-radius: 20px;
    position: relative;
}

.share-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #4a6bff;
}

.share-popup {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background-color: white;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    border-radius: 15px;
    padding: 20px;
    width: 280px;
    z-index: 1010; /* Higher z-index to appear above other elements */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
}

.share-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.share-popup::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 20px;
    width: 16px;
    height: 16px;
    background-color: white;
    transform: rotate(45deg);
    box-shadow: -3px -3px 5px rgba(0, 0, 0, 0.04);
}

.share-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 15px;
    color: #2d3748;
    text-align: center;
}

.share-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.share-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 5px;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.share-option:hover {
    background-color: #f0f4ff;
    transform: translateY(-3px);
}

.share-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: white;
}

.share-name {
    font-size: 0.85rem;
    color: #2d3748;
    font-weight: 500;
}

.share-icon.whatsapp { background-color: #25D366; }
.share-icon.linkedin { background-color: #0077B5; }
.share-icon.instagram { background-color: #E4405F; }
.share-icon.copy-link { background-color: #6c63ff; }

.copy-link-input {
    margin-top: 15px;
    position: relative;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
}

.copy-link-input input {
    flex-grow: 1;
    border: none;
    outline: none;
    font-size: 0.9rem;
    color: #2d3748;
    width: 100%;
    background: transparent;
}

.copy-button {
    background-color: #4a6bff;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background-color: #3a55d9;
}

.copy-link-input.copied {
    border-color: #28a745;
}

.copy-link-input.copied .copy-button {
    background-color: #28a745;
}

.copy-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background-color: #323232;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 0.9rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 9999;
}

.copy-notification.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Overlay for closing popup when clicking outside */
.share-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 1005; /* Between regular content and popup */
    display: none;
}

.share-overlay.active {
    display: block;
}

/* Animation for share popup entrance */
@keyframes popIn {
    0% { transform: translateY(10px) scale(0.95); opacity: 0; }
    70% { transform: translateY(-5px) scale(1.02); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.share-popup.animate-in {
    animation: popIn 0.4s forwards;
}

/* Animation for share icons */
@keyframes bounceIn {
    0% { transform: scale(0.7); opacity: 0; }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.share-option {
    opacity: 0;
}

.share-option.animate-in:nth-child(1) { animation: bounceIn 0.3s 0.1s forwards; }
.share-option.animate-in:nth-child(2) { animation: bounceIn 0.3s 0.2s forwards; }
.share-option.animate-in:nth-child(3) { animation: bounceIn 0.3s 0.3s forwards; }
.share-option.animate-in:nth-child(4) { animation: bounceIn 0.3s 0.4s forwards; }
.share-option.animate-in:nth-child(5) { animation: bounceIn 0.3s 0.5s forwards; }
.share-option.animate-in:nth-child(6) { animation: bounceIn 0.3s 0.6s forwards; }

/* Responsive adjustments */
@media (max-width: 576px) {
    .share-popup {
        width: 250px;
        left: 50%;
        transform: translateX(-50%) translateY(10px) scale(0.95);
    }

    .share-popup.active {
        transform: translateX(-50%) translateY(0) scale(1);
    }
    
    .share-popup::before {
        right: 50%;
        transform: translateX(50%) rotate(45deg);
    }

    /* Make sure all icons are visible */
    .share-options {
        grid-template-columns: repeat(2, 1fr); /* Ensure 2 columns */
        gap: 12px; /* Slightly larger gap for better spacing */
    }
    
    .share-option {
        padding: 8px 5px; /* Slightly smaller padding */
    }
    
    .share-icon {
        width: 36px; /* Slightly smaller icons */
        height: 36px;
    }
}

/* Instagram Story Generator */
.ig-story-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2500; /* Higher than other elements */
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.ig-story-container.active {
    display: flex;
}

.ig-story-content {
    position: relative;
    width: 100%;
    max-width: 400px; /* Limit width on larger screens */
    height: 0;
    padding-bottom: 177.78%; /* 9:16 aspect ratio for Instagram stories */
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

.ig-story-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.ig-story-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.ig-story-button {
    background: #fff;
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.ig-story-button:hover {
    transform: translateY(-2px);
}

.ig-story-button.download {
    background: #E4405F;
    color: #fff;
}

.ig-story-button.download:hover {
    background: #d33b57;
}

.ig-story-button.close {
    background: #6c757d;
    color: #fff;
}

.ig-story-button.close:hover {
    background: #5a6268;
}

/* Add notification for success states */
.ig-story-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #28a745;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.ig-story-notification.active {
    opacity: 1;
    visibility: visible;
}
