/* Memos Plugin Styles */

.memo-private-badge {
  display: inline-block;
  padding: 1px 5px;
  font-size: 11px;
  line-height: 1.4;
  color: rgba(220, 38, 38, .9);
  background: rgba(220, 38, 38, .18);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 3px;
  flex-shrink: 0;
  margin-right: auto;
}
.dark .memo-private-badge {
  background: rgba(239, 68, 68, .25);
  color: rgba(252, 165, 165, .9);
}

.memo-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.memo-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #eee;
}
.memo-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memo-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 36px;
  line-height: 1.25;
}
.memo-creator {
  font-weight: 600;
  font-size: 14px;
}
.memo-time {
  font-size: 12px;
  color: #999;
  text-decoration: none;
}

/* 标签 — 匹配 sleek 主题风格 */
.memo-tag,
a.memo-tag {
  display: inline-block;
  padding: .25rem .5rem;
  font-size: .875rem;
  line-height: 1.5;
  background: rgba(203, 213, 225, .35);
  border-radius: 4px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
  transition: background .15s;
}
a.memo-tag:hover {
  background: rgba(203, 213, 225, .7);
}
.dark .memo-tag,
.dark a.memo-tag {
  background: rgba(71, 85, 105, .35);
}
.dark a.memo-tag:hover {
  background: rgba(71, 85, 105, .7);
}

.memo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 1rem 0 16px;
  line-height: 1.6;
}
.memo-tags .memo-tag-active {
  background: rgba(203, 213, 225, .7) !important;
  font-weight: 600;
}
.dark .memo-tags .memo-tag-active {
  background: rgba(71, 85, 105, .7) !important;
}

.memo-item .post-content pre {
  line-height: 1.5rem;
}
.memo-item .post-content a:not(.memo-tag) {
  color: #4f46e5;
  text-decoration: underline;
}

/* 写笔记表单 */
.memo-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.memo-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  resize: vertical;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}
.memo-form textarea:focus {
  border-color: #818cf8;
}
.memo-form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.memo-form button {
  padding: 8px 20px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}
.memo-form button:hover {
  background: #4338ca;
}

/* 文件按钮 */
.memo-file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  color: #999;
  background: rgba(203, 213, 225, .25);
  transition: all .15s;
}
.memo-file-btn:hover {
  color: #4f46e5;
  background: rgba(203, 213, 225, .5);
}

/* 消息提示 */
.memo-msg {
  padding: 6px 12px;
  border-radius: 0.5rem;
  margin-bottom: 12px;
  font-size: 14px;
}
.memo-msg-ok {
  background: #ecfdf5;
  color: #065f46;
}
.memo-msg-err {
  background: #fef2f2;
  color: #991b1b;
}

/* 暗色模式 */
.dark .memo-form textarea {
  background: #1e293b;
  border-color: #334155;
  color: #e0e0e0;
}
.dark .memo-form button {
  background: #6366f1;
}
.dark .memo-form button:hover {
  background: #4f46e5;
}
.dark .memo-msg-ok {
  background: #064e3b;
  color: #a7f3d0;
}
.dark .memo-msg-err {
  background: #7f1d1d;
  color: #fecaca;
}

/* 管理员操作按钮 */
.memo-admin-actions {
  display: inline-flex;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
  align-items: center;
}
.memo-admin-btn {
  background: rgba(203, 213, 225, .25);
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  opacity: .6;
  transition: all .15s;
  line-height: 0;
}
.memo-admin-btn:hover {
  opacity: 1;
  background: rgba(203, 213, 225, .5);
}
.memo-admin-btn svg {
  display: block;
  width: 16px;
  height: 16px;
}
.dark .memo-admin-btn {
  background: rgba(71, 85, 105, .3);
}
.dark .memo-admin-btn:hover {
  background: rgba(71, 85, 105, .5);
}

/* 编辑表单 */
.memo-edit-form {
  background: rgba(213, 213, 225, .1);
  border-radius: 8px;
  padding: 12px;
}
.dark .memo-edit-form {
  background: rgba(30, 41, 59, .5);
}
.memo-edit-textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  min-height: 64px;
}
.memo-edit-textarea:focus {
  border-color: #818cf8;
}
.dark .memo-edit-textarea {
  background: #1e293b;
  border-color: #334155;
  color: #e0e0e0;
}

/* 附件区域 */
.memo-edit-attach {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  margin: 8px 0;
}
.dark .memo-edit-attach {
  border-color: #334155;
}
.memo-edit-attach-title {
  font-size: 12px;
  color: #999;
  padding: 6px 10px;
  background: rgba(203, 213, 225, .15);
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  gap: 4px;
}
.dark .memo-edit-attach-title {
  background: rgba(30, 41, 59, .5);
  border-color: #334155;
}
.memo-edit-attach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid #f0f0f0;
  transition: background .15s;
}
.memo-edit-attach-item:last-child {
  border-bottom: none;
}
.memo-edit-attach-item:hover {
  background: rgba(203, 213, 225, .08);
}
.dark .memo-edit-attach-item {
  border-color: #1e293b;
}
.dark .memo-edit-attach-item:hover {
  background: rgba(255, 255, 255, .03);
}
.memo-edit-attach-preview {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(0, 0, 0, .05);
}
.memo-edit-attach-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.memo-edit-attach-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.memo-edit-attach-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.memo-edit-attach-name {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.memo-edit-attach-meta {
  font-size: 11px;
  color: #999;
}
.memo-edit-attach-del {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  color: #999;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.memo-edit-attach-del:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* 编辑操作按钮 */
.memo-edit-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
}
.memo-edit-actions-right {
  display: flex;
  align-items: center;
  gap: 2px;
}
.memo-file-btn,
.memo-edit-file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 0.5rem;
  cursor: pointer;
  color: #999;
  background: rgba(203, 213, 225, .15);
  border: 1px solid #e5e7eb;
  transition: all .15s;
}
.memo-file-btn:hover,
.memo-edit-file-btn:hover {
  color: #4f46e5;
  border-color: #818cf8;
}
.dark .memo-file-btn,
.dark .memo-edit-file-btn {
  background: rgba(71, 85, 105, .15);
  border-color: #334155;
}

.memo-edit-file-list {
  display: none;
  margin: 8px 0;
  padding: 8px;
  background: rgba(203, 213, 225, .06);
  border-radius: 0.5rem;
  font-size: 13px;
}
.dark .memo-edit-file-list {
  background: rgba(255, 255, 255, .04);
}

.memo-file-items {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
}
.memo-file-items li {
  padding: 3px 0;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.memo-file-items li::before {
  content: "📄 ";
  margin-right: 2px;
}
.dark .memo-file-items li {
  color: #bbb;
}

.memo-file-clear {
  cursor: pointer;
  color: #999;
  font-size: 12px;
  transition: color .15s;
}
.memo-file-clear:hover {
  color: #dc2626;
}

.memo-edit-cancel {
  padding: 4px 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 13px;
  color: #666;
  transition: all .15s;
}
.memo-edit-cancel:hover {
  background: #f5f5f5;
}
.dark .memo-edit-cancel {
  background: #1e293b;
  border-color: #334155;
  color: #bbb;
}
.dark .memo-edit-cancel:hover {
  background: #334155;
}

.memo-edit-save {
  padding: 4px 16px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}
.memo-edit-save:hover {
  background: #4338ca;
}
.dark .memo-edit-save {
  background: #6366f1;
}
.dark .memo-edit-save:hover {
  background: #4f46e5;
}

/* 可见性选择器 */
.memo-visibility-select {
  padding: 4px 8px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 13px;
  background: var(--bg, #fff);
  color: var(--text, #333);
  cursor: pointer;
  outline: none;
}
.memo-visibility-select:focus {
  border-color: #818cf8;
}
.dark .memo-visibility-select {
  background: #1e293b;
  border-color: #334155;
  color: #e0e0e0;
}

/* 图片画廊 */
.memo-gallery {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}
.memo-gallery-item {
  overflow: hidden;
  border-radius: 0.5rem;
  cursor: zoom-in;
  transition: filter .2s;
  aspect-ratio: 1;
}
.memo-gallery-item:hover {
  filter: brightness(.9);
}
.memo-gallery-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s, opacity 0.8s ease-in-out, filter 0.8s ease-in-out;
}
.memo-gallery-single {
  aspect-ratio: auto !important;
  max-width: 300px;
  max-height: 300px;
}
.memo-gallery-single img {
  object-fit: contain !important;
  width: auto !important;
  height: auto !important;
  max-width: 100%;
  max-height: 100%;
}
.memo-gallery-item:hover img {
  transform: scale(1.03);
}
@media (max-width: 768px) {
  .memo-gallery {
    gap: 8px;
    grid-template-columns: repeat(var(--mobile-cols, 2), 1fr) !important;
  }
}

/* 非图片附件 */
.memo-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.memo-files a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: #f3f4f6;
  border-radius: 0.5rem;
  font-size: 13px;
  text-decoration: none;
  color: #555;
}
.memo-files a:hover {
  background: #e5e7eb;
}

/* 空状态 & 分页 */
.memo-empty {
  padding: 32px;
  text-align: center;
  color: #999;
  font-size: 15px;
}
.memo-pagination {
  display: flex;
  justify-content: center;
  margin: 32px 0 16px;
}
.memo-pages {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.memo-pages a,
.memo-pages > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: #555;
  background: #fff;
  border: 1px solid #e5e7eb;
  transition: all .2s ease;
  box-sizing: border-box;
}
.memo-pages a:hover {
  background: #f0f4ff;
  border-color: #818cf8;
  color: #4f46e5;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(79, 70, 229, .12);
}
.memo-pages .active {
  background: #4f46e5 !important;
  color: #fff !important;
  border-color: #4f46e5 !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, .25);
}
.memo-pages .ellipsis {
  border: none !important;
  background: none !important;
  min-width: 28px;
  padding: 0 4px;
  color: #999;
  box-shadow: none;
  cursor: default;
}
.memo-pages .ellipsis:hover {
  transform: none;
  box-shadow: none;
  background: none !important;
  border: none !important;
  color: #999 !important;
}

.dark .memo-pages a,
.dark .memo-pages > span {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}
.dark .memo-pages a:hover {
  background: #312e81;
  border-color: #6366f1;
  color: #c7d2fe;
  box-shadow: 0 2px 6px rgba(99, 102, 241, .2);
}
.dark .memo-pages .active {
  background: #6366f1 !important;
  border-color: #6366f1 !important;
  color: #fff !important;
}
.dark .memo-pages .ellipsis {
  color: #64748b !important;
  background: none !important;
  border: none !important;
}
