/* nest-posts.css - Styles for Nest blog post management */

/* Create post button and insert zones - unified styling */
.nest-create-post-btn,
.nest-insert-zone {
  display: block;
  width: 100%;
  margin: 0 auto 20px;
  padding: 12px 20px;
  background: transparent;
  border: 2px dashed var(--color-nimbus-light);
  border-radius: 12px;
  font-family: 'Cascadia Code', 'Cascadia Mono', monospace;
  font-size: 18px;
  font-style: italic;
  color: var(--color-nimbus-light);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

/* Insert zones between posts - hidden by default, show on hover */
.nest-insert-zone {
  opacity: 0;
}

.nest-insert-zone:hover {
  opacity: 1;
}

/* Disable insert zones when editor is active (don't hide to prevent layout shift) */
body.editor-active .nest-insert-zone {
  pointer-events: none;
  opacity: 0 !important;
  cursor: default;
}

.nest-create-post-btn:hover,
.nest-insert-zone:hover {
  border-color: var(--color-nimbus-medium);
  color: var(--color-nimbus-medium);
}

/* Post container */
.nest-post {
  position: relative;
  max-width: 932px;
  margin: 0 auto 30px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

/* Hover state for editable posts */
.nest-post-hover {
  outline: 2px dashed var(--color-nimbus-light);
  outline-offset: 20px;
  cursor: pointer;
}

/* Active editing state */
.nest-post-editing {
  outline: 2px dashed #BCD1CA;
  outline-offset: 30px;
  box-shadow: 0 0 0 30px rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.8);
}

/* Metadata section in edit mode */
.nest-post-meta {
  margin-bottom: 10px;
}

/* Title display (read-only view) */
.nest-post-title-display {
  width: 100%;
  padding: 8px 0px 0px 0px;
  margin-bottom: 12px;
  font-family: 'Noto Serif', serif;
  font-size: 28px;
  font-weight: 600;
  color: #333;
}

/* Title input */
.nest-post-title-input {
  width: 100%;
  padding: 8px 0px 0px 0px;
  margin-bottom: 12px;
  border: none;
  background: transparent;
  font-family: 'Noto Serif', serif;
  font-size: 28px;
  font-weight: 600;
  color: #333;
  outline: none;
}

.nest-post-title-input::placeholder {
  color: #B0AEA5;
}

/* Dates section */
.nest-post-dates {
  display: flex;
  margin: 10px 0px 16px 0px;
  gap: 12px 16px; /* row-gap 12px, column-gap 16px */
  flex-wrap: wrap;
}

.nest-post-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Ubuntu Sans', sans-serif;
  font-size: 13px;
  color: var(--color-cumulonimbus-light);
  white-space: nowrap;
}

.nest-post-date-icon {
  width: 16px;
  height: 16px;
  opacity: 0.7;
  display: block;
  flex-shrink: 0;
  margin-top: 0;
}

/* Created date input (Flatpickr) */
.nest-post-created-date-input {
  border: none;
  background: transparent;
  font-family: 'Ubuntu Sans', sans-serif;
  font-size: 13px;
  color: var(--color-cumulonimbus-light);
  outline: none;
  padding: 2px 4px;
  cursor: pointer;
  min-width: 120px;
}

.nest-post-created-date-input::placeholder {
  color: var(--color-nimbus-medium);
  font-style: italic;
}

/* Post content */
.nest-post-content {
  font-family: 'Ubuntu Sans', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
}

/* TipTap editor when active */
.nest-post-editor {
  min-height: 100px;
}

.nest-post-editor .ProseMirror {
  outline: none;
}

.nest-post-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: rgba(0, 0, 0, 0.3);
  pointer-events: none;
  height: 0;
}

/* Typography inside posts */
.nest-post-content h1,
.nest-post-editor h1 {
  font-family: 'Noto Serif', serif;
  font-size: 32px;
  font-weight: 600;
  margin: 20px 0 10px 0;
  line-height: 1.3;
}

.nest-post-content h2,
.nest-post-editor h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 16px 0 8px 0;
  line-height: 1.3;
}

.nest-post-content h3,
.nest-post-editor h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 14px 0 6px 0;
  line-height: 1.3;
}

.nest-post-content p,
.nest-post-editor p {
  font-family: monospace;
  font-size: 17px;
  line-height: 1.6;
  margin: 10px 0;
}

.nest-post-content a,
.nest-post-editor a {
  color: #0066cc;
  text-decoration: underline;
}

.nest-post-content img:not(.nest-post-date-icon),
.nest-post-editor img:not(.nest-post-date-icon) {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.nest-post-content code,
.nest-post-editor code {
  font-family: 'Ubuntu Mono', monospace;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 14px;
}

.nest-post-content pre,
.nest-post-editor pre {
  font-family: 'Ubuntu Mono', monospace;
  background: rgba(0, 0, 0, 0.05);
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  margin: 10px 0;
}

.nest-post-content pre code,
.nest-post-editor pre code {
  background: none;
  padding: 0;
}

/* Delete button styling */
.tiptap-toolbar-delete {
  color: #d32f2f !important;
}

.tiptap-toolbar-delete:hover {
  background: rgba(211, 47, 47, 0.1) !important;
}

/* Tag footer and selector */
.nest-post-tag-footer {
  position: relative;
  margin-top: 16px;
}

.nest-post-tag-button {
  border: none;
  background: transparent;
  font-family: 'Ubuntu Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.nest-post-tag-button:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Tag colors */
.nest-post-tag-button[data-current-tag="черновик"] {
  color: var(--color-nimbus-dark);
}

.nest-post-tag-button[data-current-tag="лента"] {
  color: var(--color-garden-sky);
}

/* All category tags (sidebar sections) get Garden Olive color */
.nest-post-tag-button[data-current-tag="стихи"],
.nest-post-tag-button[data-current-tag="рассказы"] {
  color: var(--color-garden-olive);
}

/* Default color for any other custom tag */
.nest-post-tag-button:not([data-current-tag="черновик"]):not([data-current-tag="лента"]):not([data-current-tag="стихи"]):not([data-current-tag="рассказы"]) {
  color: var(--color-garden-olive);
}

/* Tag dropdown */
.nest-post-tag-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 4px;
  background: white;
  border: 1px solid var(--color-nimbus-light);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 140px;
  z-index: 1000;
}

.nest-post-tag-option {
  padding: 8px 12px;
  font-family: 'Ubuntu Mono', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s ease;
}

.nest-post-tag-option:first-child {
  border-radius: 6px 6px 0 0;
}

.nest-post-tag-option:last-child {
  border-radius: 0 0 6px 6px;
}

.nest-post-tag-option:hover {
  background: rgba(0, 0, 0, 0.05);
}

.nest-post-tag-option.active {
  background: rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

/* Tag option colors */
.nest-post-tag-option[data-tag="черновик"] {
  color: var(--color-nimbus-dark);
}

.nest-post-tag-option[data-tag="лента"] {
  color: var(--color-garden-sky);
}

/* All category tags get Garden Olive color */
.nest-post-tag-option[data-tag="стихи"],
.nest-post-tag-option[data-tag="рассказы"] {
  color: var(--color-garden-olive);
}

/* Default color for any other custom tag */
.nest-post-tag-option:not([data-tag="черновик"]):not([data-tag="лента"]):not([data-tag="стихи"]):not([data-tag="рассказы"]) {
  color: var(--color-garden-olive);
}

/* Night shift mode */
.night-shift .nest-create-post-btn {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.5);
}

.night-shift .nest-create-post-btn:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.02);
}

.night-shift .nest-insert-hint {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.5);
}

.night-shift .nest-post-hover {
  outline-color: rgba(255, 255, 255, 0.2);
}

.night-shift .nest-post-editing {
  outline-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.02);
}

.night-shift .nest-post-content {
  color: #e0e0e0;
}

.night-shift .nest-post-content code,
.night-shift .nest-post-editor code {
  background: rgba(255, 255, 255, 0.05);
}

.night-shift .nest-post-content pre,
.night-shift .nest-post-editor pre {
  background: rgba(255, 255, 255, 0.05);
}

.night-shift .nest-post-editor .ProseMirror p.is-editor-empty:first-child::before {
  color: rgba(255, 255, 255, 0.3);
}

/* Placeholder for posts with lazy-loaded content */
.nest-post-placeholder {
  color: var(--color-nimbus-light);
  font-style: italic;
  opacity: 0.6;
  padding: 20px 0;
  text-align: center;
}

.night-shift .nest-post-placeholder {
  color: rgba(255, 255, 255, 0.4);
}

/* HeroUI DatePicker container */
.heroui-datepicker-container {
  min-width: 120px;
}

.nest-post-date-editable {
  display: flex;
  gap: 8px;
}

.nest-post-date-editable .nest-post-date-icon {
  flex-shrink: 0;
}

/* Category header block in main content area */
.category-header-block {
  max-width: 932px;
  margin: 40px auto 40px;
}

.category-header-title {
  font-family: 'Noto Serif', serif;
  font-size: 32px;
  font-weight: 600;
  color: #333;
  margin-bottom: 16px;
}

.category-header-card {
  display: flex;
  align-items: stretch;
  background: var(--color-cloud-medium);
  border: none;
  border-radius: 16px;
  overflow: hidden;
  min-height: 140px;
}

.category-header-image {
  width: 160px;
  min-width: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.category-header-image img {
  max-width: 120px;
  max-height: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.category-header-description {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  align-items: center;
}

.category-header-description p {
  font-family: 'Noto Serif', serif;
  font-size: 15px;
  font-style: italic;
  line-height: 1.6;
  color: #5E5D59;
  margin: 0;
}

/* Night shift mode for category header */
.night-shift .category-header-title {
  color: #e0e0e0;
}

.night-shift .category-header-card {
  background: rgba(255, 255, 255, 0.05);
}

.night-shift .category-header-description p {
  color: #c0c0c0;
}

/* Responsive adjustments */
@media (max-width: 639px) {
  .category-header-card {
    flex-direction: column;
  }

  .category-header-image {
    width: 100%;
    min-width: auto;
    padding: 20px;
  }

  .category-header-description {
    padding: 16px 20px;
  }
}
