:root {
    --bg-color: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.7);
    --surface-border: rgba(255, 255, 255, 0.1);
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --accent-color: #10b981;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --danger: #ef4444;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    /* subtle background gradient */
    background: radial-gradient(circle at top left, #1e293b 0%, #0f172a 100%);
}

.app-container {
    display: flex;
    height: 100vh;
}

.glass-effect {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
}

/* Sidebar */
.sidebar {
    width: 260px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--surface-border);
}

.logo h2 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.logo .highlight {
    color: var(--primary-color);
}

.logo p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 2.5rem;
}

.nav-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.nav-item:hover, .nav-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

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

/* Buttons */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
}
.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.project-card {
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: block;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

.project-card h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.6rem;
    display: flex;
    align-items: flex-start;
}
.card-meta strong {
    color: var(--text-primary);
    margin-right: 0.5rem;
    min-width: 60px;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    padding: 2rem;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.form-group {
    margin-bottom: 1.2rem;
}

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

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--surface-border);
    color: white;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Project Detail Layout */
.project-detail-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-info-banner {
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
}
.banner-item {
    display: flex;
    flex-direction: column;
}
.banner-item span.label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}
.banner-item span.value {
    font-weight: 600;
    color: var(--text-primary);
}

.workspace {
    display: flex;
    flex: 1;
    gap: 1.5rem;
    overflow: hidden;
}

.doc-sidebar {
    width: 320px;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    padding: 1rem;
}

.doc-list {
    flex: 1;
    overflow-y: auto;
    margin-top: 1rem;
}

.doc-item {
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 0.5rem;
    border: 1px solid transparent;
}
.doc-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.doc-item.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}

.doc-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    word-break: break-all;
}

.doc-item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.doc-viewer {
    flex: 1;
    border-radius: 12px;
    padding: 2rem;
    overflow-y: auto;
    background: var(--surface-color);
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
}

/* File Upload Area */
.upload-area {
    border: 2px dashed var(--surface-border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 1rem;
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
    color: var(--primary-color);
}
.upload-area p {
    font-size: 0.9rem;
}

.hidden { display: none !important; }

/* Markdown Styles inside viewer */
.markdown-body {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 1rem;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    padding-bottom: 0.3em;
    color: white;
}
.markdown-body h1 { border-bottom: 1px solid var(--surface-border); }
.markdown-body h2 { border-bottom: 1px solid var(--surface-border); }
.markdown-body p { margin-bottom: 1rem; }
.markdown-body code {
    background: rgba(0, 0, 0, 0.4);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: #a5d6ff;
}
.markdown-body pre {
    background: #0d1117;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid rgba(255,255,255,0.05);
}
.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}
.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1rem;
}
.markdown-body th, .markdown-body td {
    border: 1px solid var(--surface-border);
    padding: 0.75rem;
}
.markdown-body th {
    background: rgba(255,255,255,0.05);
}
.markdown-body blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    background: rgba(59, 130, 246, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 0 4px 4px 0;
}
