:root {
    --bg-dark: #0f172a;
    --acc-primary: #38bdf8;
    --acc-hover: #0ea5e9;
    --acc-purple: #818cf8;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
}

/* Background animated orb */
#orb-canvas {
    position: fixed;
    top: -20vh; left: -10vw;
    width: 60vw; height: 60vh;
    background: radial-gradient(circle, rgba(56,189,248,0.2) 0%, rgba(15,23,42,0) 70%);
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    pointer-events: none;
    animation: floatOrb 10s ease-in-out infinite alternate;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10vw, 15vh) scale(1.2); }
}

.glass-shell {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100vw; height: 100vh;
    backdrop-filter: blur(20px);
}

/* SIDEBAR */
.sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.85);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--acc-primary), var(--acc-purple));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.sidebar-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 20px;
    gap: 8px;
}

.nav-item {
    padding: 12px 18px;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    display: flex; align-items: center; gap: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}
.nav-item.active {
    background: linear-gradient(90deg, rgba(56,189,248,0.1), rgba(129,140,248,0.05));
    border-left: 3px solid var(--acc-primary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
}

.status-indicator {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.85rem; color: var(--text-muted);
}

.pulse-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 10px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.95); opacity: 0.5; }
}

/* MAIN CONTENT */
.content-area {
    flex: 1;
    display: flex; flex-direction: column;
}

.top-bar {
    height: 80px;
    padding: 0 40px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}

.search-wrap {
    display: flex; align-items: center; gap: 12px;
    background: rgba(0,0,0,0.2);
    padding: 10px 20px;
    border-radius: 30px;
    width: 350px;
    border: 1px solid var(--glass-border);
}

.search-wrap input {
    background: transparent; border: none; outline: none;
    color: var(--text-main); font-size: 0.95rem;
    width: 100%;
}

.user-profile img { width: 40px; height: 40px; border-radius: 50%; }

.page-container {
    flex: 1; padding: 40px; overflow-y: auto;
}

.page {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}
.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-title {
    font-family: 'Outfit', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 30px;
}

/* UTILS */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.btn {
    padding: 10px 20px; border-radius: 8px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
    border: none; display: flex; align-items: center; gap: 8px;
    font-family: 'Inter', sans-serif;
}
.btn-primary { background: var(--acc-primary); color: #000; }
.btn-primary:hover { background: var(--acc-hover); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(56,189,248,0.3); }
.btn-outline { background: transparent; border: 1px solid var(--glass-border); color: var(--text-main); }
.btn-outline:hover { background: rgba(255,255,255,0.05); }

/* GRID CARDS */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.kb-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    transition: transform 0.3s, border-color 0.3s;
    position: relative;
    overflow: hidden;
}

.kb-card:hover {
    transform: translateY(-5px);
    border-color: var(--acc-primary);
}

.kb-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(90deg, var(--acc-primary), var(--acc-purple));
}

.kb-card h3 { font-size: 1.3rem; margin-bottom: 10px; font-family: 'Outfit'; }
.kb-card p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 15px; }
.kb-meta { display: flex; gap: 15px; font-size: 0.8rem; color: var(--acc-primary); }

/* FORMS */
.input-group { margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; color: var(--text-muted); }
.input-group input, .input-group textarea, .input-group select {
    width: 100%; padding: 12px 16px;
    background: rgba(0,0,0,0.3); border: 1px solid var(--glass-border);
    border-radius: 8px; color: var(--text-main); font-family: 'Inter';
    transition: border-color 0.3s; resize: vertical;
}
.input-group input:focus, .input-group textarea:focus { border-color: var(--acc-primary); outline: none; }

/* MODAL */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(5px);
    display: none; align-items: center; justify-content: center; z-index: 100;
}
.modal-overlay.active { display: flex; }
.modal { width: 100%; max-width: 500px; animation: modalIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes modalIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 30px; }

/* UPLOAD DROPZONE */
.drop-zone {
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    padding: 60px;
    text-align: center;
    transition: all 0.3s;
    margin-bottom: 20px;
}
.drop-zone.active { border-color: var(--acc-primary); background: rgba(56,189,248,0.05); }
.drop-zone p { margin-top: 15px; font-size: 1.1rem; }
.drop-zone .muted { font-size: 0.85rem; color: var(--text-muted); }

/* SEARCH RESULT */
.search-results { margin-top: 30px; display: flex; flex-direction: column; gap: 15px; }
.chunk-item { border-left-color: var(--acc-purple); }
.chunk-text { line-height: 1.6; color: rgba(255,255,255,0.9); margin-top: 10px;}
.chunk-badge { display: inline-block; background: rgba(56,189,248,0.1); color: var(--acc-primary); padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; margin-right: 10px;}

/* SLIDERS */
.semantic-controls { display: flex; gap: 30px; align-items: flex-end;}
.slider-group { flex: 1; }
.slider-group input { width: 100%; margin-top: 10px; }

.settings-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid rgba(255,255,255,0.1); padding-bottom: 1px; }
.tab-btn { background: transparent; color: var(--text-main); border: none; border-bottom: 2px solid transparent; padding: 10px 20px; cursor: pointer; font-family: 'Inter', sans-serif; opacity: 0.7; transition: 0.2s; }
.tab-btn:hover { opacity: 1; }
.tab-btn.active { opacity: 1; border-bottom: 2px solid var(--acc-primary); }
.tab-pane { display: none; margin-bottom: 20px; }
.tab-pane.active { display: block; animation: fadeIn 0.3s ease-out; }
.status-badge { font-size:0.8rem; padding: 2px 5px; border-radius: 4px; }
.status-ready { background: rgba(0,255,0,0.1); color: #4CAF50; }
.status-cloud { background: rgba(255,255,255,0.1); color: white; }

/* LAYOUT FIXES */
.action-bar { margin-bottom: 20px; display: flex; gap: 10px; }
.muted { color: var(--text-muted); font-size: 0.9rem; }
.upload-jobs { margin-top: 20px; }
.drop-zone { cursor: pointer; }

/* Monitor grid override — always show 3 cols */
#monitorStatsGrid {
    grid-template-columns: repeat(3, 1fr) !important;
}

/* Semantic controls responsive */
.semantic-controls { flex-wrap: wrap; }
.semantic-controls .btn-primary { white-space: nowrap; }

/* KB card meta overflow */
.kb-meta { flex-wrap: wrap; }
.kb-card h3 { word-break: break-word; }

/* Search module spacing */
.search-module { margin-bottom: 20px; }

/* Upload module */
.upload-module { margin-bottom: 20px; }
.upload-module select { cursor: pointer; }

