/* Member center + rich editor */
.member-page {
  background: #f5f6f8;
  min-height: 70vh;
}

.member-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 991.98px) {
  .member-shell {
    grid-template-columns: 1fr;
  }
}

.member-side {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 0.65rem;
  padding: 1.25rem 1rem;
}

.member-side .avatar-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: #e9ecef;
  margin: 0 auto 0.75rem;
}

.member-side .avatar-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.member-side .nav-link {
  color: #343a40;
  border-radius: 0.4rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.2rem;
}

.member-side .nav-link:hover,
.member-side .nav-link.active {
  background: #eef3ff;
  color: #2163e8;
}

.member-main {
  background: #fff;
  border: 1px solid #e8eaed;
  border-radius: 0.65rem;
  padding: 1.5rem;
}

.member-main h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.member-stat {
  border: 1px solid #eef0f2;
  border-radius: 0.5rem;
  padding: 1rem;
  background: #fafbfc;
}

.member-stat .num {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2163e8;
}

.avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: #e9ecef;
  border: 2px solid #dee2e6;
}

.cover-preview {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 16 / 9;
  border-radius: 0.5rem;
  background: #f1f3f5;
  border: 1px dashed #ced4da;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-preview .cover-placeholder {
  color: #adb5bd;
  font-size: 0.9rem;
  pointer-events: none;
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.cover-preview.has-image {
  border-style: solid;
  border-color: #dee2e6;
  background: #e9ecef;
}

.cover-preview.has-image .cover-placeholder {
  display: none;
}

.cover-preview.has-image img {
  display: block;
}

/* Cover cropper — match frontend list thumb 345×259 */
.cover-cropper {
  position: relative;
  width: 345px;
  height: 259px;
  max-width: 100%;
  border-radius: 0.65rem;
  border: 1px solid #ced4da;
  background:
    linear-gradient(45deg, #eceff3 25%, transparent 25%),
    linear-gradient(-45deg, #eceff3 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eceff3 75%),
    linear-gradient(-45deg, transparent 75%, #eceff3 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #f8f9fa;
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

.cover-cropper .cover-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
  font-size: 0.9rem;
  z-index: 1;
  pointer-events: none;
}

.cover-cropper .cover-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  z-index: 2;
}

.cover-cropper.has-image .cover-placeholder {
  display: none !important;
}

.cover-cropper .cover-stage.is-dragging {
  cursor: grabbing;
}

.cover-cropper .cover-img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none !important;
  transform-origin: 0 0;
  pointer-events: none;
  display: block;
}

.cover-cropper .cover-frame-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  font-size: 11px;
  color: #fff;
  background: rgba(25, 26, 31, 0.55);
  border-radius: 0.25rem;
  padding: 0.1rem 0.4rem;
  pointer-events: none;
}

.cover-cropper:not(.has-image) .cover-stage,
.cover-cropper:not(.has-image) .cover-frame-label {
  display: none;
}

.cover-crop-controls {
  max-width: 345px;
}

.article-card-mini img {
  width: 100%;
  aspect-ratio: 345 / 259;
  object-fit: cover;
  border-radius: 0.35rem;
  background: #e9ecef;
}

.keyword-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  min-height: 42px;
  padding: 0.35rem 0.5rem;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  background: #fff;
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #eef3ff;
  color: #2163e8;
  border-radius: 0.25rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.85rem;
}

.keyword-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.keyword-box input {
  border: 0;
  outline: 0;
  flex: 1;
  min-width: 140px;
  padding: 0.25rem;
}

.keyword-box #keywordAddBtn {
  flex-shrink: 0;
}

.badge-enterprise {
  background: #e8f7ef;
  color: #198754;
  font-weight: 600;
}

.badge-pending {
  background: #fff3cd;
  color: #856404;
}

/* Rich editor */
.jdd-editor {
  border: 1px solid #ced4da;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #fff;
  position: relative;
}

.jdd-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
}

.jdd-editor-btn {
  border: 1px solid #dee2e6;
  background: #fff;
  border-radius: 0.3rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.8rem;
  line-height: 1.4;
  cursor: pointer;
  color: #343a40;
}

.jdd-editor-btn:hover {
  background: #eef3ff;
  border-color: #2163e8;
  color: #2163e8;
}

.jdd-editor-sep {
  width: 1px;
  background: #dee2e6;
  margin: 0 0.2rem;
  align-self: stretch;
}

.jdd-editor-body {
  padding: 0.9rem 1rem;
  outline: none;
  line-height: 1.75;
  position: relative;
}

.jdd-editor-body:empty:before {
  content: attr(data-placeholder);
  color: #adb5bd;
  pointer-events: none;
}

.jdd-editor-body h2 {
  font-size: 1.35rem;
  margin: 0.8rem 0 0.5rem;
}

.jdd-editor-body h3 {
  font-size: 1.15rem;
  margin: 0.7rem 0 0.4rem;
}

.jdd-editor-body blockquote {
  border-left: 3px solid #2163e8;
  margin: 0.75rem 0;
  padding: 0.35rem 0.85rem;
  color: #6c757d;
  background: #f8f9fa;
}

.jdd-editor-img {
  display: inline-block;
  max-width: 100%;
  height: auto;
  cursor: pointer;
  vertical-align: middle;
}

.jdd-editor-img.is-selected {
  outline: 2px solid #2163e8;
  outline-offset: 2px;
}

.jdd-resize-box {
  position: absolute;
  pointer-events: none;
  border: 1px dashed #2163e8;
  z-index: 2;
}

.jdd-resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #2163e8;
  border: 1px solid #fff;
  border-radius: 1px;
  pointer-events: auto;
  cursor: nwse-resize;
}

.jdd-resize-nw {
  left: -5px;
  top: -5px;
  cursor: nwse-resize;
}
.jdd-resize-ne {
  right: -5px;
  top: -5px;
  cursor: nesw-resize;
}
.jdd-resize-sw {
  left: -5px;
  bottom: -5px;
  cursor: nesw-resize;
}
.jdd-resize-se {
  right: -5px;
  bottom: -5px;
  cursor: nwse-resize;
}

.article-card-mini {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 0.85rem;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid #eef0f2;
}

@media (max-width: 575.98px) {
  .article-card-mini {
    grid-template-columns: 88px 1fr;
  }
  .article-card-mini .actions {
    grid-column: 1 / -1;
  }
}

/* TinyMCE in member publish */
.tox-tinymce {
  border-radius: 0.5rem !important;
  border-color: #ced4da !important;
}
