/**
 * Social Share Modal Styles
 * Responsive, accessible, modern design
 */

/* Share Modal Overlay */
.share-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.share-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Share Modal Container */
.share-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    position: relative;
}

.share-modal-overlay.active .share-modal {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.share-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.close-modal {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.close-modal:hover,
.close-modal:focus {
    background: #f3f4f6;
    color: #374151;
    outline: none;
}

/* Modal Content */
.share-modal-content {
    padding: 0 24px 24px;
}

/* Product Preview */
.product-preview {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
    margin-bottom: 24px;
}

.preview-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    background: #e5e7eb;
    flex-shrink: 0;
}

.preview-info h4 {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 500;
    color: #111827;
    line-height: 1.4;
}

.preview-details {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Share Buttons Grid */
.share-buttons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.share-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    min-height: 80px;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.share-button:hover,
.share-button:focus {
    border-color: var(--platform-color, #3b82f6);
    background: var(--platform-color, #3b82f6);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    outline: none;
}

.share-button svg {
    width: 24px;
    height: 24px;
    transition: transform 0.2s ease;
}

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

.share-button span {
    font-weight: 500;
    transition: color 0.2s ease;
}

/* Native Share Button Special Styling */
.native-share-btn {
    --platform-color: #6366f1;
    grid-column: 1 / -1;
    flex-direction: row;
    max-width: none;
    min-height: 56px;
    font-weight: 600;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
}

.native-share-btn:hover {
    background: linear-gradient(135deg, #5856eb 0%, #7c3aed 100%);
    transform: translateY(-2px);
}

/* Share URL Section */
.share-url-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}

.share-url-section label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.url-input-group {
    display: flex;
    gap: 8px;
}

.share-url-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    background: #f9fafb;
    color: #374151;
    transition: border-color 0.2s ease;
}

.share-url-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: white;
}

.copy-url-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.copy-url-btn:hover,
.copy-url-btn:focus {
    background: #2563eb;
    transform: translateY(-1px);
    outline: none;
}

.copy-url-btn svg {
    width: 16px;
    height: 16px;
}

/* Share Button in Product Cards */
.share-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
}

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

.share-icon-img {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
    filter: brightness(0) saturate(100%) invert(41%) sepia(10%) saturate(1239%) hue-rotate(202deg) brightness(95%) contrast(93%);
}

.share-btn:hover .share-icon-img {
    transform: scale(1.1);
    filter: brightness(0) saturate(100%) invert(25%) sepia(85%) saturate(2270%) hue-rotate(218deg) brightness(102%) contrast(98%);
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .share-modal {
        margin: 10px;
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }

    .share-modal-header {
        padding: 20px 20px 12px;
    }

    .share-modal-content {
        padding: 0 20px 20px;
    }

    .share-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .share-button {
        padding: 14px 10px;
        min-height: 70px;
        font-size: 0.8rem;
    }

    .native-share-btn {
        grid-column: 1 / -1;
        min-height: 52px;
    }

    .product-preview {
        padding: 12px;
        gap: 12px;
    }

    .preview-image {
        width: 50px;
        height: 50px;
    }

    .url-input-group {
        flex-direction: column;
        gap: 8px;
    }

    .copy-url-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .share-modal-overlay {
        padding: 10px;
    }

    .share-buttons-grid {
        grid-template-columns: 1fr;
    }

    .share-button {
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
        padding: 12px 16px;
        min-height: auto;
    }

    .share-button svg {
        width: 20px;
        height: 20px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .share-modal {
        border: 2px solid #000;
    }

    .share-button {
        border-width: 2px;
        border-color: #000;
    }

    .share-button:hover,
    .share-button:focus {
        background: #000;
        color: #fff;
        border-color: #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .share-modal-overlay,
    .share-modal,
    .share-button,
    .close-modal,
    .copy-url-btn,
    .share-btn,
    .share-icon-img {
        transition: none;
    }

    .share-button:hover,
    .share-btn:hover {
        transform: none;
    }
}

/* Focus Visible for Better Accessibility */
.share-button:focus-visible,
.close-modal:focus-visible,
.copy-url-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading State for Copy Button */
.copy-url-btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .share-modal {
        background: #1f2937;
        color: #f9fafb;
    }

    .share-modal-header {
        border-bottom-color: #374151;
    }

    .share-modal-header h3 {
        color: #f9fafb;
    }

    .close-modal {
        color: #9ca3af;
    }

    .close-modal:hover,
    .close-modal:focus {
        background: #374151;
        color: #f3f4f6;
    }

    .product-preview {
        background: #111827;
    }

    .preview-info h4 {
        color: #f9fafb;
    }

    .preview-details {
        color: #9ca3af;
    }

    .share-button {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .share-url-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .share-url-input:focus {
        border-color: #60a5fa;
        background: #1f2937;
    }

    .share-url-section label {
        color: #f3f4f6;
    }
}
