/* Create post page — match Next.js layout */

.tpc-page--create-post.tpc-container--create-post {
  max-width: 72rem;
}

.tpc-create-post-layout {
  position: relative;
}

.tpc-editor-top-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  max-width: min(100%, 32rem);
}

.tpc-editor-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tpc-editor-title {
  width: 100%;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  border: none;
  outline: none;
  padding: 0;
  background: transparent;
  font-family: inherit;
  color: #0f172a;
}

.tpc-editor-title::placeholder {
  color: #9ca3af;
}

.tpc-editor-author {
  width: 100%;
  font-size: clamp(1.25rem, 3vw, 1.875rem);
  color: #4b5563;
  border: none;
  outline: none;
  padding: 0;
  background: transparent;
  font-family: inherit;
}

.tpc-editor-author::placeholder {
  color: #9ca3af;
}

.tpc-editor-hint {
  font-size: 0.875rem;
  color: #6b7280;
  margin: -0.75rem 0 0;
}

.tpc-editor-meta,
.tpc-editor-tags {
  width: 100%;
  font-size: 1.125rem;
  border: none;
  outline: none;
  padding: 0;
  background: transparent;
  font-family: inherit;
  color: #0f172a;
  margin-bottom: 1rem;
}

.tpc-editor-meta::placeholder,
.tpc-editor-tags::placeholder {
  color: #9ca3af;
}

/* Editor area */
.tpc-editor-wrap {
  position: relative;
}

.tpc-content-editable {
  min-height: 300px;
  padding: 1rem;
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.125rem;
  line-height: 1.75;
  color: #0f172a;
  outline: none;
  overflow-wrap: break-word;
}

.tpc-content-editable:empty::before {
  content: attr(data-placeholder);
  color: #9ca3af;
  pointer-events: none;
}

.tpc-content-editable h1 {
  font-size: 3rem;
  font-weight: 800;
  margin: 1rem 0;
}

.tpc-content-editable h2 {
  font-size: 2.25rem;
  font-weight: 700;
  margin: 1rem 0;
}

.tpc-content-editable h3 {
  font-size: 1.875rem;
  font-weight: 600;
  margin: 0.75rem 0;
}

.tpc-content-editable a {
  color: #3b82f6;
  text-decoration: underline;
  font-weight: 600;
}

.tpc-content-editable img,
.tpc-content-editable iframe {
  max-width: 100%;
  margin: 1rem 0;
}

.tpc-custom-toolbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.5rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.tpc-custom-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: #374151;
  cursor: pointer;
}

.tpc-custom-toolbar button:hover,
.tpc-custom-toolbar button.is-active {
  background: #f3f4f6;
  color: #111827;
}

.tpc-custom-toolbar button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Posting rules — bottom right collapsible */
.tpc-rules-panel {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 20;
  width: 18rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 0.5rem;
}

.tpc-rules-panel__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem;
  border: none;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  color: #111827;
}

.tpc-rules-panel__list {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.75rem;
}

.tpc-rules-panel__list li {
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.tpc-rules-panel__list li.fail {
  color: #dc2626;
}

.tpc-rules-panel__list .tpc-rule-icon {
  flex-shrink: 0;
  width: 0.75rem;
  height: 0.75rem;
  margin-top: 0.15rem;
}

.tpc-rules-panel__list .tpc-rule-icon--ok {
  color: #22c55e;
}

.tpc-rules-panel__list .tpc-rule-icon--fail {
  color: #ef4444;
}

/* Sections */
.tpc-editor-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.tpc-editor-section--border {
  padding-top: 2rem;
  border-top: 1px solid #e5e7eb;
}

.tpc-rules-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
}

.tpc-rules-checkbox input {
  width: 1rem;
  height: 1rem;
}

.tpc-form-error {
  color: #dc2626;
  text-align: center;
  padding: 0.5rem;
  border: 1px solid #ef4444;
  border-radius: 0.375rem;
}

/* Category picker */
.tpc-category-picker {
  position: relative;
}

.tpc-category-picker__trigger {
  width: 100%;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  text-align: left;
}

.tpc-category-picker__placeholder {
  color: #6b7280;
}

.tpc-category-badge {
  display: inline-block;
  background: #f3f4f6;
  color: #374151;
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.tpc-category-picker__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  overflow: hidden;
}

.tpc-category-picker__dropdown input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.875rem;
  outline: none;
}

.tpc-category-picker__list {
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem;
  list-style: none;
}

.tpc-category-option {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: 0.25rem;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tpc-category-option:hover,
.tpc-category-option.is-selected {
  background: #f3f4f6;
}

.tpc-category-option .tpc-cat-check {
  width: 1rem;
  height: 1rem;
  opacity: 0;
}

.tpc-category-option.is-selected .tpc-cat-check {
  opacity: 1;
}

/* Preview */
.tpc-preview-panel {
  padding-top: 4rem;
}

.tpc-preview-title {
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 0.5rem;
}

.tpc-preview-author {
  font-size: clamp(1.25rem, 3vw, 1.875rem);
  color: #4b5563;
  margin: 0 0 1.5rem;
}

.tpc-preview-meta {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: #4b5563;
}

/* Dialogs */
.tpc-dialog {
  border: none;
  border-radius: 0.5rem;
  padding: 0;
  max-width: 50rem;
  width: calc(100% - 2rem);
  max-height: 90vh;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

.tpc-dialog::backdrop {
  background: rgb(0 0 0 / 0.5);
}

.tpc-dialog__inner {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 90vh;
}

.tpc-dialog__close {
  float: right;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #6b7280;
}

.tpc-dialog__title {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 800;
  text-align: center;
  margin: 0 0 1.5rem;
  clear: both;
}

.tpc-dialog__prose {
  font-size: 1.125rem;
  line-height: 1.6;
  max-width: none;
}

.tpc-dialog__prose h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1.5rem 0 0.75rem;
}

.tpc-dialog__prose ul {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
}

.tpc-dialog__center {
  text-align: center;
  margin-top: 2rem;
}

.tpc-dialog--duplicate .tpc-dup-box {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.tpc-dialog--duplicate .tpc-dup-box p {
  color: #9a3412;
  font-weight: 500;
  margin: 0 0 0.5rem;
}

.tpc-dialog--duplicate .tpc-dup-tips {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #1d4ed8;
}

.tpc-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .tpc-rules-panel {
    position: static;
    width: 100%;
    margin-top: 1rem;
  }

  .tpc-editor-top-actions {
    position: static;
    margin-bottom: 1rem;
    max-width: 100%;
  }
}

/* URL collection dialog */
.tpc-dialog__inner--wide {
  max-width: 42rem;
  width: 100%;
}

.tpc-dialog__desc {
  color: #6b7280;
  margin-bottom: 1rem;
}

.tpc-dialog__subtitle {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.tpc-url-field-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.tpc-url-field {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font: inherit;
}

.tpc-url-remove {
  width: 2.25rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: #fff;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.tpc-url-add {
  width: 100%;
  margin: 0.5rem 0 1rem;
}

.tpc-url-preview-list {
  max-height: 24rem;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.tpc-url-preview-card {
  display: flex;
  gap: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.tpc-url-preview-card--error {
  color: #dc2626;
  background: #fef2f2;
}

.tpc-url-preview-thumb {
  width: 5rem;
  height: 5rem;
  object-fit: cover;
  border-radius: 0.375rem;
  flex-shrink: 0;
}

.tpc-url-preview-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tpc-url-preview-title,
.tpc-url-preview-desc {
  width: 100%;
  font: inherit;
  padding: 0.375rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
}

.tpc-url-preview-domain {
  font-size: 0.75rem;
  color: #6b7280;
}

.tpc-info-ahrefs {
  margin: 1rem 0;
  text-align: center;
}

.tpc-info-ahrefs img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}
