/* Share Card Styles for Pyebwa Family Tree */

/* Share Card Modal */
.share-card-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modalFadeIn 0.3s ease;
}

.share-card-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 1400px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

/* Dark mode support */
.dark-mode .share-card-modal {
    background: var(--dark-surface);
    color: var(--dark-text);
}

/* Share Card Header */
.share-card-header {
    padding: 24px 32px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.dark-mode .share-card-header {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.share-card-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
}

.dark-mode .share-card-header h3 {
    color: var(--primary-light);
}

.share-card-header .close-modal {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-card-header .close-modal:hover {
    background: rgba(0, 0, 0, 0.05);
    transform: rotate(90deg);
}

.dark-mode .share-card-header .close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Share Card Body */
.share-card-body {
    flex: 1;
    display: flex;
    gap: 32px;
    padding: 32px;
    overflow-y: auto;
}

/* Preview Container */
.share-card-preview-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 24px;
    position: relative;
    min-height: 400px;
}

.dark-mode .share-card-preview-container {
    background: rgba(255, 255, 255, 0.05);
}

#shareCardCanvas {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Loading State */
.share-card-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    flex-direction: column;
    gap: 16px;
}

.dark-mode .share-card-loading {
    background: rgba(0, 0, 0, 0.95);
}

.share-card-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.dark-mode .share-card-loading .spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-light);
}

/* Controls */
.share-card-controls {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.control-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
}

.dark-mode .control-section {
    background: rgba(255, 255, 255, 0.05);
}

.control-section h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.dark-mode .control-section h4 {
    color: var(--dark-text);
}

/* Theme Selector */
.theme-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.theme-option {
    height: 80px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.theme-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-option.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 33, 125, 0.2);
}

.theme-option.active::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    background: white;
    color: var(--primary-color);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Include Options */
.include-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.include-option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.include-option:hover {
    background: rgba(0, 0, 0, 0.05);
}

.dark-mode .include-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.include-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.include-option span {
    font-size: 16px;
    color: var(--text-secondary);
}

.dark-mode .include-option span {
    color: var(--dark-text-secondary);
}

/* Actions */
.share-card-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: auto;
}

.download-card {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.share-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.share-buttons .btn-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e0e0e0;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.dark-mode .share-buttons .btn-icon {
    background: var(--dark-surface);
    border-color: rgba(255, 255, 255, 0.2);
}

.share-buttons .btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.share-facebook:hover {
    background: #1877f2;
    color: white;
    border-color: #1877f2;
}

.share-twitter:hover {
    background: #1da1f2;
    color: white;
    border-color: #1da1f2;
}

.share-whatsapp:hover {
    background: #25d366;
    color: white;
    border-color: #25d366;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .share-card-body {
        flex-direction: column;
    }
    
    .share-card-controls {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .control-section {
        flex: 1;
        min-width: 280px;
    }
}

@media (max-width: 768px) {
    .share-card-modal {
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .share-card-body {
        padding: 20px;
        gap: 20px;
    }
    
    .share-card-preview-container {
        min-height: 300px;
        padding: 16px;
    }
    
    #shareCardCanvas {
        max-height: 400px;
        width: auto;
    }
    
    .theme-selector {
        grid-template-columns: 1fr;
    }
    
    .control-section {
        padding: 16px;
    }
    
    .share-card-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 16px;
        margin: -20px -20px 0;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .dark-mode .share-card-actions {
        background: var(--dark-surface);
        border-top-color: rgba(255, 255, 255, 0.1);
    }
}

/* Animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Print Styles */
@media print {
    .share-card-modal-overlay {
        position: relative;
        background: none;
        padding: 0;
    }
    
    .share-card-modal {
        box-shadow: none;
        max-width: 100%;
    }
    
    .share-card-header,
    .share-card-controls,
    .share-card-loading {
        display: none;
    }
    
    .share-card-body {
        padding: 0;
    }
    
    .share-card-preview-container {
        background: none;
        padding: 0;
    }
    
    #shareCardCanvas {
        max-width: 100%;
        box-shadow: none;
    }
}