/* Articles Organizer - Modern CSS Styling */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Card Styles */
.upload-card, .articles-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.upload-card:hover, .articles-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.2);
}

.upload-card h2, .articles-card h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Drop Zone Styles */
.drop-zone {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: #fafafa;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 25px;
}

.drop-zone:hover, .drop-zone.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
    transform: scale(1.02);
}

.drop-zone-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.7;
}

.drop-text {
    font-size: 1rem;
    color: #666;
    margin-bottom: 20px;
}

.browse-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: all;
}

.browse-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Upload Queue Styles */
.upload-queue {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.upload-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid #28a745;
}

.upload-item.uploading {
    border-left-color: #ffc107;
}

.upload-item.error {
    border-left-color: #dc3545;
}

.upload-info {
    flex: 1;
    margin-right: 15px;
}

.upload-filename {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.upload-meta {
    font-size: 0.85rem;
    color: #666;
}

.upload-progress {
    width: 100px;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 5px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    width: 0%;
}

.upload-status {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    color: white;
}

.upload-status.success {
    background: #28a745;
}

.upload-status.uploading {
    background: #ffc107;
    color: #333;
}

.upload-status.error {
    background: #dc3545;
}

/* Upload Statistics */
.upload-stats {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

/* Articles Section */
.articles-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.articles-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.refresh-button, .search-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.refresh-button:hover, .search-button:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
}

/* Search Bar */
.search-bar {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    gap: 10px;
}

.search-bar > div:first-child {
    display: flex;
}

#searchInput {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px 0 0 8px;
    font-size: 1rem;
}

.search-buttons {
    display: flex;
}

.search-button {
    border-radius: 0;
    padding: 10px 15px;
    margin: 0;
    border-left: none;
}

.search-button:first-child {
    border-radius: 0;
}

.search-button:last-child {
    border-radius: 0 8px 8px 0;
}

.search-button.nlp-search {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.search-button.nlp-search:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
}

.search-options {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 5px 0;
}

.search-type-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
}

.search-type-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #667eea;
    border-radius: 3px;
    position: relative;
    cursor: pointer;
}

.search-type-toggle input[type="checkbox"]:checked {
    background-color: #667eea;
}

.search-type-toggle input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: -1px;
    left: 1px;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.search-results-info {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #666;
}

.similarity-score {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 10px;
}

.chunk-preview {
    background: #f5f5f5;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    border-left: 3px solid #667eea;
}

/* Articles List */
.articles-list {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.article-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid #28a745;
}

.article-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.article-item.unprocessed {
    border-left-color: #ffc107;
}

.article-info {
    flex: 1;
    cursor: pointer;
}

.article-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.download-button {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.download-button:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.download-button:active {
    transform: translateY(0);
}

.article-filename {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.article-meta {
    font-size: 0.85rem;
    color: #666;
}

.article-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.article-status.processed {
    background: #28a745;
}

.article-status.pending {
    background: #ffc107;
    color: #333;
}

.article-status.processing {
    background: #17a2b8;
}

.article-status.error {
    background: #dc3545;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.page-button {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.page-button:hover:not(:disabled) {
    background: #5a67d8;
    transform: translateY(-1px);
}

.page-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.page-info {
    font-weight: 600;
    color: #666;
}

/* Footer Status Bar */
.footer {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px 20px;
    backdrop-filter: blur(10px);
}

.status-bar {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.status-item {
    display: flex;
    flex-direction: column;
}

.status-label {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
}

.status-value {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.status-value.connected {
    color: #28a745;
}

.status-value.disconnected {
    color: #dc3545;
}

/* Notifications */
.notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.notification {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-left: 4px solid #28a745;
    animation: slideIn 0.3s ease-out;
}

.notification.error {
    border-left-color: #dc3545;
}

.notification.warning {
    border-left-color: #ffc107;
}

.notification.info {
    border-left-color: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease-out;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 25px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translate(-50%, -30%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .upload-card, .articles-card {
        padding: 20px;
    }

    .articles-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .articles-controls {
        justify-content: space-between;
    }

    .status-bar {
        flex-direction: column;
        gap: 10px;
    }

    .article-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
}

/* Enhanced Search Results */
.search-results-info.enhanced {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.conversational-response {
    padding: 10px 0;
}

.response-text {
    margin-top: 8px;
    padding: 10px;
    background: #e3f2fd;
    border-radius: 6px;
    color: #1565c0;
    font-weight: 500;
}

.search-header {
    font-size: 0.95rem;
}

.article-card.conversational {
    border-left: 4px solid #28a745;
    background: #f8fff8;
}

.article-card.semantic {
    border-left: 4px solid #667eea;
    background: #f0f4ff;
}

.article-card {
    background: white;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.article-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    flex: 1;
    margin-right: 15px;
}

.article-details {
    color: #666;
    line-height: 1.5;
}

.article-details p {
    margin: 5px 0;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.text-success {
    color: #28a745 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-error {
    color: #dc3545 !important;
}

.text-info {
    color: #17a2b8 !important;
}