/* SNS Sharing Styles */

/* Share CTA Button with Subtle Glow + Shimmer Effect */
.share-cta-btn {
    position: relative;
    overflow: hidden;
    animation: share-glow 3s ease-in-out infinite;
}

/* Glow effect - subtle */
@keyframes share-glow {
    0%, 100% {
        box-shadow: 0 0 3px rgba(96, 165, 250, 0.15),
                    0 0 6px rgba(96, 165, 250, 0.1);
    }
    50% {
        box-shadow: 0 0 8px rgba(96, 165, 250, 0.25),
                    0 0 15px rgba(96, 165, 250, 0.15);
    }
}

/* Shimmer effect - subtle */
.share-cta-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    animation: share-shimmer 4s ease-in-out infinite;
}

@keyframes share-shimmer {
    0% {
        left: -100%;
    }
    40%, 100% {
        left: 100%;
    }
}

.share-cta-btn:hover {
    animation: none;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.4),
                0 0 20px rgba(96, 165, 250, 0.2);
}

.share-cta-btn:hover::after {
    animation: none;
    opacity: 0;
}

/* Share Section (Embedded in Result Page) */
.share-section {
    margin-top: 2rem;
    text-align: center;
}

.share-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-white, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.share-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
    cursor: pointer;
    backdrop-filter: none; /* Avoid double glass issue */
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* Modal Overlay */
.sns-modal-overlay {
    position: fixed;
    inset: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200000; /* High z-index to cover everything */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    padding: 20px;
}

.sns-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.sns-modal-content {
    background: #1e293b;
    border-radius: 24px;
    padding: 1.25rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sns-modal-content::-webkit-scrollbar {
    width: 6px;
}

.sns-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.sns-modal-content::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sns-modal-overlay.active .sns-modal-content {
    transform: scale(1);
}

#generated-image-preview {
    width: auto;
    max-width: 100%;
    max-height: 45vh;
    object-fit: contain;
    flex-shrink: 1;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #000;
}

.sns-modal-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-shrink: 0; /* Prevent buttons from shrinking */
}

/* Share buttons in modal - use same style as share section */
.sns-modal-actions .share-btn {
    width: 56px;
    height: 56px;
}

.sns-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 0.9rem;
}

.sns-action-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sns-action-btn.primary {
    background: white;
    color: #0f172a;
}

.sns-action-btn.instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border: none;
}

.sns-action-btn.line {
    background: #06C755;
    border: none;
}

.sns-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 10;
    backdrop-filter: blur(4px);
}

.sns-close-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Share button groups */
.share-group-native,
.share-group-fallback {
    display: flex;
    justify-content: center;
    gap: 1rem;
    align-items: center;
}

.share-group-native {
    gap: 1.5rem;
}

/* Native share button - labeled with icon + text */
.share-btn-native {
    width: auto;
    height: auto;
    border-radius: 16px;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border: 1px solid rgba(139, 92, 246, 0.3);
    font-size: 0.9rem;
    font-weight: 600;
    gap: 0.5rem;
    flex-direction: row;
}

.share-btn-native:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

/* Labeled buttons in native group */
.share-group-native .share-btn {
    flex-direction: column;
    width: auto;
    height: auto;
    border-radius: 16px;
    padding: 0.6rem 1.2rem;
    gap: 0.25rem;
}

.share-group-native .share-btn span {
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.9;
}

/* Share section blocks */
.share-section-block {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.share-section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.share-divider {
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.75rem 0;
}

/* Text preview */
.share-text-preview {
    max-width: 380px;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.6rem 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.4;
    text-align: center;
}

/* Hidden Canvas */
#score-canvas {
    display: none;
}
