:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #1e293b;
    --accent: #f59e0b;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
}

body {
    background-color: var(--gray-100);
    color: var(--dark);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
    flex-direction: column;
    padding: 24px;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.logo {
    font-size: 24px;
    font-weight: 700;
}

.nav a {
    color: var(--light);
    margin-left: 24px;
    padding: 8px 16px;
}

.main-content {
    flex: 1;
    padding: 24px;
    margin-left: 300px;
    width: calc(100% - 300px);
    min-height: 100vh;
}

.footer {
    background: var(--secondary);
    padding: 20px;
    text-align: center;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-300);
    margin-top: auto;
}

.card {
    background-color: var(--light);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 20px; }
h5 { font-size: 18px; }
h6 { font-size: 16px; }

p {
    margin-bottom: 16px;
    font-size: 16px;
    color: var(--gray-600);
}

ul, ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

li {
    margin-bottom: 8px;
    color: var(--gray-600);
}

.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea,
.form-control {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    transition: border-color 0.3s ease;
    background-color: var(--gray-100);
    color: var(--dark);
}

input[type="text"]:focus,
textarea:focus,
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    margin: 8px 0;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 16px;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--light);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--gray-300);
    color: var(--dark);
}

.btn-secondary:hover {
    background-color: var(--gray-200);
}

.btn-success {
    background-color: var(--success);
    color: var(--light);
}

.btn-success:hover {
    background-color: #0c8c63;
}

.btn-danger {
    background-color: var(--danger);
    color: var(--light);
}

.btn-danger:hover {
    background-color: #c43c3c;
}

.alert {
    padding: 16px;
    margin-bottom: 24px;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background-color: #d1fae5;
    color: var(--success);
}

.alert-danger {
    background-color: #fee2e2;
    color: var(--danger);
}

.sidebar {
    width: 300px;
    background: linear-gradient(180deg, var(--secondary) 0%, var(--gray-800) 100%);
    color: white;
    height: 100vh;
    position: fixed;
    padding: 24px;
    overflow-y: auto;
    box-shadow: var(--shadow);
    z-index: 1000;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.sidebar h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: white;
}

.sidebar ul {
    list-style: none;
    margin-top: 24px;
    padding: 0;
}

.sidebar ul li {
    margin: 8px 0;
}

.sidebar ul li a {
    color: var(--gray-300);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.sidebar ul li a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition);
}

.sidebar ul li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.sidebar ul li a.active {
    background: rgba(37, 99, 235, 0.2);
    color: white;
}

.sidebar ul li a.active::before {
    opacity: 1;
}

.sidebar .search-form {
    margin: 24px 0;
    position: relative;
}

.sidebar input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transition: var(--transition);
}

.sidebar input::placeholder {
    color: var(--gray-300);
}

.sidebar input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-300);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.article-list {
    list-style: none;
    padding: 0;
}

.article-list li a {
    display: block;
    padding: 8px 0;
    color: var(--dark);
    transition: var(--transition);
}

.article-list li a:hover {
    color: var(--primary);
    transform: translateX(4px);
}

.article-meta {
    font-size: 14px;
    color: var(--gray-600);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.toolbar {
    background: var(--gray-100);
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.toolbar-group {
    display: flex;
    gap: 8px;
}

.toolbar-btn {
    padding: 8px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: var(--gray-200);
    color: var(--dark);
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background: var(--gray-300);
}

.toolbar-btn.active {
    background: var(--primary);
    color: white;
}

.font-select, .size-select, .color-picker {
    padding: 8px;
    margin: 8px 0;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: var(--gray-100);
    color: var(--dark);
}

.video-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    box-shadow: var(--shadow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 8px;
    margin-top: 8px;
}

.video-menu button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--dark);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease;
}

.video-menu button:hover {
    background: var(--gray-200);
}

.rich-editor {
    flex-grow: 1;
    padding: 24px;
    outline: none;
    min-height: 400px;
    font-size: 16px;
    line-height: 1.8;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}

.rich-editor:focus {
    outline: none;
    border-color: var(--primary);
}

.rich-editor h1 {
    font-size: 2.5rem;
    color: var(--dark);
    margin-bottom: 24px;
    font-weight: 700;
}

.rich-editor h2 {
    font-size: 2rem;
    color: var(--dark);
    margin: 24px 0 16px;
}

.rich-editor h3 {
    font-size: 1.5rem;
    color: var(--dark);
    margin: 24px 0 16px;
}

.rich-editor p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--gray-600);
}

.rich-editor pre {
    background-color: var(--gray-100);
    border-left: 4px solid var(--primary);
    padding: 16px;
    overflow-x: auto;
    border-radius: 8px;
    position: relative;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    margin-bottom: 24px;
}

.rich-editor code {
    white-space: pre-wrap;
    word-break: break-all;
    display: block;
}

.code-wrapper {
    position: relative;
    display: block;
    margin: 16px 0;
}

.code-block {
    margin: 0;
    padding: 24px;
    font-size: 14px;
    background-color: var(--secondary);
    color: white;
    border-radius: 8px;
    position: relative;
    overflow-x: auto;
    padding-top: 48px;
}

.code-block::-webkit-scrollbar {
    height: 8px;
}

.code-block::-webkit-scrollbar-thumb {
    background: var(--gray-600);
    border-radius: 4px;
}

.code-block::-webkit-scrollbar-track {
    background: var(--gray-800);
}

.copy-btn,
.download-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: var(--gray-700);
    color: var(--gray-300);
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease;
    z-index: 20;
}

.copy-btn:hover,
.download-btn:hover {
    background-color: var(--gray-600);
}

.download-btn {
    right: 48px;
}

.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    z-index: 999;
    padding: 20px;
}

.fullscreen-overlay .rich-editor {
    width: 100%;
    height: calc(100vh - 150px);
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

.code-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.code-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.code-dialog h3 {
    margin: 0 0 16px;
    color: var(--dark);
}

.notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: var(--shadow);
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background-color: var(--success);
}

.notification.error {
    background-color: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.editor-fullscreen .rich-editor {
    width: 100%;
    min-height: calc(100vh - 100px);
    border: none;
    box-shadow: none;
}

.editor-fullscreen .toolbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1001;
    border-radius: 0;
    padding: 16px;
}

.editor-fullscreen body {
    padding: 0;
    margin: 0;
    overflow: hidden;
    background-color: white;
}

@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 12px;
    }

    body {
        padding: 12px;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .header {
        padding: 20px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-group {
        justify-content: center;
    }

    .article-meta {
        flex-direction: column;
        gap: 8px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    .rich-editor {
        padding: 12px;
        font-size: 14px;
    }

    .code-block {
        padding: 12px;
        font-size: 12px;
    }

    .copy-btn,
    .download-btn {
        padding: 4px;
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .download-btn {
        right: 48px;
    }

    .code-dialog {
        width: 90%;
        padding: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}