/* RAG Manager & Collections Page Styles */
/* Beautiful styling for document collections management */

/* Main Container */
.ldr-rag-manager-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    animation: fadeInUp 0.6s ease;
}

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

/* Header Section */
.ldr-rag-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.ldr-rag-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.ldr-rag-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.ldr-rag-header h1 i {
    color: var(--accent-primary);
    font-size: 2.2rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.ldr-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 400;
}

/* Section Headers */
.ldr-rag-section {
    margin-bottom: 3rem;
}

.ldr-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 2px solid var(--border-color);
}

.ldr-section-header h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ldr-section-header h2 i {
    color: var(--accent-secondary);
    font-size: 1.6rem;
}

/* Collections Grid */
.ldr-collections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Collection Cards */
.ldr-collection-card {
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.ldr-collection-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(110, 79, 246, 0.1), transparent);
    transition: left 0.6s ease;
}

.ldr-collection-card:hover::before {
    left: 100%;
}

.ldr-collection-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(110, 79, 246, 0.2);
    border-color: var(--accent-primary);
}

.ldr-collection-header {
    margin-bottom: 1.5rem;
}

.ldr-collection-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ldr-collection-header h3::before {
    content: '📚';
    font-size: 1.2rem;
}

.ldr-collection-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

/* Collection Stats */
.ldr-collection-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ldr-stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    background: rgba(110, 79, 246, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(110, 79, 246, 0.2);
    transition: all 0.2s ease;
}

.ldr-stat-item:hover {
    background: rgba(110, 79, 246, 0.2);
    transform: translateY(-2px);
}

.ldr-stat-item i {
    color: var(--accent-primary);
    font-size: 1rem;
}

.ldr-stat-item.embedding-info i {
    color: var(--success-color);
}

.ldr-stat-item.embedding-warning i {
    color: var(--warning-color);
    animation: pulse 2s infinite;
}

/* Collection View Link */
.ldr-collection-view-link {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.ldr-collection-view-link i {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

.ldr-collection-card:hover .ldr-collection-view-link {
    opacity: 1;
    color: var(--accent-primary);
}

.ldr-collection-card:hover .ldr-collection-view-link i {
    transform: translateX(4px);
}

/* Collection Actions */
.ldr-collection-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}

.ldr-collection-actions .ldr-btn-collections {
    flex: 1;
    padding: 0.75rem 1rem;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.ldr-collection-actions .ldr-btn-collections::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.ldr-collection-actions .ldr-btn-collections:hover::before {
    width: 300px;
    height: 300px;
}

.ldr-collection-actions .ldr-btn-collections i {
    font-size: 1rem;
}

/* Empty State */
.ldr-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 16px;
    border: 2px dashed var(--border-color);
    margin: 2rem 0;
    transition: all 0.3s ease;
}

.ldr-empty-state:hover {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(110, 79, 246, 0.05) 0%, rgba(145, 121, 240, 0.05) 100%);
}

.ldr-empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    opacity: 0.6;
}

.ldr-empty-state p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

.ldr-empty-state p:first-of-type {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.ldr-text-muted {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Modal Styles */
.ldr-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.ldr-modal-content {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    margin: 5% auto;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideInDown 0.3s ease;
    overflow: hidden;
}

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

.ldr-modal-header {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ldr-modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.ldr-close {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    background: none;
    border: none;
    padding: 0.25rem;
    border-radius: 4px;
}

.ldr-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.ldr-modal-body {
    padding: 2rem;
}

.ldr-form-group {
    margin-bottom: 1.5rem;
}

.ldr-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.ldr-form-group input[type="text"],
.ldr-form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.ldr-form-group input[type="text"]:focus,
.ldr-form-group textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(110, 79, 246, 0.1);
    transform: translateY(-2px);
}

.ldr-form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.ldr-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Enhanced Button Styles - Using ldr- prefix for consistency */
.ldr-btn-collections {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.ldr-btn-collections-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(110, 79, 246, 0.3);
}

.ldr-btn-collections-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(110, 79, 246, 0.4);
}

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

.ldr-btn-collections-secondary:hover {
    background-color: var(--bg-primary);
    border-color: var(--accent-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.ldr-btn-collections-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.ldr-btn-collections-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.ldr-btn-collections-warning {
    background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.ldr-btn-collections-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

.ldr-btn-collections-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.ldr-btn-collections-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.ldr-btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.ldr-btn-outline-primary {
    background-color: transparent;
    color: var(--accent-primary);
    border: 2px solid var(--accent-primary);
}

.ldr-btn-outline-primary:hover {
    background-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
}

.ldr-btn-outline-success {
    background-color: transparent;
    color: #28a745;
    border: 2px solid #28a745;
}

.ldr-btn-outline-success:hover {
    background-color: #28a745;
    color: white;
    transform: translateY(-2px);
}

.ldr-btn-outline-warning {
    background-color: transparent;
    color: #ffc107;
    border: 2px solid #ffc107;
}

.ldr-btn-outline-warning:hover {
    background-color: #ffc107;
    color: white;
    transform: translateY(-2px);
}

.ldr-active {
    background-color: var(--accent-primary) !important;
    color: white !important;
    border-color: var(--accent-primary) !important;
}

/* Loading States */
.ldr-collection-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.ldr-collection-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .ldr-rag-manager-container {
        padding: 1rem;
    }

    .ldr-rag-header {
        padding: 1.5rem 1rem;
        margin-bottom: 2rem;
    }

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

    .ldr-collections-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .ldr-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .ldr-collection-stats {
        flex-direction: column;
        gap: 0.75rem;
    }

    .ldr-collection-actions {
        flex-direction: column;
    }

    .ldr-modal-content {
        margin: 10% auto;
        width: 95%;
    }

    .ldr-modal-body {
        padding: 1.5rem;
    }

    .ldr-form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .ldr-rag-header h1 {
        font-size: 1.8rem;
    }

    .ldr-collection-card {
        padding: 1.25rem;
    }

    .ldr-collection-header h3 {
        font-size: 1.2rem;
    }

    .ldr-stat-item {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }
}

/* Dark theme enhancements */
@media (prefers-color-scheme: dark) {
    .ldr-collection-card::before {
        background: linear-gradient(90deg, transparent, rgba(110, 79, 246, 0.15), transparent);
    }

    .ldr-modal {
        background-color: rgba(0, 0, 0, 0.8);
    }
}

/* Animation for new collections */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ldr-collection-card.new {
    animation: slideInRight 0.5s ease;
}

/* Success animation */
@keyframes successPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(10, 207, 151, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(10, 207, 151, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(10, 207, 151, 0);
    }
}

.ldr-collection-card.success {
    animation: successPulse 0.6s ease;
}

/* Hover effects for interactive elements */
.ldr-collection-card,
.ldr-btn-collections,
.ldr-empty-state {
    transform-origin: center;
}

.ldr-collection-card:active,
.ldr-btn-collections:active {
    transform: scale(0.98);
}

/* Focus states for accessibility */
.ldr-btn-collections:focus,
.ldr-form-group input:focus,
.ldr-form-group textarea:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Enhanced scrollbar styling */
.ldr-collections-grid::-webkit-scrollbar {
    width: 8px;
}

.ldr-collections-grid::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 4px;
}

.ldr-collections-grid::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

.ldr-collections-grid::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}
