/**
 * SP2026 Social Sharing Styles
 * Responsive, accessible social sharing component
 * Supports light/dark modes and print styles
 */

/* ============================================
   SHARE PANEL - Main Modal
   ============================================ */

.share-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 550px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.share-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.share-panel::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    backdrop-filter: blur(4px);
}

/* Share Header */
.share-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.share-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.share-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.share-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Share Content */
.share-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* ============================================
   SHARE BUTTONS GRID
   ============================================ */

.share-buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    gap: 8px;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.share-btn:active {
    transform: translateY(0);
}

.share-icon {
    font-size: 24px;
    font-weight: bold;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f3f4f6;
}

.share-label {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

/* Platform-Specific Colors */
.share-btn-facebook:hover {
    border-color: #1877f2;
}

.share-btn-facebook:hover .share-icon {
    background: #1877f2;
    color: white;
}

.share-btn-twitter:hover {
    border-color: #000000;
}

.share-btn-twitter:hover .share-icon {
    background: #000000;
    color: white;
}

.share-btn-linkedin:hover {
    border-color: #0a66c2;
}

.share-btn-linkedin:hover .share-icon {
    background: #0a66c2;
    color: white;
}

.share-btn-whatsapp:hover {
    border-color: #25d366;
}

.share-btn-whatsapp:hover .share-icon {
    background: #25d366;
    color: white;
}

.share-btn-telegram:hover {
    border-color: #0088cc;
}

.share-btn-telegram:hover .share-icon {
    background: #0088cc;
    color: white;
}

.share-btn-email:hover {
    border-color: #ea4335;
}

.share-btn-email:hover .share-icon {
    background: #ea4335;
    color: white;
}

/* ============================================
   COPY LINK SECTION
   ============================================ */

.share-link-section {
    margin-bottom: 24px;
}

.share-section-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.share-link-input-group {
    display: flex;
    gap: 8px;
}

.share-link-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    background: #f9fafb;
    color: #374151;
}

.share-link-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.share-btn-copy {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-btn-copy:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ============================================
   QR CODE SECTION
   ============================================ */

.share-qr-section {
    margin-bottom: 24px;
    text-align: center;
}

.share-qr-container {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    margin: 12px 0;
}

.share-qr-container canvas {
    border-radius: 8px;
    margin-bottom: 12px;
}

.qr-download-btn {
    padding: 8px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
}

.qr-download-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.share-qr-hint {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
}

/* ============================================
   PRINT SECTION
   ============================================ */

.share-print-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}

.share-btn-print {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-btn-print:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.share-btn-full {
    width: 100%;
    flex-direction: row;
    gap: 8px;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.share-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 90%;
}

.share-toast.show {
    bottom: 32px;
}

.share-toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.share-toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.share-toast-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   COMPACT SHARE BAR (for document cards)
   ============================================ */

.share-bar-compact {
    display: flex;
    gap: 6px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 8px;
    margin-top: 12px;
}

.share-btn-mini {
    flex: 1;
    padding: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn-mini:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.share-icon-mini {
    font-size: 16px;
    font-weight: bold;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Mobile Phones (up to 480px) */
@media (max-width: 480px) {
    .share-panel {
        width: 95%;
        max-height: 95vh;
        border-radius: 12px;
    }

    .share-header {
        padding: 16px;
    }

    .share-header h4 {
        font-size: 1.1rem;
    }

    .share-content {
        padding: 16px;
    }

    .share-buttons-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .share-btn {
        padding: 14px 10px;
    }

    .share-icon {
        font-size: 20px;
        width: 36px;
        height: 36px;
    }

    .share-label {
        font-size: 12px;
    }

    .share-link-input {
        font-size: 12px;
        padding: 10px 12px;
    }

    .share-btn-copy {
        padding: 10px 16px;
        font-size: 13px;
    }

    .share-qr-container {
        padding: 16px;
    }

    .share-toast {
        width: 90%;
        padding: 12px 16px;
    }

    .toast-message {
        font-size: 13px;
    }
}

/* Tablets (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .share-panel {
        max-width: 500px;
    }

    .share-buttons-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Large Screens (1200px+) */
@media (min-width: 1200px) {
    .share-panel {
        max-width: 600px;
    }

    .share-buttons-grid {
        gap: 16px;
    }

    .share-btn {
        padding: 20px 16px;
    }
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

@media (prefers-color-scheme: dark) {
    .share-panel {
        background: #1f2937;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    }

    .share-btn {
        background: #374151;
        border-color: #4b5563;
    }

    .share-label {
        color: #e5e7eb;
    }

    .share-icon {
        background: #4b5563;
    }

    .share-link-input {
        background: #374151;
        border-color: #4b5563;
        color: #e5e7eb;
    }

    .share-link-input:focus {
        background: #4b5563;
        border-color: #667eea;
    }

    .share-qr-container {
        background: #374151;
        border-color: #4b5563;
    }

    .qr-download-btn {
        background: #4b5563;
        border-color: #6b7280;
        color: #e5e7eb;
    }

    .share-section-label {
        color: #e5e7eb;
    }

    .share-qr-hint {
        color: #9ca3af;
    }

    .share-bar-compact {
        background: #374151;
    }

    .share-btn-mini {
        background: #4b5563;
        border-color: #6b7280;
    }
}

/* Dark mode class (for manual toggle) */
.dark-mode .share-panel {
    background: #1f2937;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.dark-mode .share-btn {
    background: #374151;
    border-color: #4b5563;
}

.dark-mode .share-label {
    color: #e5e7eb;
}

.dark-mode .share-icon {
    background: #4b5563;
}

.dark-mode .share-link-input {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

.dark-mode .share-link-input:focus {
    background: #4b5563;
    border-color: #667eea;
}

.dark-mode .share-qr-container {
    background: #374151;
    border-color: #4b5563;
}

.dark-mode .qr-download-btn {
    background: #4b5563;
    border-color: #6b7280;
    color: #e5e7eb;
}

.dark-mode .share-section-label {
    color: #e5e7eb;
}

.dark-mode .share-qr-hint {
    color: #9ca3af;
}

.dark-mode .share-bar-compact {
    background: #374151;
}

.dark-mode .share-btn-mini {
    background: #4b5563;
    border-color: #6b7280;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    /* Hide all share UI when printing */
    .share-panel,
    .share-bar-compact,
    .share-toast,
    .btn-share-modal,
    [data-share-action] {
        display: none !important;
    }

    /* Hide QR codes in print */
    .share-qr-container {
        display: none !important;
    }
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* Focus styles for keyboard navigation */
.share-btn:focus,
.share-btn-mini:focus,
.share-close:focus,
.qr-download-btn:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .share-btn {
        border-width: 3px;
    }

    .share-panel {
        border: 3px solid #000;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .share-panel,
    .share-btn,
    .share-toast,
    .share-close {
        transition: none;
    }

    .share-close:hover {
        transform: none;
    }

    .share-btn:hover,
    .share-btn-mini:hover {
        transform: none;
    }
}

/* ============================================
   LOADING STATE
   ============================================ */

.share-qr-container.loading {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-qr-container.loading::before {
    content: '⏳';
    font-size: 48px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   ERROR STATE
   ============================================ */

.share-qr-container .error {
    color: #dc2626;
    font-size: 14px;
    padding: 20px;
}

/* ============================================
   INTEGRATION WITH EXISTING MODAL
   ============================================ */

/* Add to document modal actions */
.document-actions .btn-share-modal {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.document-actions .btn-share-modal:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ============================================
   Z-INDEX HIERARCHY
   ============================================ */

.share-panel::before {
    z-index: 9999;
}

.share-panel {
    z-index: 10000;
}

.share-toast {
    z-index: 10001;
}

/* ============================================
   ANIMATION UTILITIES
   ============================================ */

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   CUSTOM SCROLLBAR FOR SHARE PANEL
   ============================================ */

.share-content::-webkit-scrollbar {
    width: 8px;
}

.share-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.share-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.share-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Firefox scrollbar */
.share-content {
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}
