:root {
    --bg-primary: #1a1a2e;
    --bg-sidebar: #16213e;
    --bg-content: #0f0f1a;
    --accent-primary: #e94560;
    --accent-secondary: #533483;
    --text-primary: #eaeaea;
    --text-secondary: #a0a0a0;
    --border-color: #2a2a4a;
    --code-bg: #0d0d1a;
    --success: #4ecca3;
    --warning: #ffc107;
    --error: #ff6b6b;
}

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

body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
    overflow-y: auto;
}

.container {
    display: flex;
    height: 100vh;
    overflow-x: auto;
}

.sidebar-left {
    width: 20%;
    min-width: 250px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-left .search-box {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-left .search-box input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: var(--bg-content);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.sidebar-left .search-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
}

.sidebar-left .search-box input::placeholder {
    color: var(--text-secondary);
}

.sidebar-left .search-box .search-btn {
    position: absolute;
    right: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 16px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.sidebar-left .search-box .search-btn:hover {
    opacity: 1;
}

.sidebar-left .search-box .search-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    font-size: 16px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.sidebar-left .search-box .search-btn:hover {
    opacity: 1;
}

.search-results {
    position: absolute;
    top: 60px;
    left: 16px;
    right: 16px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    max-height: 500px;
    overflow-y: auto;
    display: none;
    z-index: 100;
}

.search-results.active {
    display: block;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-content);
    position: sticky;
    top: 0;
}

.search-header span {
    font-size: 14px;
    color: var(--text-secondary);
}

.search-header .clear-search {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.search-header .clear-search:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.search-result-list {
    max-height: 400px;
    overflow-y: auto;
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
}

.search-result-item:hover {
    background: rgba(233, 69, 96, 0.1);
}

.search-result-item .icon {
    width: 32px;
    height: 32px;
    background: var(--accent-secondary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 14px;
}

.search-result-item .title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.search-result-item .excerpt {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-result-item .excerpt mark {
    background: rgba(233, 69, 96, 0.3);
    color: var(--accent-primary);
    padding: 0 2px;
    border-radius: 2px;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.file-item:hover {
    background: rgba(233, 69, 96, 0.1);
}

.file-item.active {
    background: rgba(233, 69, 96, 0.15);
    border-left-color: var(--accent-primary);
}

.file-item .icon {
    width: 32px;
    height: 32px;
    background: var(--accent-secondary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 14px;
}

.file-item .info {
    flex: 1;
    min-width: 0;
}

.file-item .name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item .date {
    font-size: 12px;
    color: var(--text-secondary);
}

.content-area {
    flex: 1;
    background: var(--bg-content);
    overflow-y: auto;
    padding: 32px 48px;
}

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

.content-area .empty-state svg {
    width: 120px;
    height: 120px;
    margin-bottom: 24px;
    opacity: 0.3;
}

.content-area h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.content-area .meta {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.markdown-body {
    max-width: 800px;
}

.markdown-body h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    font-weight: 700;
    margin: 32px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.markdown-body h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 28px 0 14px;
}

.markdown-body h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 24px 0 12px;
}

.markdown-body p {
    margin: 16px 0;
}

.markdown-body a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.markdown-body a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.markdown-body ul, .markdown-body ol {
    margin: 16px 0;
    padding-left: 24px;
}

.markdown-body li {
    margin: 8px 0;
}

.markdown-body blockquote {
    margin: 16px 0;
    padding: 16px 24px;
    border-left: 4px solid var(--accent-primary);
    background: rgba(233, 69, 96, 0.1);
    border-radius: 0 8px 8px 0;
}

.markdown-body code {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    background: var(--code-bg);
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--accent-primary);
}

.markdown-body pre {
    margin: 16px 0;
    padding: 16px;
    background: var(--code-bg);
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
    color: var(--text-primary);
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 16px 0;
}

.markdown-body video {
    max-width: 100%;
    border-radius: 8px;
    margin: 16px 0;
}

.markdown-body table {
    width: 100%;
    margin: 16px 0;
    border-collapse: collapse;
}

.markdown-body th, .markdown-body td {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.markdown-body th {
    background: var(--bg-sidebar);
    font-weight: 600;
}

.markdown-body tr:nth-child(even) {
    background: rgba(22, 33, 62, 0.5);
}

.sidebar-right {
    width: 25%;
    min-width: 220px;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    padding: 24px 16px;
    overflow-y: auto;
}

.sidebar-right h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.toc-list {
    list-style: none;
}

.toc-list li {
    margin: 8px 0;
}

.toc-list a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    display: block;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.toc-list a:hover {
    background: rgba(233, 69, 96, 0.1);
    color: var(--text-primary);
}

.toc-list a.active {
    background: rgba(233, 69, 96, 0.2);
    color: var(--accent-primary);
}

.toc-list .level-2 {
    padding-left: 24px;
}

.toc-list .level-3 {
    padding-left: 36px;
    font-size: 13px;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(22, 33, 62, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
}

.header .logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.header .nav {
    display: flex;
    gap: 16px;
}

.header .nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.header .nav a:hover {
    background: rgba(233, 69, 96, 0.1);
    color: var(--text-primary);
}

.content-area {
    margin-top: 56px;
    height: calc(100vh - 56px);
}

.sidebar-left {
    margin-top: 56px;
    height: calc(100vh - 56px);
}

.sidebar-right {
    margin-top: 56px;
    height: calc(100vh - 56px);
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.refresh-indicator {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--accent-primary);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
    display: none;
    z-index: 1000;
    transition: transform 0.2s ease;
}

.refresh-indicator:hover {
    transform: scale(1.05);
}

.refresh-indicator.show {
    display: block;
}

@media (max-width: 1199px) {
    .sidebar-right {
        display: none;
    }
}

@media (max-width: 767px) {
    .sidebar-left {
        position: fixed;
        left: -100%;
        width: 80%;
        z-index: 999;
        transition: left 0.3s ease;
    }
    
    .sidebar-left.show {
        left: 0;
    }
    
    .content-area {
        padding: 24px;
    }
    
    .header .nav a {
        padding: 8px;
    }
}

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-sidebar) 100%);
}

.login-box {
    background: var(--bg-sidebar);
    padding: 48px;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.login-box h1 {
    font-family: 'Playfair Display', serif;
    text-align: center;
    margin-bottom: 32px;
    color: var(--accent-primary);
}

.login-box .form-group {
    margin-bottom: 24px;
}

.login-box label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
}

.login-box input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-content);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
}

.login-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
}

.login-box button {
    width: 100%;
    padding: 14px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-box button:hover {
    background: #d63d56;
    transform: translateY(-2px);
}

.login-box .error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    display: none;
}

.admin-container {
    min-height: 100vh;
    padding-top: 56px;
    overflow-y: auto;
}

.admin-header {
    background: var(--bg-sidebar);
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.admin-header h1 {
    font-family: 'Playfair Display', serif;
    margin-bottom: 8px;
}

.admin-header p {
    color: var(--text-secondary);
}

.admin-content {
    padding: 24px;
    overflow-y: auto;
}

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 48px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 24px;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(233, 69, 96, 0.05);
}

.upload-zone svg {
    width: 64px;
    height: 64px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.upload-zone h3 {
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--text-secondary);
    font-size: 14px;
}

.upload-progress {
    display: none;
    margin-top: 16px;
}

.upload-progress .bar {
    height: 8px;
    background: var(--bg-content);
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress .bar-fill {
    height: 100%;
    background: var(--accent-primary);
    width: 0;
    transition: width 0.3s ease;
}

.file-manager {
    margin-top: 32px;
}

.file-manager h2 {
    font-family: 'Playfair Display', serif;
    margin-bottom: 16px;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-sidebar);
    border-radius: 8px;
    overflow: hidden;
}

.file-table th, .file-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.file-table th {
    background: var(--bg-content);
    font-weight: 600;
    color: var(--text-secondary);
}

.file-table tr:hover {
    background: rgba(233, 69, 96, 0.05);
}

.file-table .actions button {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--error);
    color: var(--error);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-table .actions button:hover {
    background: var(--error);
    color: white;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-sidebar);
    padding: 32px;
    border-radius: 16px;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    margin-bottom: 16px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal-content .buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-content button {
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-content .cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.modal-content .confirm {
    background: var(--error);
    border: none;
    color: white;
}