/* 后台样式：与前台同一套 Metro 设计语言 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(135deg, #001e3c 0%, #000a18 100%);
  color: #ffffff;
  min-height: 100vh;
}

/* ---------- 通用控件 ---------- */
.btn {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 10px 24px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.1s;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-primary {
  background: #0078d7;
  border-color: #0078d7;
}

.btn-primary:hover {
  background: #1a88e0;
  border-color: #1a88e0;
}

.btn-danger {
  border-color: #d13438;
  color: #ff8a8d;
}

.btn-danger:hover {
  background: #d13438;
  color: #ffffff;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

input[type="text"],
input[type="password"],
input[type="date"],
textarea {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: all 0.15s;
}

input:focus,
textarea:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: #0078d7;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

input[type="date"] {
  color-scheme: dark;
}

.hint {
  opacity: 0.6;
  font-size: 13px;
  font-weight: 300;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 360px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 40px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-title {
  font-size: 32px;
  font-weight: 200;
  letter-spacing: 2px;
}

.login-subtitle {
  font-size: 13px;
  opacity: 0.5;
  margin-bottom: 10px;
}

.login-error {
  color: #ff8a8d;
  font-size: 13px;
  min-height: 18px;
}

/* ---------- 顶部栏 ---------- */
.metro-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.metro-title {
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  gap: 20px;
  align-items: center;
}

.header-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.1s;
}

.header-link:hover {
  color: #ffffff;
}

.header-link.as-btn {
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
}

/* ---------- 布局 ---------- */
.admin-container {
  padding: 90px 40px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

.admin-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.nav-tile {
  width: 120px;
  height: 60px;
  border: none;
  color: #ffffff;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.1s;
}

.nav-tile:hover {
  transform: scale(1.03);
  outline: 3px solid rgba(255, 255, 255, 0.3);
  outline-offset: -3px;
}

.nav-tile.active {
  outline: 3px solid rgba(255, 255, 255, 0.6);
  outline-offset: -3px;
}

.metro-blue { background: #0078d7; }
.metro-green { background: #107c10; }
.metro-orange { background: #ff8c00; }
.metro-red { background: #d13438; }
.metro-purple { background: #744da9; }
.metro-teal { background: #008272; }
.metro-magenta { background: #d8479b; }
.metro-dark { background: #2d2d2d; }
.metro-lime { background: #b8d432; color: #000; }
.metro-brown { background: #8e5621; }

.view-title {
  font-size: 34px;
  font-weight: 200;
  letter-spacing: 1px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* ---------- 列表 ---------- */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 20px;
  transition: background 0.1s;
}

.item-row:hover {
  background: rgba(255, 255, 255, 0.09);
}

.item-color {
  width: 14px;
  height: 14px;
  flex: none;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-size: 16px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-sub {
  font-size: 12px;
  opacity: 0.55;
  margin-top: 2px;
  font-weight: 300;
}

.item-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

/* ---------- 编辑器 ---------- */
.editor-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-row input {
  min-width: 0;
}

.form-row .input-lg {
  width: 100%;
  font-size: 18px;
  padding: 12px 16px;
}

.form-row-inline input[type="date"] {
  width: 180px;
}

.form-row-inline input[type="text"] {
  flex: 1;
  max-width: 500px;
}

.color-label {
  font-size: 14px;
  opacity: 0.7;
}

.color-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.color-swatch {
  width: 32px;
  height: 32px;
  cursor: pointer;
  border: none;
  transition: all 0.1s;
  font-size: 11px;
  color: #ffffff;
  font-family: inherit;
}

.color-swatch.auto {
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed rgba(255, 255, 255, 0.4);
  width: auto;
  padding: 0 10px;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  outline: 3px solid #ffffff;
  outline-offset: -3px;
}

.editor-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 480px;
}

.editor-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pane-label {
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 26px;
}

#post-content {
  flex: 1;
  resize: vertical;
  min-height: 480px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.7;
}

#post-content.dragover {
  border-color: #b8d432;
  background: rgba(184, 212, 50, 0.08);
}

.preview {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 20px 24px;
  overflow-y: auto;
  min-height: 480px;
  max-height: 720px;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ---------- 预览区 Markdown 样式（与前台一致） ---------- */
.post-content {
  font-size: 15px;
  line-height: 1.8;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.92);
}

.post-content h1 {
  font-size: 28px;
  font-weight: 200;
  margin: 32px 0 16px;
  color: #ffffff;
}

.post-content h2 {
  font-size: 24px;
  font-weight: 300;
  margin: 28px 0 14px;
  color: #ffffff;
}

.post-content h3 {
  font-size: 19px;
  font-weight: 300;
  margin: 22px 0 10px;
  color: #ffffff;
}

.post-content h4 {
  font-size: 16px;
  font-weight: 400;
  margin: 18px 0 8px;
  color: #ffffff;
}

.post-content p {
  margin-bottom: 14px;
}

.post-content code {
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 6px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 13px;
  color: #b8d432;
}

.post-content pre {
  background: rgba(0, 0, 0, 0.5);
  padding: 14px 18px;
  overflow-x: auto;
  margin: 16px 0;
  border-left: 3px solid #0078d7;
}

.post-content pre code {
  background: transparent;
  padding: 0;
  color: rgba(255, 255, 255, 0.9);
}

.post-content blockquote {
  border-left: 3px solid #ff8c00;
  padding: 8px 16px;
  margin: 16px 0;
  background: rgba(255, 140, 0, 0.08);
}

.post-content blockquote p {
  margin-bottom: 0;
}

.post-content a {
  color: #4ea3e0;
}

.post-content ul,
.post-content ol {
  margin: 10px 0 14px 22px;
}

.post-content img {
  max-width: 100%;
  margin: 12px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.post-content hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 24px 0;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .admin-container {
    padding: 80px 16px 40px;
  }

  .metro-header {
    padding: 0 16px;
  }

  .editor-split {
    grid-template-columns: 1fr;
  }

  .view-title {
    font-size: 26px;
  }

  .item-row {
    flex-wrap: wrap;
  }
}
