/* Individual Document Page Styling */
/* Uses CSS variables from styles.css for theme support */

.ldr-document-details-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: var(--gradient-bg);
    min-height: 100vh;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
}

/* Document Header Section */
.ldr-document-header {
    background: rgba(var(--bg-secondary-rgb), 0.95);
    backdrop-filter: var(--backdrop-blur);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    animation: slideDown 0.6s ease-out;
}

.ldr-document-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 20px 0 15px 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ldr-document-title i {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ldr-document-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 25px;
    font-style: italic;
}

.ldr-authors-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ldr-authors-list li {
    background: var(--bg-tertiary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    border: 1px solid var(--border-color);
}

.ldr-authors-list li:not(:last-child):after {
    content: "";
    display: none;
}

/* Document Actions */
.ldr-document-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 25px;
}

.ldr-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.ldr-btn:hover {
    box-shadow: 0 8px 25px rgba(var(--accent-primary-rgb), 0.3);
}

.ldr-btn-primary {
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-primary));
    color: var(--text-primary);
}

.ldr-btn-primary:hover {
    filter: brightness(1.1);
}

.ldr-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.ldr-btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

.ldr-btn-success {
    background: var(--success-color);
    color: var(--bg-primary);
}

.ldr-btn-success:hover {
    filter: brightness(1.1);
    box-shadow: 0 8px 25px rgba(var(--success-color-rgb), 0.3);
}

.ldr-btn-danger {
    background: var(--error-color);
    color: white;
}

.ldr-btn-danger:hover {
    filter: brightness(1.1);
    box-shadow: 0 8px 25px rgba(var(--error-color-rgb), 0.3);
}

.ldr-btn-info {
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-primary));
    color: white;
}

.ldr-btn-info:hover {
    filter: brightness(1.1);
    box-shadow: 0 8px 25px rgba(var(--accent-tertiary-rgb), 0.3);
}

/* Metadata Sections */
.ldr-metadata-section {
    background: rgba(var(--bg-secondary-rgb), 0.95);
    backdrop-filter: var(--backdrop-blur);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.8s ease-out;
}

.ldr-metadata-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.ldr-metadata-section h2 i {
    color: var(--accent-primary);
    font-size: 1.3rem;
}

.ldr-metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.ldr-metadata-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.ldr-metadata-item:hover {
    border-color: var(--accent-secondary);
}

.ldr-metadata-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ldr-metadata-value {
    color: var(--text-primary);
    font-size: 1rem;
    word-break: break-word;
    font-weight: 500;
}

.ldr-metadata-value code {
    background: var(--bg-primary);
    color: var(--accent-tertiary);
    padding: 4px 8px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

.ldr-metadata-value a {
    color: var(--accent-tertiary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.ldr-metadata-value a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* Badge Styles */
.ldr-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ldr-badge-success {
    background: var(--success-color);
    color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(var(--success-color-rgb), 0.3);
}

.ldr-badge-info {
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-primary));
    color: white;
    box-shadow: 0 4px 15px rgba(var(--accent-tertiary-rgb), 0.3);
}

.ldr-badge-warning {
    background: var(--warning-color);
    color: var(--bg-primary);
    box-shadow: 0 4px 15px rgba(var(--warning-color-rgb), 0.3);
}

/* RAG Status */
.ldr-rag-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.ldr-rag-status i {
    font-size: 1.2rem;
}

.ldr-rag-status span {
    font-weight: 500;
    color: var(--text-primary);
}

/* Empty Value Styling */
.ldr-empty-value {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
}

/* Content Preview */
.ldr-content-preview {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--accent-primary);
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    max-height: 400px;
    overflow-y: auto;
    margin-top: 15px;
    box-shadow: inset 0 2px 10px rgba(var(--shadow-color-rgb), 0.2);
}

.ldr-content-preview::-webkit-scrollbar {
    width: 8px;
}

.ldr-content-preview::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.ldr-content-preview::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
}

/* Source URL Section */
.ldr-metadata-section .ldr-metadata-value {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    word-break: break-all;
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Responsive Design */
@media (max-width: 767px) {
    .ldr-document-details-container {
        padding: 15px;
        border-radius: 0;
    }

    .ldr-document-title {
        font-size: 2rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .ldr-document-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .ldr-btn {
        justify-content: center;
    }

    .ldr-metadata-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .ldr-authors-list {
        flex-direction: column;
        gap: 5px;
    }

    .ldr-authors-list li {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .ldr-document-header,
    .ldr-metadata-section {
        padding: 20px;
    }

    .ldr-document-title {
        font-size: 1.8rem;
    }

    .ldr-metadata-section h2 {
        font-size: 1.3rem;
    }
}

/* ---- Document Chunks Styles ---- */

.ldr-chunks-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
}

.ldr-chunks-header {
    background: var(--card-bg, #1e1e2d);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color, #333);
}

.ldr-chunks-header h1 {
    margin: 0 0 10px 0;
    color: var(--text-primary, #e4e4e4);
}

.ldr-chunks-stats {
    color: var(--text-secondary, #999);
    font-size: 14px;
}

.ldr-collection-section {
    background: var(--card-bg, #1e1e2d);
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.ldr-collection-header {
    background: linear-gradient(135deg, rgba(var(--accent-primary-rgb), 0.15) 0%, rgba(var(--accent-secondary-rgb), 0.15) 100%);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color, #333);
}

.ldr-collection-header h2 {
    margin: 0;
    color: var(--text-primary, #e4e4e4);
    font-size: 18px;
}

.ldr-collection-header .ldr-chunk-count {
    color: var(--text-secondary, #999);
    font-size: 14px;
    margin-top: 5px;
}

.ldr-chunk {
    border-bottom: 1px solid var(--border-color, #2a2a3a);
    padding: 20px;
}

.ldr-chunk:last-child {
    border-bottom: none;
}

.ldr-chunk-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.ldr-chunk-meta-item {
    color: var(--text-secondary, #999);
    font-size: 13px;
}

.ldr-chunk-meta-item strong {
    color: var(--text-primary, #e4e4e4);
}

.ldr-chunk-text {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color, #333);
    border-radius: 4px;
    padding: 15px;
    color: var(--text-primary, #e4e4e4);
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.ldr-embedding-info {
    margin-top: 10px;
    padding: 10px;
    background: rgba(var(--accent-primary-rgb), 0.1);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary, #999);
}

.ldr-embedding-info strong {
    color: var(--text-primary, #e4e4e4);
}

.ldr-back-button {
    display: inline-block;
    padding: 10px 20px;
    background: var(--btn-secondary-bg);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-bottom: 20px;
}

.ldr-back-button:hover {
    background: var(--btn-secondary-bg);
    filter: brightness(0.85);
    color: white;
}

.ldr-no-chunks {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary, #999);
}

/* ---- Document Text Styles ---- */

.ldr-text-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: var(--card-shadow);
}

.ldr-text-header {
    border-bottom: 2px solid var(--accent-primary);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.ldr-text-header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    color: var(--text-primary);
}

.ldr-text-meta {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 15px;
}

.ldr-text-meta-item {
    display: inline-block;
    margin-right: 20px;
}

.ldr-text-actions {
    margin-bottom: 20px;
}

.ldr-text-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 16px;
}

.ldr-text-actions .ldr-btn {
    display: inline-block;
    padding: 8px 16px;
    margin-right: 10px;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 14px;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    position: static;
    overflow: visible;
    cursor: pointer;
    transition: all 0.2s;
}

.ldr-text-actions .ldr-btn-primary {
    background-color: var(--accent-primary);
    color: white;
}

.ldr-text-actions .ldr-btn-primary:hover {
    background-color: var(--accent-primary);
    filter: brightness(0.85);
    color: white;
}

.ldr-text-actions .ldr-btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.ldr-text-actions .ldr-btn-secondary:hover {
    background-color: var(--bg-tertiary);
    filter: brightness(0.9);
    color: var(--text-primary);
}
