/* ============================================================
   卫星数字化技术重点实验室 - 后台管理样式
   使用 CSS 变量统一主题
   ============================================================ */
:root {
    /* 主色调 */
    --bg-deep: #0a1128;
    --bg-card: rgba(10, 17, 40, 0.5);
    --bg-card-solid: rgba(10, 17, 40, 0.95);
    --bg-input: rgba(255, 255, 255, 0.1);
    --bg-input-focus: rgba(255, 255, 255, 0.15);
    --bg-hover: rgba(0, 170, 255, 0.05);

    --accent: #00aaff;
    --accent-hover: #33bbff;
    --accent-bg: rgba(0, 170, 255, 0.1);
    --accent-bg-strong: rgba(0, 170, 255, 0.2);
    --accent-border: rgba(0, 170, 255, 0.3);
    --accent-border-soft: rgba(0, 170, 255, 0.2);

    --danger: #ff6b6b;
    --danger-bg: rgba(255, 107, 107, 0.1);
    --danger-border: rgba(255, 107, 107, 0.3);

    --warning: #ffc107;
    --warning-bg: rgba(255, 193, 7, 0.2);
    --warning-border: rgba(255, 193, 7, 0.3);

    --success: #4cd964;

    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --text-dim: #666666;

    --border-radius: 4px;
    --border-radius-lg: 8px;
    --transition: all 0.3s ease;

    --header-height: 70px;
    --container-max: 1400px;
}

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

body {
    font-family: "Futura Medium", Arial, sans-serif;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    background-image: radial-gradient(circle at 100% 100%, rgba(10, 17, 40, 0) 0%, rgba(10, 17, 40, 0.8) 100%),
                      url('data:image/svg+xml,%3Csvg width="100" height="100" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2" fill="%23ffffff" fill-opacity="0.05" fill-rule="evenodd"/%3E%3C/svg%3E');
    min-height: 100vh;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.admin-header {
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 17, 40, 0.95);
    border-bottom: 1px solid var(--accent-border);
    backdrop-filter: blur(8px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    color: var(--text-primary);
    text-decoration: none;
}

.logo img {
    height: 40px;
    margin-right: 15px;
}

.logo-text .main {
    font-weight: bold;
    font-size: 16px;
    color: var(--text-primary);
    display: block;
}

.logo-text span {
    font-size: 12px;
    color: var(--accent);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-actions a,
.nav-actions button {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 16px;
    border: 1px solid var(--accent-border);
    border-radius: var(--border-radius);
    background: var(--accent-bg);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.nav-actions a:hover,
.nav-actions button:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-bg-strong);
}

/* Main Layout */
.admin-main {
    padding-top: 100px;
    min-height: 100vh;
    padding-bottom: 60px;
}

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--accent-border-soft);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    margin-bottom: 30px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header-actions {
    display: flex;
    gap: 10px;
}

.page-title {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 30px;
}

/* Login Page */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(10, 17, 40, 0.7);
    border: 1px solid var(--accent-border);
    border-radius: var(--border-radius-lg);
    padding: 40px;
}

.login-title {
    text-align: center;
    font-size: 22px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--accent);
    margin-bottom: 30px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--accent-border);
    border-radius: var(--border-radius);
    padding: 12px 15px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-input-focus);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

.input-with-action {
    position: relative;
}

.input-with-action .form-control {
    padding-right: 44px;
}

.toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
}

.meta-line {
    text-align: right;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.text-muted { color: var(--text-muted); }
.error-text { color: var(--danger) !important; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: bold;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-deep);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

.btn-outline:hover {
    background: var(--accent-bg);
}

.btn-outline:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger-bg);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

/* Statistics cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--accent-border-soft);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--accent);
    line-height: 1.2;
}

.stat-value.stat-published { color: var(--accent); }
.stat-value.stat-draft { color: var(--warning); }
.stat-value.stat-views { color: var(--success); }

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 5px;
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 220px;
}

.filter-select {
    width: auto;
    min-width: 130px;
    cursor: pointer;
}

/* Batch bar */
.batch-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--accent-bg);
    border: 1px solid var(--accent-border);
    border-radius: var(--border-radius);
    align-items: center;
    flex-wrap: wrap;
}

.batch-bar span {
    color: var(--text-primary);
    font-size: 14px;
}

.batch-bar strong {
    color: var(--accent);
    margin: 0 4px;
}

/* News table */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.news-table {
    width: 100%;
    border-collapse: collapse;
}

.news-table th,
.news-table td {
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid var(--accent-border-soft);
    font-size: 14px;
    vertical-align: middle;
}

.news-table th {
    color: var(--accent);
    font-weight: bold;
    background: var(--bg-hover);
    white-space: nowrap;
}

.news-table td {
    color: var(--text-primary);
}

.news-table tr:hover td {
    background: var(--bg-hover);
}

.row-cover {
    width: 60px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--border-radius);
    border: 1px solid var(--accent-border-soft);
}

.row-cover-placeholder {
    width: 60px;
    height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--accent-border-soft);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 12px;
}

.row-title a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: bold;
}

.row-title a:hover {
    color: var(--accent);
}

.row-summary {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 4px;
    line-height: 1.4;
}

.row-meta {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--border-radius);
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.status-published {
    background: var(--accent-bg-strong);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.status-draft {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.category-chip,
.tag-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--accent-border-soft);
    white-space: nowrap;
}

.tag-chip {
    background: var(--accent-bg);
    color: var(--accent);
}

.actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    background: var(--bg-card);
    border: 1px solid var(--accent-border-soft);
    color: var(--text-primary);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-size: 14px;
}

.page-btn:hover:not(:disabled):not(.active) {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}

.page-btn.active {
    background: var(--accent);
    color: var(--bg-deep);
    border-color: var(--accent);
    font-weight: bold;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    color: var(--text-muted);
    font-size: 13px;
    margin-left: 15px;
}

/* Editor */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
}

.editor-main { min-width: 0; }
.editor-sidebar { min-width: 0; }

.form-section {
    margin-bottom: 25px;
}

.form-section-title {
    font-size: 16px;
    color: var(--accent);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--accent-border-soft);
}

/* Image upload */
.image-upload {
    border: 2px dashed var(--accent-border);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.image-upload:hover,
.image-upload.drag-over {
    border-color: var(--accent);
    background: var(--accent-bg);
}

.upload-icon {
    color: var(--accent);
    font-size: 24px;
    margin-bottom: 10px;
}

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

.upload-tip {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 5px;
}

.image-preview {
    margin-top: 15px;
    border-radius: var(--border-radius);
    overflow: hidden;
    max-height: 200px;
    border: 1px solid var(--accent-border-soft);
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* Quill editor */
.rich-editor {
    background: var(--bg-input);
    border: 1px solid var(--accent-border);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    color: var(--text-primary);
}

.ql-toolbar.ql-snow {
    background: var(--bg-hover);
    border: 1px solid var(--accent-border);
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.ql-container.ql-snow {
    border: 1px solid var(--accent-border);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    min-height: 400px;
    font-family: inherit;
    font-size: 14px;
}

.ql-editor {
    min-height: 400px;
    color: var(--text-primary);
    line-height: 1.8;
}

.ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: normal;
}

.ql-editor p { margin-bottom: 15px; }
.ql-editor h1, .ql-editor h2, .ql-editor h3 {
    color: var(--accent);
    margin: 25px 0 15px;
}
.ql-editor strong { color: var(--accent); }

.ql-snow .ql-stroke { stroke: var(--text-secondary) !important; }
.ql-snow .ql-fill { fill: var(--text-secondary) !important; }
.ql-snow .ql-picker-label { color: var(--text-secondary) !important; }
.ql-snow .ql-picker-options {
    background: var(--bg-card-solid);
    border-color: var(--accent-border);
}

.ql-toolbar.ql-snow button:hover .ql-stroke,
.ql-toolbar.ql-snow button.ql-active .ql-stroke {
    stroke: var(--accent) !important;
}

.ql-toolbar.ql-snow button:hover .ql-fill,
.ql-toolbar.ql-snow button.ql-active .ql-fill {
    fill: var(--accent) !important;
}

.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label {
    color: var(--accent) !important;
}

/* Editor meta bar */
.editor-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.autosave-status {
    color: var(--text-muted);
    font-size: 12px;
}

.autosave-status.saved {
    color: var(--success);
}

.editor-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--accent-border-soft);
}

/* Toast */
.toast {
    position: fixed;
    top: 90px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 14px;
    z-index: 9999;
    transform: translateX(150%);
    transition: transform 0.3s ease;
    max-width: 350px;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    background: rgba(0, 170, 255, 0.9);
    border: 1px solid var(--accent);
}

.toast-error {
    background: rgba(255, 107, 107, 0.9);
    border: 1px solid var(--danger);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card-solid);
    border: 1px solid var(--accent-border);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content-wide {
    max-width: 900px;
    width: 95%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--accent-border-soft);
}

.modal-title {
    font-size: 18px;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0 8px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-text {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 14px;
    line-height: 1.6;
}

.modal-detail {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
    white-space: pre-wrap;
    word-break: break-all;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

/* Preview */
.preview-container {
    color: var(--text-primary);
    line-height: 1.8;
    max-height: 70vh;
    overflow-y: auto;
    padding: 5px;
}

.preview-title {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.preview-meta {
    color: var(--accent);
    font-size: 13px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--accent-border-soft);
}

.preview-cover img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: var(--border-radius-lg);
    margin-bottom: 20px;
}

.preview-summary {
    background: var(--bg-hover);
    padding: 15px;
    border-left: 3px solid var(--accent);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.preview-content p { margin-bottom: 15px; }
.preview-content h1, .preview-content h2, .preview-content h3 {
    color: var(--accent);
    margin: 25px 0 15px;
}
.preview-content img { max-width: 100%; border-radius: var(--border-radius); }
.preview-content a { color: var(--accent); }
.preview-content strong { color: var(--accent); }
.preview-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 15px;
    margin: 15px 0;
    color: var(--text-secondary);
}
.preview-content pre {
    background: var(--bg-input);
    padding: 12px;
    border-radius: var(--border-radius);
    overflow-x: auto;
}

/* Source code textarea */
.source-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--accent-border);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    padding: 15px;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
}

.source-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* Password strength */
.password-strength {
    margin-top: 10px;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0;
    transition: width 0.3s ease, background 0.3s ease;
}

.strength-fill.weak { background: var(--danger); }
.strength-fill.medium { background: var(--warning); }
.strength-fill.strong { background: var(--success); }

.strength-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
}

.match-hint {
    font-size: 12px;
    margin-top: 5px;
}

.match-hint.match-ok { color: var(--success); }
.match-hint.match-fail { color: var(--danger); }

/* Responsive */
@media (max-width: 992px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }

    .news-table {
        display: block;
        overflow-x: auto;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-main {
        padding-top: 90px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .logo-text .main {
        font-size: 14px;
    }

    .toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        width: 100%;
    }
}
