/* resources/js/components/ContentManagement.css */
.content-management {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e1e5e9;
}

.content-header h2 {
    color: #24292e;
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.refresh-button {
    background: #0366d6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.refresh-button:hover:not(:disabled) {
    background: #0256cc;
}

.refresh-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Upload functionality styles */
.upload-toggle-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.upload-toggle-button:hover {
    background: #218838;
}

.upload-section {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(27, 31, 35, 0.1);
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.upload-section h3 {
    margin: 0;
    color: #24292e;
    font-size: 20px;
    font-weight: 600;
}

.close-button {
    background: none;
    border: none;
    font-size: 18px;
    color: #586069;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.close-button:hover {
    background: #f1f3f4;
    color: #24292e;
}

.close-button:active {
    background: #e1e5e9;
}

.text-input-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.content-textarea {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
    line-height: 1.5;
    color: #24292e;
    background: #fafbfc;
    resize: vertical;
    transition: all 0.2s ease;
}

.content-textarea:focus {
    outline: none;
    border-color: #0366d6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(3, 102, 214, 0.1);
}

.content-textarea::placeholder {
    color: #586069;
}

.input-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #586069;
    font-weight: 500;
}

.action-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.ingest-button {
    background: #0366d6;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.ingest-button:hover:not(:disabled) {
    background: #0256cc;
}

.ingest-button:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.clear-button {
    background: none;
    color: #586069;
    border: 1px solid #e1e5e9;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-button:hover {
    background: #f6f8fa;
    border-color: #d1d5db;
}

.file-upload-button {
    background: #6f42c1;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-button:hover {
    background: #5a32a3;
}

.file-support-info {
    margin-top: 8px;
    text-align: center;
}

.file-support-info small {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}

.success-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: #d4edda;
    border: 2px solid #28a745;
    border-radius: 8px;
    color: #155724;
    margin: 20px 0;
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    margin-top: 16px;
}

.message-icon {
    font-size: 16px;
    font-weight: bold;
}

.knowledge-base-controls {
    background: #f6f8fa;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
}

.control-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #24292e;
    margin: 0 0 8px 0;
}

.control-section p {
    font-size: 14px;
    color: #586069;
    margin: 0 0 16px 0;
}

.clear-kb-button {
    background: #d73a49;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.clear-kb-button:hover:not(:disabled) {
    background: #cb2431;
}

.clear-kb-button:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

.kb-note {
    display: block;
    font-size: 12px;
    color: #586069;
    font-style: italic;
}

.loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #e1e5e9;
    border-left-color: #0366d6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

/* Content statistics display */
.content-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-number {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
}

.stat-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading states */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-spinner.large {
    width: 40px;
    height: 40px;
    border: 3px solid #e1e5e9;
    border-left-color: #0366d6;
    margin-bottom: 16px;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.empty-state h3 {
    color: #24292e;
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.empty-state p {
    color: #586069;
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Documents container */
.documents-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Document card styles */
.document-card {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 24px;
    transition: all 0.2s ease;
}

.document-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db;
}

.document-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.document-title h3 {
    margin: 0 0 8px 0;
    color: #24292e;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.document-type {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.document-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.delete-button {
    background: #dc3545;
    border: none;
    color: white;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 32px;
}

.delete-button:hover:not(:disabled) {
    background: #c82333;
    transform: scale(1.05);
}

.delete-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.delete-button:active {
    transform: scale(0.95);
}

.edit-button {
    background: #28a745;
    border: none;
    color: white;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 32px;
    margin-right: 6px;
}

.edit-button:hover:not(:disabled) {
    background: #218838;
    transform: scale(1.05);
}

.edit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.edit-button:active {
    transform: scale(0.95);
}

.document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: #586069;
}

.document-date {
    color: #6b7280;
}

.document-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #6b7280;
    flex-wrap: wrap;
}

.document-stats span {
    background: #f8fafc;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

/* Document preview and content */
.document-preview h4 {
    margin: 0 0 12px 0;
    color: #24292e;
    font-size: 14px;
    font-weight: 600;
}

.document-preview p {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 16px;
    font-size: 14px;
}

.toggle-content-button {
    background: none;
    color: #0366d6;
    border: 1px solid #e1e5e9;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-content-button:hover {
    background: #f6f8fa;
    border-color: #0366d6;
}

/* Full content display */
.full-content {
    margin-top: 16px;
    border-top: 1px solid #e1e5e9;
    padding-top: 16px;
}

.content-text {
    background: #fafbfc;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    padding: 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #24292e;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* Document metadata display */
.document-metadata {
    margin-top: 16px;
    padding: 16px;
    background: #f6f8fa;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
}

.document-metadata h5 {
    margin: 0 0 12px 0;
    color: #24292e;
    font-size: 14px;
    font-weight: 600;
}

.metadata-grid {
    display: grid;
    gap: 8px;
}

.metadata-item {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 8px;
    background: white;
    border-radius: 4px;
    border: 1px solid #d1d5db;
}

.metadata-key {
    font-weight: 600;
    color: #24292e;
    min-width: 100px;
    font-size: 12px;
}

.metadata-value {
    color: #586069;
    font-size: 12px;
    font-family: "Monaco", "Consolas", monospace;
    word-break: break-word;
    white-space: pre-wrap;
}

/* Chunks section */
.chunks-section {
    margin-top: 20px;
    border-top: 1px solid #e1e5e9;
    padding-top: 20px;
}

.chunks-section h4 {
    margin: 0 0 16px 0;
    color: #24292e;
    font-size: 16px;
    font-weight: 600;
}

.chunks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chunk-item {
    background: #f8fafc;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    padding: 16px;
}

.chunk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.chunk-index {
    font-weight: 600;
    color: #24292e;
    font-size: 13px;
}

.chunk-stats {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #64748b;
    flex-wrap: wrap;
}

.chunk-stats span {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.embedding-status.has-embedding {
    color: #059669;
    background: #d1fae5;
}

.embedding-status.no-embedding {
    color: #dc2626;
    background: #fee2e2;
}

.embedding-size {
    color: #6366f1;
    background: #e0e7ff;
}

.chunk-content p {
    color: #4b5563;
    line-height: 1.6;
    margin: 0 0 12px 0;
    font-size: 13px;
}

.toggle-chunk-button {
    background: none;
    color: #0366d6;
    border: 1px solid #e1e5e9;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-chunk-button:hover {
    background: #f6f8fa;
    border-color: #0366d6;
}

.full-chunk-content {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e1e5e9;
}

.chunk-text {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    padding: 12px;
    font-size: 12px;
    line-height: 1.5;
    color: #24292e;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 8px;
}

/* Edit Section Styles */
.edit-section {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.edit-section h3 {
    color: #24292e;
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid #e1e5e9;
}

.edit-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #24292e;
    font-size: 14px;
}

.title-input {
    padding: 12px 16px;
    border: 1px solid #d1d5da;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.title-input:focus {
    outline: none;
    border-color: #0366d6;
    box-shadow: 0 0 0 2px rgba(3, 102, 214, 0.1);
}

.title-input:disabled {
    background: #f6f8fa;
    color: #6a737d;
    cursor: not-allowed;
}

.save-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.save-button:hover:not(:disabled) {
    background: #218838;
}

.save-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.cancel-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.cancel-button:hover:not(:disabled) {
    background: #5a6268;
}

.cancel-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Global success message for document updates */
.global-success-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: #d4edda;
    border: 2px solid #28a745;
    border-radius: 8px;
    color: #155724;
    font-weight: 600;
    font-size: 15px;
    box-shadow: 0 8px 32px rgba(40, 167, 69, 0.3);
    animation: slideInFromTop 0.4s ease-out;
    max-width: 90vw;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Responsive adjustments for edit section */
@media (max-width: 768px) {
    .edit-section {
        padding: 16px;
        margin-bottom: 20px;
    }

    .form-group label {
        font-size: 13px;
    }

    .title-input {
        padding: 10px 14px;
        font-size: 14px;
    }
}
