:root {
    --primary: #3498db;
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #e67e22;
    --dark: #2c3e50;
    --gray: #f8f9fa;
    --border: #ddd;
    --text: #333;
    --text-light: #666;
    --radius: 4px;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --transition: all 0.2s;
}

*{box-sizing:border-box}
body{font:1rem/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;margin:0;padding:0;background:#f5f5f5;color:var(--text);min-width:1200px;overflow-x:auto}
.table{width:100%}

/* Layout */
.container{max-width:1600px;min-width:1200px;margin:2rem auto;padding:0 2rem;display:flex;gap:2rem}
.sidebar{width:300px;flex-shrink:0}
.main-content{flex-grow:1;min-width:0}
.card{background:#fff;border-radius:var(--radius);padding:2rem;box-shadow:var(--shadow);margin-bottom:2rem;height:fit-content;width:100%}

/* Header */
.header{background:#fff;box-shadow:var(--shadow);margin-bottom:2rem}
.admin-logo{color:#fff;font-size:1rem;font-weight:700;display:flex;align-items:center;padding-left:50px;position:relative;height:52px}
.admin-nav{
    display:flex;
    justify-content:space-between;
    align-items:center;
    padding:.75rem 2rem;
    background:var(--dark) url('../static/logo.webp') no-repeat top left;
    background-size:100px;
    border-bottom:1px solid rgba(255,255,255,0.1);
    box-shadow:0 1px 3px rgba(0,0,0,0.1);
}
.nav-group{display:flex;align-items:center;gap:1rem}
.site-selector{
    min-width:200px;
    background:rgba(255,255,255,0.1);
    border:1px solid rgba(255,255,255,0.2);
    color:#fff;
    padding:.5rem;
    border-radius:var(--radius);
}
.site-selector option{
    background:var(--dark);
    color:#fff;
}
.nav-links{display:flex;gap:.5rem}
.nav-links a{
    padding:.5rem 1rem;
    color:rgba(255,255,255,0.8);
    text-decoration:none;
    border-radius:var(--radius);
    transition:var(--transition);
    font-weight:500;
}
.nav-links a:hover{
    background:rgba(255,255,255,0.1);
    color:#fff;
}
.nav-links a.active{
    background:var(--primary);
    color:#fff;
}
.nav-links a i{margin-right:.5rem}
.logout{
    padding:.5rem 1rem;
    color:rgba(255,255,255,0.8);
    text-decoration:none;
    border-radius:var(--radius);
    transition:var(--transition);
    border:1px solid rgba(255,255,255,0.2);
}
.logout:hover{
    background:var(--danger);
    color:#fff;
    border-color:transparent;
}

/* Forms */
input[type="text"],input[type="password"],input[type="number"],input[type="url"],textarea,select{width:100%;padding:.5rem;margin:.5rem 0;border:1px solid var(--border);border-radius:var(--radius);font-size:1rem}
input[type="submit"],.button{background:var(--primary);color:#fff;border:0;padding:.7rem 1.5rem;border-radius:var(--radius);cursor:pointer;font-size:1rem;text-decoration:none;display:inline-block}

/* Editor */
.editor-toolbar{background:var(--gray);border:1px solid var(--border);border-bottom:0;border-radius:var(--radius) var(--radius) 0 0;padding:.5rem;display:flex;gap:.5rem;flex-wrap:wrap}
.toolbar-btn{background:0;border:1px solid transparent;padding:.5rem;border-radius:var(--radius);cursor:pointer;color:var(--text-light);transition:var(--transition);display:flex;align-items:center;justify-content:center;min-width:32px;height:32px}
.toolbar-btn:hover{background:var(--gray);color:var(--primary);border-color:var(--border)}
.toolbar-btn i{font-size:1rem}
.code-editor{font:14px/1.5 "SFMono-Regular",Consolas,"Liberation Mono",Menlo,monospace;tab-size:4}

/* Tree List */
.tree-list p{margin:.2rem 0;padding:.5rem;border-radius:var(--radius);display:flex;justify-content:space-between;align-items:center;transition:var(--transition);position:relative}
.tree-list p:hover{background:var(--gray)}
.tree-list .page-title{flex-grow:1;padding-right:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tree-list .action-buttons{display:none;gap:.5rem;position:absolute;right:.5rem;top:50%;transform:translateY(-50%);background:inherit;padding:0 .5rem}
.tree-list p:hover .action-buttons{display:flex}
.tree-list .action-buttons a{color:var(--text-light);text-decoration:none;padding:.3rem;border-radius:var(--radius);transition:var(--transition)}
.tree-list .edit-btn:hover{color:var(--primary)}
.tree-list .view-btn:hover{color:var(--success)}
.tree-list .add-btn:hover{color:var(--warning)}
.tree-list .delete-btn:hover{color:var(--danger)}

/* Page Info */
.page-info{flex-grow:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:30px}
.page-info a{max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;color:var(--text);text-decoration:none}
.page-info a:hover{color:var(--primary)}
.page-info small{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}
.page-actions{position:absolute;right:8px;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:8px;background:var(--gray);padding:4px;border-radius:var(--radius);box-shadow:var(--shadow)}

/* File Manager */
.upload-form{margin-bottom:1rem;padding:1rem;background:var(--gray);border-radius:var(--radius)}
.form-info{margin-top:.5rem;font-size:.9rem;color:var(--text-light)}
.files-list table{width:100%;border-collapse:collapse}
.files-list th,.files-list td{padding:.75rem;border-bottom:1px solid var(--border)}
.files-list th{text-align:left;background:var(--gray);font-weight:500}
.files-list td input[readonly]{width:100%;padding:.3rem;border:1px solid var(--border);border-radius:var(--radius);font-size:.9rem;background:var(--gray);cursor:pointer}
.files-list td input[readonly]:hover{background:#fff;border-color:var(--primary)}
.files-list td a{color:var(--text-light);margin-right:.5rem;text-decoration:none}
.files-list td a:hover{color:var(--primary)}
.files-list .delete-btn:hover{color:var(--danger)}

/* 文件预览列样式 */
.thumbnail{width:60px;height:60px;border-radius:var(--radius);overflow:hidden;border:1px solid var(--border);background:#fff;display:flex;align-items:center;justify-content:center}
.thumbnail img{max-width:100%;max-height:100%;object-fit:cover}
.file-icon{width:60px;height:60px;display:flex;align-items:center;justify-content:center;background:var(--gray);border-radius:var(--radius);border:1px solid var(--border)}
.file-icon i{font-size:24px;color:var(--text-light)}
.file-icon .fa-file-pdf{color:var(--danger)}
.file-icon .fa-file-alt{color:var(--text-light)}

/* 文件列表列宽 */
.files-list th:nth-child(1),.files-list td:nth-child(1){width:30%}
.files-list th:nth-child(2),.files-list td:nth-child(2){width:80px;text-align:center}
.files-list th:nth-child(3),.files-list td:nth-child(3){width:100px}
.files-list th:nth-child(4),.files-list td:nth-child(4){width:150px}
.files-list th:nth-child(5),.files-list td:nth-child(5){width:120px;text-align:center}

/* Alert 样式扩展 */
.alert{display:flex;align-items:center;gap:.5rem}
.alert-success{background:#d4edda;color:#155724;border:1px solid #c3e6cb}
.alert-danger{background:#f8d7da;color:#721c24;border:1px solid #f5c6cb}
.alert i{font-size:1.1rem}

/* Modal */
.modal{display:none;position:fixed;z-index:1000;left:0;top:0;width:100%;height:100%;background-color:rgba(0,0,0,.5);backdrop-filter:blur(5px);transition:var(--transition)}
.modal.active{opacity:1;visibility:visible;display:flex!important;align-items:center;justify-content:center}
.modal-content{background:#fff;margin:auto;padding:2rem;border-radius:var(--radius);box-shadow:0 4px 20px rgba(0,0,0,.15);position:relative;width:90%;max-width:1000px;max-height:90vh;overflow:auto;transform:translateY(-20px);transition:var(--transition)}
.modal.active .modal-content{transform:translateY(0)}
.close{position:absolute;right:1.5rem;top:1rem;color:#aaa;font-size:1.8rem;font-weight:700;cursor:pointer;transition:var(--transition);line-height:1}
.close:hover{color:var(--text)}

/* Preview */
.preview-content{display:flex;justify-content:center;align-items:center;min-height:200px;max-height:calc(90vh - 100px);overflow:auto;padding:1rem}
.preview-content img{max-width:100%;max-height:70vh;object-fit:contain;border-radius:var(--radius);box-shadow:var(--shadow)}
.preview-content embed{width:100%;height:70vh;border:0}
.preview-content pre{width:100%;background:var(--gray);padding:1rem;border-radius:var(--radius);font:14px/1.5 Monaco,Consolas,monospace;overflow:auto;color:var(--text);border:1px solid var(--border);white-space:pre-wrap}

/* Animations */
@keyframes slideIn{from{transform:translateX(100%);opacity:0}to{transform:translateX(0);opacity:1}}
@keyframes fadeOut{to{opacity:0;visibility:hidden}}
@keyframes modalFadeIn{from{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}

/* Responsive */
@media(max-width:1200px){
    .container{min-width:100%;padding:0 1rem;flex-direction:column}
    .sidebar{width:100%}
}
@media(max-width:768px){
    .header{padding:1rem}
    .nav-links{margin:0 1rem}
    .nav-links a{padding:.4rem .8rem;font-size:.9rem}
    .admin-logo{padding-left:42px;height:32px}
    .admin-logo::before{width:32px;height:32px}
    .admin-logo span{display:none}
}

/* Page Manager */
.page-item{display:flex;align-items:center;justify-content:space-between;padding:8px;border-radius:var(--radius);margin:4px 0;transition:var(--transition);position:relative}
.page-item:hover{background:var(--gray)}
.page-info{flex-grow:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-right:30px}
.page-info a{max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle;color:var(--text);text-decoration:none}
.page-info a:hover{color:var(--primary)}
.page-info small{max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;vertical-align:middle}
.page-actions{position:absolute;right:8px;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:8px;background:var(--gray);padding:4px;border-radius:var(--radius);box-shadow:var(--shadow)}
.order-info{background:#eee;padding:2px 6px;border-radius:3px;font-size:12px;color:var(--text-light)}
.action-buttons{display:none;gap:4px}
.page-item:hover .action-buttons{display:flex}
.action-btn{padding:4px 8px;color:var(--text-light);border-radius:var(--radius);transition:var(--transition);background:#fff}
.action-btn:hover{background:#e0e0e0;color:var(--text)}
.action-btn i{font-size:14px}
.text-muted{color:var(--text-light);font-size:.875em}
.toggle-children{cursor:pointer;display:inline-block;width:20px;text-align:center;color:var(--text-light)}
.toggle-children:hover{color:var(--primary)}
.toggle-children i{transition:var(--transition)}
.children-container{margin-left:20px;border-left:1px dashed var(--border);padding-left:10px}

/* Tree List Animations */
.fa-caret-down,.fa-caret-right{transform:rotate(0deg)}

/* Sites Manager */
.current-site-badge{display:inline-block;padding:2px 8px;background:var(--success);color:#fff;border-radius:12px;font-size:12px}
.current-site-badge i{margin-right:4px}
.table tr.active{background:#e8f5e9}
.action-btn.load-site{color:var(--success)}
.action-btn.load-site:hover{color:#388e3c}
.action-btn.load-site.disabled{color:#999;cursor:default}
.action-btn.load-site.disabled:hover{color:#999}

/* Links Manager */
.list-item{display:flex;align-items:center;justify-content:space-between;padding:.5rem;border-radius:var(--radius);margin:2px 0;transition:var(--transition)}
.list-item:hover{background:var(--gray)}
.list-item.active{background:var(--gray)}
.list-item .page-link{display:flex;align-items:center;color:var(--text);text-decoration:none}
.list-item .page-link i{margin-right:.5rem;color:var(--text-light)}
.list-item .item-count{margin-left:.5rem;color:var(--text-light);font-size:.9em}
.list-item .action-buttons{visibility:hidden}
.list-item:hover .action-buttons{visibility:visible}

/* Form Row */
.form-row{display:flex;gap:1rem;margin-bottom:1rem}
.form-row .form-group{flex:1}
.form-row .col-md-6{flex:0 0 50%;max-width:50%}

/* Code Editor */
.code-editor{font-family:monospace;font-size:14px;line-height:1.5;tab-size:4;background:var(--gray);padding:1rem;border-radius:var(--radius);border:1px solid var(--border)}
.code-editor:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 2px rgba(52,152,219,.2)}

/* Form Text */
.form-text{font-size:.875em;color:var(--text-light);margin-top:.25rem}
.form-text br{margin-bottom:.25rem}

/* Title Actions */
.title-actions{display:flex;gap:.5rem}
.title-actions .btn{display:flex;align-items:center;gap:.5rem}
.title-actions .btn i{font-size:1rem}

/* 用户管理样式 */
.card {
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.card-body {
    padding: 15px;
}

.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    background: #f8f9fa;
    font-weight: 500;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0,0,0,.05);
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: .375rem .75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: .25rem;
    transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;
    cursor: pointer;
}

.btn-sm {
    padding: .25rem .5rem;
    font-size: .875rem;
    line-height: 1.5;
    border-radius: .2rem;
}

.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

.btn-info {
    color: #fff;
    background-color: #17a2b8;
    border-color: #17a2b8;
}

.btn-info:hover {
    background-color: #138496;
    border-color: #117a8b;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: inline-block;
    margin-bottom: .5rem;
    font-weight: 500;
}

.form-control {
    display: block;
    width: 100%;
    height: calc(1.5em + .75rem + 2px);
    padding: .375rem .75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: .25rem;
    transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.form-text {
    display: block;
    margin-top: .25rem;
    font-size: .875rem;
    color: #6c757d;
}

/* 模态框样式 */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    gap: .5rem;
}

.close {
    float: right;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #fff;
    opacity: .5;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.close:hover {
    opacity: .75;
}

/* 工具类 */
.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-0 {
    margin-bottom: 0;
}

.d-flex {
    display: flex;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}