/* =========================================
   JoplinClipperServer v2 - 管理后台样式
   ========================================= */

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: #f0f2f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}
a { color: #1890ff; text-decoration: none; }
a:hover { color: #40a9ff; }
code { background: #f5f5f5; padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }
pre { background: #282c34; color: #abb2bf; padding: 1rem; border-radius: 6px; overflow-x: auto; font-size: 0.85rem; }

/* === Layout === */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 240px;
    background: #001529;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand h2 { font-size: 1.2rem; font-weight: 600; }
.sidebar-brand .version { font-size: 0.75rem; color: rgba(255,255,255,0.4); }
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0;
}
.sidebar-footer { border-top: 1px solid rgba(255,255,255,0.1); padding: 0.75rem 0; }
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.7rem 1.5rem;
    color: rgba(255,255,255,0.65);
    transition: all 0.2s;
    font-size: 0.95rem;
    gap: 0.5rem;
}
.nav-item:hover, .nav-item.active {
    color: #fff;
    background: #1890ff;
    text-decoration: none;
}
.nav-item .nav-icon { font-size: 1.1rem; width: 1.5rem; text-align: center; }
.nav-danger { color: rgba(255,100,100,0.6); }
.nav-danger:hover { background: #ff4d4f; color: #fff; }

/* Main Content */
.main-content {
    margin-left: 240px;
    flex: 1;
    min-width: 0;
}

/* Topbar */
.topbar {
    background: #fff;
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 0.5rem; }
.user-info { font-size: 0.9rem; color: #666; }
.current-time { font-size: 0.85rem; color: #999; }

/* Content area */
.content { padding: 1.5rem; }

/* === Components === */

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 600; color: #1a1a1a; }

/* Card */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 1rem;
    overflow: hidden;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
}
.card-header h2 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.card-body.no-padding { padding: 0; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    text-align: center;
}
.stat-value { font-size: 2rem; font-weight: 700; color: #1890ff; line-height: 1.2; }
.stat-label { font-size: 0.85rem; color: #999; margin-top: 0.25rem; }
.stat-success .stat-value { color: #52c41a; }
.stat-danger .stat-value { color: #ff4d4f; }
.stat-warning .stat-value { color: #faad14; }

/* 2-Col Grid */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .grid-2col { grid-template-columns: 1fr; } }

/* Table */
.table { width: 100%; border-collapse: collapse; }
.table th {
    background: #fafafa;
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}
.table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.9rem;
}
.table tbody tr:hover { background: #fafafa; }
.table td.actions { white-space: nowrap; display: flex; gap: 0.3rem; }

/* Info Table */
.info-table { width: 100%; }
.info-table td { padding: 0.5rem 0; }
.info-table .info-label { font-weight: 600; color: #666; width: 120px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.45rem 1rem;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    text-decoration: none;
    transition: all 0.2s;
    line-height: 1.5;
    text-align: center;
}
.btn:hover { color: #1890ff; border-color: #1890ff; text-decoration: none; }
.btn-primary { background: #1890ff; color: #fff; border-color: #1890ff; }
.btn-primary:hover { background: #40a9ff; border-color: #40a9ff; color: #fff; }
.btn-danger { color: #ff4d4f; border-color: #ff4d4f; }
.btn-danger:hover { background: #ff4d4f; color: #fff; }
.btn-warning { color: #faad14; border-color: #faad14; }
.btn-warning:hover { background: #faad14; color: #fff; }
.btn-success { color: #52c41a; border-color: #52c41a; }
.btn-success:hover { background: #52c41a; color: #fff; }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; }

/* Badge */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-secondary { background: #f0f0f0; color: #666; }
.badge-info { background: #e6f7ff; color: #1890ff; }
.badge-success { background: #f6ffed; color: #52c41a; }
.badge-danger { background: #fff2f0; color: #ff4d4f; }
.badge-warning { background: #fffbe6; color: #faad14; }
.badge-admin { background: #fff7e6; color: #fa8c16; }

/* Form */
.form { max-width: 560px; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-weight: 500; font-size: 0.9rem; }
.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
    font-family: inherit;
}
.form-input:focus { outline: none; border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.2); }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; }

/* Filter Bar */
.filter-bar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-chip {
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #d9d9d9;
    font-size: 0.85rem;
    color: #666;
    text-decoration: none;
    transition: all 0.2s;
}
.filter-chip:hover { border-color: #1890ff; color: #1890ff; text-decoration: none; }
.filter-chip.active { background: #1890ff; color: #fff; border-color: #1890ff; }
.filter-count { margin-left: auto; font-size: 0.85rem; color: #999; }

/* Pagination */
.pagination { display: flex; gap: 0.3rem; justify-content: center; margin-top: 1rem; }
.page-link {
    padding: 0.35rem 0.7rem;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 0.85rem;
    text-decoration: none;
    color: #666;
}
.page-link:hover { border-color: #1890ff; color: #1890ff; text-decoration: none; }
.page-link.active { background: #1890ff; color: #fff; border-color: #1890ff; }

/* Flash Messages */
.flash-container { margin-bottom: 1rem; }
.flash {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    transition: opacity 0.3s;
}
.flash-success { background: #f6ffed; border: 1px solid #b7eb8f; color: #52c41a; }
.flash-danger { background: #fff2f0; border: 1px solid #ffccc7; color: #ff4d4f; }
.flash-warning { background: #fffbe6; border: 1px solid #ffe58f; color: #faad14; }
.flash-info { background: #e6f7ff; border: 1px solid #91d5ff; color: #1890ff; }

/* Empty state */
.empty { padding: 3rem; text-align: center; color: #999; font-size: 0.95rem; }

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header h1 { font-size: 1.5rem; color: #1a1a1a; }
.login-header p { color: #999; font-size: 0.9rem; margin-top: 0.25rem; }
.login-form .form-group { margin-bottom: 1.25rem; }
.login-form label { font-weight: 500; }
.login-form .btn { padding: 0.65rem; font-size: 1rem; margin-top: 0.5rem; }

/* Markdown Preview */
.markdown-preview {
    max-height: 500px;
    overflow-y: auto;
    background: #fafafa;
    padding: 1rem;
    border-radius: 6px;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Code block */
.code-block { background: #282c34; color: #abb2bf; padding: 1rem; border-radius: 6px; font-size: 0.85rem; overflow-x: auto; }

/* Helpers */
.text-sm { font-size: 0.85rem; }
.text-muted { color: #999; }
.text-danger { color: #ff4d4f; }
.mt-sm { margin-top: 0.5rem; }

/* Responsive */
@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .main-content { margin-left: 200px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .table th, .table td { padding: 0.4rem 0.5rem; font-size: 0.8rem; }
}
@media (max-width: 576px) {
    .sidebar { width: 60px; overflow: hidden; }
    .sidebar-brand h2, .sidebar-brand .version,
    .nav-item { font-size: 0; padding: 0.75rem; justify-content: center; }
    .nav-item .nav-icon { font-size: 1.3rem; }
    .main-content { margin-left: 60px; }
    .content { padding: 1rem; }
    .page-header { flex-direction: column; gap: 0.5rem; }
}
