/* UniversalRAG - Modern Gradient UI */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-warning: linear-gradient(135deg, #fa8231 0%, #ffc837 100%);
    --gradient-error: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --accent: #667eea;
    --accent-hover: #764ba2;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

code, .mono {
    font-family: 'JetBrains Mono', monospace;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
    background: var(--gradient-1);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}

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

.tagline {
    font-size: 1.2rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Stats Section */
.stats-section {
    margin-bottom: 3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255,255,255,0.1);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.stat-value {
    font-size: 3rem;
    font-weight: 700;
    background: var(--gradient-3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

/* Search Section */
.search-section {
    margin-bottom: 3rem;
}

.search-container {
    display: flex;
    gap: 1rem;
    max-width: 900px;
    margin: 0 auto;
}

#global-search {
    flex: 1;
    padding: 1.2rem 1.5rem;
    background: var(--bg-card);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 15px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

#global-search:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.btn-search {
    padding: 1.2rem 2rem;
    background: var(--gradient-3);
    border: none;
    border-radius: 15px;
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    white-space: nowrap;
}

.btn-search:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.4);
}

.search-results {
    margin-top: 2rem;
    background: var(--bg-card);
    border-radius: 15px;
    padding: 2rem;
    max-height: 600px;
    overflow-y: auto;
}

.search-result-item {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: background 0.2s ease;
}

.search-result-item:hover {
    background: rgba(255,255,255,0.05);
}

.search-result-item:last-child {
    border-bottom: none;
}

.result-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.result-type {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(102, 126, 234, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.result-desc {
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.result-path {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

/* Add Project Section */
.add-project-section {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 20px;
    margin-bottom: 3rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.add-project-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.add-project-form {
    display: flex;
    gap: 1rem;
    max-width: 900px;
}

.input-group {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 0 1.5rem;
    border: 2px solid rgba(255,255,255,0.1);
    transition: border-color 0.3s ease;
}

.input-group:focus-within {
    border-color: var(--accent);
}

.input-prefix {
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

.input-path {
    flex: 1;
    padding: 1.2rem 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
}

.input-path:focus {
    outline: none;
}

.btn-primary {
    padding: 1.2rem 2.5rem;
    background: var(--gradient-success);
    border: none;
    border-radius: 15px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
    white-space: nowrap;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(56, 239, 125, 0.4);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.status-message {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
}

.status-message.success {
    background: rgba(56, 239, 125, 0.2);
    color: #38ef7d;
}

.status-message.error {
    background: rgba(235, 51, 73, 0.2);
    color: #f45c43;
}

.status-message.info {
    background: rgba(79, 172, 254, 0.2);
    color: #4facfe;
}

.progress-bar {
    margin-top: 1.5rem;
    background: var(--bg-secondary);
    height: 40px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-3);
    transition: width 0.3s ease;
    border-radius: 20px;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Projects Grid */
.projects-section h2 {
    margin-bottom: 2rem;
    font-size: 1.8rem;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-1);
}

.project-card.status-ready::before {
    background: var(--gradient-success);
}

.project-card.status-error::before {
    background: var(--gradient-error);
}

.project-card.status-indexing::before {
    background: var(--gradient-warning);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.2);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1.5rem;
}

.project-name {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.project-status {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.project-status.ready {
    background: rgba(56, 239, 125, 0.2);
    color: #38ef7d;
}

.project-status.indexing {
    background: rgba(255, 200, 55, 0.2);
    color: #ffc837;
}

.project-status.error {
    background: rgba(235, 51, 73, 0.2);
    color: #f45c43;
}

.project-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.project-stat {
    text-align: center;
    padding: 1rem;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}

.project-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
}

.project-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.project-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.project-meta div {
    margin: 0.3rem 0;
}

.project-actions {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.btn-small {
    padding: 0.7rem;
    border: none;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.btn-view:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.5);
}

.btn-reindex {
    background: rgba(79, 172, 254, 0.2);
    color: #4facfe;
}

.btn-reindex:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
}

.btn-delete {
    background: rgba(235, 51, 73, 0.2);
    color: #f45c43;
}

.btn-delete:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
}

/* Backup Section */
.backup-section {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 20px;
    margin-bottom: 3rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.backup-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.backup-container {
    max-width: 900px;
    margin: 0 auto;
}

.btn-backup {
    width: 100%;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 15px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.btn-backup:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.5);
}

.btn-backup:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-text {
    font-size: 1.1rem;
}

.backup-status {
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-weight: 500;
    text-align: center;
}

.backup-status.success {
    background: rgba(56, 239, 125, 0.2);
    color: #38ef7d;
}

.backup-status.error {
    background: rgba(235, 51, 73, 0.2);
    color: #f45c43;
}

.backup-status.info {
    background: rgba(79, 172, 254, 0.2);
    color: #4facfe;
}

.backup-progress-container {
    margin-top: 2rem;
}

.backup-progress-bar {
    background: var(--bg-secondary);
    height: 50px;
    border-radius: 25px;
    overflow: hidden;
    position: relative;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
}

.backup-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    border-radius: 25px;
    position: relative;
    overflow: hidden;
}

.backup-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.backup-progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    z-index: 1;
}

.backup-phases {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.backup-phase {
    background: rgba(255,255,255,0.05);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.3s ease;
}

.backup-phase:hover {
    background: rgba(255,255,255,0.08);
    transform: translateY(-2px);
}

.phase-icon {
    font-size: 1.5rem;
}

.phase-label {
    flex: 1;
    font-weight: 500;
    font-size: 0.95rem;
}

.phase-status {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
}

.phase-status.complete {
    background: rgba(56, 239, 125, 0.2);
    color: #38ef7d;
}

.phase-status.in-progress {
    background: rgba(255, 200, 55, 0.2);
    color: #ffc837;
    animation: pulse 1.5s infinite;
}

.backup-stats {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

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

.backup-stat .stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.backup-stat .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.download-links {
    margin-top: 2rem;
    padding: 2rem;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

.download-links h3 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    text-align: center;
}

.download-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.download-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.download-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.download-db {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.download-db:hover {
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.5);
}

.download-docs {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #ffffff;
    box-shadow: 0 5px 15px rgba(79, 172, 254, 0.3);
}

.download-docs:hover {
    box-shadow: 0 10px 25px rgba(79, 172, 254, 0.5);
}

.download-icon {
    font-size: 1.5rem;
}

.download-label {
    font-size: 1rem;
}

.download-size {
    font-size: 0.85rem;
    opacity: 0.9;
    padding: 0.3rem 0.6rem;
    background: rgba(255,255,255,0.2);
    border-radius: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .backup-phases {
        grid-template-columns: 1fr;
    }
    
    .backup-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .download-buttons {
        grid-template-columns: 1fr;
    }
    
    .btn-backup {
        padding: 1.25rem 1.5rem;
    }
    
    .btn-text {
        font-size: 1rem;
    }
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.hidden {
    display: none;
}

/* Utility Classes */
.mono {
    font-family: 'JetBrains Mono', monospace;
}
