/* /app/static/significantstories_com/css/share.css */
/* Styles for sharing functionality: modals, buttons, and shared content pages */

/* ============================================
   Share Modal Content
   ============================================ */
.share-modal-content {
    text-align: center;
}

/* ============================================
   Share URL Container
   ============================================ */
.share-url-container {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.share-url-input {
    flex: 1;
    padding: 0.625rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #333;
    background: #f8f9fa;
    min-width: 0; /* Allow shrinking in flex */
}

.share-url-input:focus {
    outline: none;
    border-color: #3498db;
    background: #fff;
}

/* ============================================
   Share Impact Note
   ============================================ */
.share-impact-note {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 0 0.5rem 0;
    padding: 0.5rem 1rem;
    background: #e8f5e9;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #2e7d32;
}

.share-impact-note svg {
    flex-shrink: 0;
}

/* Copy button */
.share-copy-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 0.75rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.share-copy-btn:hover {
    background: #e9ecef;
}

.share-copy-btn.copied {
    background: #28a745;
    border-color: #28a745;
    color: #fff;
}

.share-copy-btn svg {
    flex-shrink: 0;
}

/* ============================================
   Share Actions Section
   ============================================ */
.share-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.share-native-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Hide native share button if API not supported */
.share-native-btn.hidden {
    display: none;
}

/* ============================================
   Share Sync Badges
   ============================================ */
.share-sync-info {
    width: 100%;
    text-align: center;
    margin-bottom: 0.25rem;
}

.share-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.share-sync-badge svg {
    flex-shrink: 0;
}

.share-sync-on {
    background: #e8f5e9;
    color: #2e7d32;
}

.share-sync-off {
    background: #f5f5f5;
    color: #757575;
}

/* ============================================
   Shared Book Landing Page
   ============================================ */
.shared-book-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.shared-book-header {
    text-align: center;
    margin-bottom: 2rem;
}

.shared-book-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: #3498db;
}

.shared-book-icon svg {
    width: 100%;
    height: 100%;
}

.shared-book-title {
    font-family: var(--serif-font, Georgia, serif);
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.5rem 0;
}

.shared-book-description {
    font-size: 1rem;
    color: #666;
    margin: 0 0 0.5rem 0;
    line-height: 1.5;
}

.shared-book-count {
    font-size: 0.9rem;
    color: #888;
    margin: 0 0 1rem 0;
}

.shared-book-sync-badge {
    margin-top: 0.5rem;
}

/* ============================================
   Shared Book Articles List
   ============================================ */
.shared-book-articles {
    margin-bottom: 2rem;
}

.shared-book-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.shared-book-article {
    border-bottom: 1px solid #e0e0e0;
}

.shared-book-article:last-child {
    border-bottom: none;
}

.shared-book-article-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s ease;
}

.shared-book-article-link:hover {
    background: #f8f9fa;
}

.shared-book-article-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    flex-shrink: 0;
    margin-right: 0.75rem;
}

.shared-book-article-title {
    flex: 1;
    font-size: 0.95rem;
    color: #333;
    line-height: 1.4;
}

.shared-book-article-arrow {
    color: #999;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

/* Button styling for non-published articles */
button.shared-book-article-link {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
}

.shared-book-article-preview:hover {
    background: #fff8e1;
}

.shared-book-article-unavailable {
    opacity: 0.5;
    cursor: not-allowed;
}

.shared-book-article-unavailable .shared-book-article-title {
    text-decoration: line-through;
}

/* Badge for article states */
.shared-book-article-badge {
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.shared-book-article-badge.preview {
    background: #fff3cd;
    color: #856404;
}

.shared-book-article-badge.unavailable {
    background: #f5f5f5;
    color: #999;
}

/* ============================================
   Shared Book Actions
   ============================================ */
.shared-book-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.shared-book-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.shared-book-btn svg {
    flex-shrink: 0;
}

.shared-book-btn-primary {
    background: #3498db;
    color: #fff;
}

.shared-book-btn-primary:hover {
    background: #2980b9;
}

.shared-book-btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
}

.shared-book-btn-secondary:hover {
    background: #e9ecef;
}

.shared-book-import-form {
    display: contents;
}

/* ============================================
   Share Icon Button (for article headers/footers)
   ============================================ */
.share-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    transition: color 0.2s ease;
    border-radius: 4px;
}

.share-toggle:hover {
    color: #3498db;
}

.share-toggle:focus {
    outline: 2px solid rgba(52, 152, 219, 0.3);
    outline-offset: 2px;
}

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

/* Loading state for share toggle */
.share-toggle.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* With label (footer variant) */
.share-toggle-footer {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    color: #495057;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.share-toggle-footer:hover {
    background: #e9ecef;
    color: #3498db;
}

.share-toggle-label {
    font-weight: 500;
}

/* ============================================
   Book Share Button (in book page header)
   Matches delete button pill style
   ============================================ */
.book-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: none;
    border: 1px solid #ddd;
    border-radius: 20px;
    color: #888;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.book-share-btn svg {
    width: 14px;
    height: 14px;
}

.book-share-btn:hover {
    border-color: #6c757d;
    color: #6c757d;
}

.book-share-btn:disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Shared state - green when book has been shared */
.book-share-btn.shared {
    border-color: #28a745;
    color: #28a745;
}

.book-share-btn.shared:hover {
    border-color: #218838;
    color: #218838;
}

/* ============================================
   Share Sync Option Toggle (in book share modal)
   ============================================ */
.share-sync-option {
    margin: 1.25rem 0;
    text-align: left;
}

.share-sync-toggle {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.share-sync-toggle:hover {
    border-color: #ced4da;
    background: #f8f9fa;
}

.share-sync-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #28a745;
}

.share-sync-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.share-sync-toggle-label strong {
    font-size: 0.95rem;
    color: #333;
}

.share-sync-toggle-desc {
    font-size: 0.85rem;
    color: #666;
    line-height: 1.4;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 600px) {
    .share-url-container {
        flex-direction: column;
    }

    .share-copy-btn {
        justify-content: center;
    }

    .shared-book-container {
        padding: 1.5rem 1rem;
    }

    .shared-book-title {
        font-size: 1.5rem;
    }

    .shared-book-icon {
        width: 48px;
        height: 48px;
    }
}

/* =============================================================================
   PUBLISH STATE STYLING (Early/Preview content)
   ============================================================================= */

/* Combined: Background Tint + Left Border Accent */
.shared-book-article.state-early .shared-book-article-link {
    background: linear-gradient(135deg, #f6faf5 0%, #eef4ec 100%);
    border-left: 4px solid #9ab392;
}

.shared-book-article.state-preview .shared-book-article-link {
    background: linear-gradient(135deg, #f4faf9 0%, #e8f4f2 100%);
    border-left: 4px solid #7dbdb4;
}
