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

:root {
    --sidebar-bg: #151570;
    --sidebar-hover: #16213e;
    --sidebar-active: #0f3460;
    --primary: #e94560;
    --secondary: #533483;
    --text-light: #eee;
    --text-muted: #a0a0b0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f5f5f5;
}

/* Admin Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0,0,0,0.3);
}

.sidebar-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    text-align: center;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 1px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: var(--text-light);
    border-left-color: var(--primary);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: var(--text-light);
    border-left-color: var(--primary);
}

.nav-item .icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
}

.nav-item span:last-child {
    font-size: 0.9rem;
}

.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.top-bar {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h1 {
    font-size: 1.25rem;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    color: #666;
    font-size: 0.9rem;
}

.content {
    padding: 2rem;
    flex: 1;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(233,69,96,0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(83,52,131,0.15) 0%, transparent 70%);
    bottom: -50px;
    left: -50px;
    border-radius: 50%;
}

.login-card {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
    padding: 3rem;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-light);
    font-size: 1.75rem;
    font-weight: 600;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999 !important;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: #fff;
    padding: 2rem;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: slideUp 0.3s ease;
    display: block;
}

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

/* Dashboard Stats */
.stat-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(233,69,96,0.1) 0%, rgba(83,52,131,0.1) 100%);
}

/* Tag Selector */
.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-checkbox {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: #e8e8e8;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    border: 1px solid transparent;
}

.tag-checkbox:hover {
    background: #d8d8d8;
    border-color: var(--primary);
}

.tag-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* Tag Card */
.tag-card {
    transition: all 0.3s;
}

.tag-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* Content Editor */
.content-editor {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    padding: 1rem;
}

.cover-upload-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.cover-preview {
    width: 300px;
    height: 180px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    background: #f8f9fa;
    transition: border-color 0.2s;
}

.cover-preview:hover {
    border-color: #0d6efd;
}

.cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    gap: 8px;
}

.cover-icon {
    font-size: 32px;
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s;
}

.cover-preview:hover .cover-overlay {
    opacity: 1;
}

.EasyMDEContainer {
    border-radius: 8px;
    overflow: hidden;
}

.EasyMDEContainer .CodeMirror {
    min-height: 500px;
    border-radius: 0;
}

.EasyMDEContainer .editor-toolbar {
    border: none;
    background: #f1f3f5;
    padding: 8px;
}

.EasyMDEContainer .CodeMirror-code {
    font-size: 15px;
    line-height: 1.6;
}

.EasyMDEContainer .editor-preview {
    padding: 20px;
}

.EasyMDEContainer .editor-preview img {
    max-width: 100%;
}

.EasyMDEContainer .editor-preview table {
    border-collapse: collapse;
}

.EasyMDEContainer .editor-preview th,
.EasyMDEContainer .editor-preview td {
    border: 1px solid #dee2e6;
    padding: 8px;
}

.comment-content {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Blazor Error UI */
#blazor-error-ui {
    background: #dc3545;
    color: #fff;
    padding: 1rem 2rem;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

#blazor-error-ui a.reload {
    color: #fff;
    text-decoration: underline;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .sidebar-header h2,
    .nav-item span:last-child {
        display: none;
    }
    
    .nav-item {
        justify-content: center;
        padding: 1rem;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .content {
        padding: 1rem;
    }
}
