/**
 * Versioning Styles
 * 
 * Styles for claim version history, comparisons, and citation tracking.
 * Follows the minimal HN-inspired aesthetic of Sed Contra.
 */

/* ==========================================================================
   Version History List
   ========================================================================== */

.version-history-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.version-history-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
}

.version-history-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.claim-title-reference {
    margin: 0.5rem 0;
}

.claim-title-reference a {
    color: #000;
    font-weight: 500;
}

.version-summary {
    color: #666;
    font-size: 0.875rem;
}

.version-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.version-item {
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
}

.version-item.version-current {
    border-color: #1a73e8;
    background: #f8f9ff;
}

.version-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.version-number a {
    font-weight: 600;
    color: #1a73e8;
}

.version-meta {
    color: #666;
    font-size: 0.8125rem;
}

.version-meta a {
    color: #666;
}

.version-summary-text {
    color: #444;
    font-style: italic;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.version-title-preview {
    color: #333;
    font-size: 0.9375rem;
    margin-bottom: 0.5rem;
}

.version-actions {
    display: flex;
    gap: 1rem;
    font-size: 0.8125rem;
}

.version-actions a {
    color: #666;
}

.version-actions a:hover {
    color: #1a73e8;
}

.citation-count {
    color: #888;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 3px;
    margin-left: 0.5rem;
}

.badge-current {
    background: #1a73e8;
    color: #fff;
}

.badge-historical {
    background: #f0f0f0;
    color: #666;
}

/* ==========================================================================
   Version Detail
   ========================================================================== */

.version-detail-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.version-detail-header {
    margin-bottom: 1.5rem;
}

.version-indicator h1 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    margin: 0 0 0.5rem 0;
}

.version-meta-info {
    color: #666;
    font-size: 0.875rem;
}

.version-meta-info span + span::before {
    content: ' • ';
}

.edit-summary-display {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Version Navigation */
.version-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 1.5rem;
}

.nav-link {
    color: #1a73e8;
    font-size: 0.875rem;
}

.nav-link.disabled {
    color: #ccc;
}

.nav-history {
    font-weight: 500;
}

/* Version Content */
.historical-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.version-claim-card {
    padding: 1.5rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
}

.version-title {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
}

.version-description {
    line-height: 1.6;
    color: #333;
}

/* ==========================================================================
   Diff Display
   ========================================================================== */

.version-diff-section,
.compare-section {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.version-diff-section h3,
.compare-section h2 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
}

.diff-block {
    margin-bottom: 1rem;
}

.diff-block h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    color: #666;
}

/* Inline diff (for titles) */
.diff-inline,
.diff-content {
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 4px;
    font-family: inherit;
    line-height: 1.5;
}

.diff-add {
    background-color: #d4edda;
    color: #155724;
    text-decoration: none;
}

.diff-remove {
    background-color: #f8d7da;
    color: #721c24;
    text-decoration: line-through;
}

ins.diff-add {
    text-decoration: none;
}

del.diff-remove {
    text-decoration: line-through;
}

/* Unified diff (for descriptions) */
.diff-unified {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.8125rem;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    overflow-x: auto;
}

.diff-line {
    padding: 0.125rem 0.75rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.diff-line.diff-add {
    background-color: #d4edda;
}

.diff-line.diff-remove {
    background-color: #f8d7da;
    text-decoration: none;
}

.diff-line.diff-context {
    background: transparent;
    color: #666;
}

.diff-header {
    padding: 0.25rem 0.75rem;
    background: #e9ecef;
    color: #495057;
    font-weight: 500;
}

.diff-hunk {
    padding: 0.25rem 0.75rem;
    background: #e3f2fd;
    color: #1565c0;
}

/* ==========================================================================
   Version Comparison
   ========================================================================== */

.version-compare-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
}

.compare-header {
    margin-bottom: 1.5rem;
}

.compare-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.compare-subtitle {
    color: #666;
    font-size: 0.9375rem;
}

.compare-summary {
    display: flex;
    gap: 2rem;
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.summary-label {
    color: #666;
}

.compare-edit-summary {
    padding: 0.75rem;
    background: #e3f2fd;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

/* Side by side comparison */
.compare-side-by-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .compare-side-by-side {
        grid-template-columns: 1fr;
    }
}

.compare-old,
.compare-new {
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.compare-old {
    background: #fff8f8;
    border-color: #f8d7da;
}

.compare-new {
    background: #f8fff8;
    border-color: #d4edda;
}

.compare-old h4,
.compare-new h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
}

.compare-content {
    font-size: 0.9375rem;
    line-height: 1.5;
}

.compare-description {
    max-height: 400px;
    overflow-y: auto;
}

.no-change-notice {
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 4px;
}

.no-change-notice p {
    margin: 0 0 0.75rem 0;
    color: #666;
    font-style: italic;
}

/* Metadata table */
.compare-meta-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.compare-meta-table th,
.compare-meta-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.compare-meta-table th {
    font-weight: 500;
    color: #666;
}

.compare-meta-table td:first-child {
    color: #666;
    width: 120px;
}

/* ==========================================================================
   Claim Edit Form (Version-Aware)
   ========================================================================== */

.claim-edit-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 1rem;
}

.edit-header {
    margin-bottom: 1rem;
}

.edit-header h1 {
    margin: 0;
    font-size: 1.25rem;
}

.version-info {
    color: #666;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.edit-warning {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.citation-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
}

.citation-warning strong {
    display: block;
    margin-bottom: 0.5rem;
}

.citation-warning p {
    margin: 0.5rem 0;
}

.edit-history-link {
    margin-bottom: 1rem;
}

.edit-history-link a {
    color: #1a73e8;
    font-size: 0.875rem;
}

.edit-summary-group {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

.recommended-label {
    color: #e65100;
    font-weight: normal;
    font-size: 0.8125rem;
}

.version-note {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f5f5f5;
    border-radius: 4px;
    font-size: 0.8125rem;
    color: #666;
}

.version-note p {
    margin: 0;
}

/* ==========================================================================
   Diverged Citations
   ========================================================================== */

.diverged-citations-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.diverged-header {
    margin-bottom: 1.5rem;
}

.diverged-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.diverged-subtitle {
    color: #666;
    font-size: 0.9375rem;
}

.diverged-summary {
    padding: 1rem;
    background: #fff3cd;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.diverged-summary p {
    margin: 0 0 0.5rem 0;
}

.diverged-summary p:last-child {
    margin-bottom: 0;
}

.diverged-explanation {
    font-size: 0.875rem;
    color: #666;
}

.diverged-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.diverged-item {
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
}

.diverged-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.diverged-relationship {
    font-size: 0.875rem;
}

.versions-behind {
    background: #f8d7da;
    color: #721c24;
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
}

.diverged-evidence-claim h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
}

.title-change {
    font-size: 0.8125rem;
    color: #666;
    margin-bottom: 0.75rem;
}

.old-title {
    text-decoration: line-through;
    color: #999;
}

.diverged-versions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

@media (max-width: 600px) {
    .diverged-versions {
        grid-template-columns: 1fr;
    }
}

.version-cited,
.version-current {
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.8125rem;
}

.version-cited {
    background: #f8f8f8;
}

.version-current {
    background: #f0f7ff;
}

.version-cited h4,
.version-current h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #666;
}

.version-preview {
    color: #444;
    line-height: 1.4;
}

.diverged-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.no-diverged {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.no-diverged p:first-child {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   Recent Edits
   ========================================================================== */

.recent-edits-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.recent-edits-header {
    margin-bottom: 1rem;
}

.recent-edits-header h1 {
    margin: 0 0 0.25rem 0;
    font-size: 1.25rem;
}

.recent-edits-subtitle {
    color: #666;
    font-size: 0.9375rem;
}

.time-filter {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.time-filter span {
    color: #666;
}

.time-filter a {
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
}

.time-filter a.active {
    background: #1a73e8;
    color: #fff;
}

.edits-summary {
    color: #666;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.edits-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.edit-item {
    padding: 0.75rem;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fff;
}

.edit-meta {
    font-size: 0.8125rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.edit-version {
    background: #f0f0f0;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    margin-right: 0.5rem;
}

.edit-claim a {
    color: #000;
    font-weight: 500;
}

.edit-summary-text {
    color: #666;
    font-style: italic;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.edit-actions {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
}

.edit-actions a {
    color: #666;
    margin-right: 1rem;
}

.edit-actions a:hover {
    color: #1a73e8;
}

.no-edits {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* ==========================================================================
   Citation Status Partial
   ========================================================================== */

.citation-status-partial {
    margin: 0.75rem 0;
}

.citation-diverged-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    overflow: hidden;
}

.warning-header {
    background: #ffc107;
    color: #000;
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.warning-content {
    padding: 0.75rem;
    font-size: 0.875rem;
}

.warning-content p {
    margin: 0 0 0.75rem 0;
}

.title-change-notice {
    background: #fff;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.title-change-notice .label {
    display: block;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.title-change-notice .old-value {
    color: #721c24;
    text-decoration: line-through;
}

.title-change-notice .arrow {
    color: #666;
    margin: 0.25rem 0;
}

.title-change-notice .new-value {
    color: #155724;
}

.citation-current {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #155724;
    font-size: 0.875rem;
}

.status-icon {
    color: #28a745;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

.inline-form {
    display: inline;
}

.evidence-type {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-right: 0.25rem;
}

.evidence-type.supporting {
    background: #d4edda;
    color: #155724;
}

.evidence-type.opposing {
    background: #f8d7da;
    color: #721c24;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 600px) {
    .version-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .version-navigation {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .compare-summary {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .diverged-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .diverged-actions {
        flex-wrap: wrap;
    }
}
