/* ===================================
   CUSTOM POST FORM - RESPONSIVE
   =================================== */

.main-content {
  margin-left: 270px;
  padding: 20px;
  flex: 1;
}

.container-post-form {
  max-width: 900px;
  margin: 0 auto;
  background: var(--card);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

/* Tabs Navigation */
.post-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  overflow-x: auto;
}

.post-tab-btn {
  flex: 1;
  min-width: 100px;
  padding: 16px 20px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.post-tab-btn:hover {
  color: var(--text);
}

.post-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Form Layout */
.post-form-custom {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 24px;
  padding: 24px;
}

.post-form-main {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Form Groups */
.form-group-custom {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-beta {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

/* Inputs */
.form-input-custom,
.form-textarea-custom,
.form-select-custom {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: all 0.3s ease;
}

.form-input-custom:focus,
.form-textarea-custom:focus,
.form-select-custom:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.1);
}

.form-input-custom::placeholder,
.form-textarea-custom::placeholder {
  color: var(--muted);
}

.form-textarea-custom {
  resize: vertical;
  min-height: 200px;
  font-family: inherit;
}

/* Editor Toolbar - Di bawah textarea */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  align-items: center;
}

.toolbar-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
}

.toolbar-icon:hover {
  background: var(--box-icon);
  color: var(--accent);
  border-color: var(--accent);
}

.toolbar-separator {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 4px;
}

.char-counter {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.char-counter-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: normal;
}

/* Sidebar */
.post-form-sidebar {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-label {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
}

.form-select-custom {
  padding: 10px;
}

.checkbox-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: color 0.2s ease;
}

.checkbox-custom:hover {
  color: var(--text);
}

.checkbox-custom input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* Form Actions */
.form-actions-custom {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn-draft-custom {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
}

.btn-draft-custom:hover {
  background: var(--box-icon);
  color: var(--accent);
  border-color: var(--accent);
}

.btn-post-custom {
  flex: 1;
  padding: 12px;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn-post-custom:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Schedule section styling */
.pe-schedule-section {
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 12px;
}

.pe-schedule-section.hidden {
  display: none;
}

.pe-schedule-input {
  width: 100%;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 14px;
  margin-top: 8px;
}

.pe-schedule-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.1);
}

/* Notification styling */
.pe-notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  animation: slideIn 0.3s ease;
}

.pe-notification.hidden {
  display: none;
}

.pe-notification.success {
  border-left: 4px solid #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.pe-notification.error {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.notification-text {
  color: var(--text);
  font-size: 14px;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Loading state for publish button */
#publishBtn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Tooltip styling for toolbar buttons */
.pe-toolbar button[title] {
  position: relative;
}

.pe-toolbar button[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 11px;
  white-space: nowrap;
  margin-bottom: 4px;
  z-index: 10;
}

/* Help icon styling */
.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--muted);
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
  cursor: help;
  margin-left: 4px;
}

.help-icon:hover {
  background: var(--accent);
}

/* Community search styling */
.community-search-wrapper {
  position: relative;
}

.community-search {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 14px;
}

.community-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.1);
}

.community-ddropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.community-ddropdown.hidden {
  display: none;
}

.community-list {
  display: flex;
  flex-direction: column;
}

.community-item {
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 14px;
}

.community-item:hover {
  background: var(--bg);
  color: var(--accent);
}

/* Emoji picker styling */
.emoji-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 8px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 300px;
}

.emoji-picker.hidden {
  display: none;
}

.emoji-picker-header {
  margin-bottom: 12px;
}

.emoji-search {
  width: 100%;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 13px;
}

.emoji-search:focus {
  outline: none;
  border-color: var(--accent);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.emoji-btn {
  width: 100%;
  aspect-ratio: 1;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.emoji-btn:hover {
  background: var(--bg);
  border-color: var(--accent);
  transform: scale(1.1);
}

/* Mention autocomplete styling */
.mention-autocomplete {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 8px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
}

.mention-autocomplete.hidden {
  display: none;
}

.mention-list {
  display: flex;
  flex-direction: column;
  max-height: 150px;
  overflow-y: auto;
}

.mention-item {
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.mention-item:last-child {
  border-bottom: none;
}

.mention-item:hover {
  background: var(--bg);
  color: var(--accent);
}

/* Auto-save indicator styling */
.pe-autosave-indicator {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin-bottom: 12px;
}

.autosave-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.autosave-status::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
    padding: 12px;
  }

  .post-form-custom {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  .post-form-sidebar {
    grid-column: 1;
  }

  .post-tabs {
    overflow-x: auto;
  }

  .post-tab-btn {
    flex: 0 0 auto;
  }

  .editor-toolbar {
    gap: 2px;
  }

  .toolbar-icon {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .emoji-picker {
    min-width: 250px;
  }

  .emoji-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  .mention-autocomplete {
    min-width: 150px;
  }
}

/* Added styling for contenteditable editor */
.pe-editor {
  min-height: 300px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}

.pe-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.1);
}

.pe-editor[contenteditable]:empty:before {
  content: attr(placeholder);
  color: var(--muted);
  pointer-events: none;
}

/* Styling for formatted text in editor */
.pe-editor strong,
.pe-editor b {
  font-weight: 700;
  color: var(--text);
}

.pe-editor em,
.pe-editor i {
  font-style: italic;
  color: var(--text);
}

.pe-editor u {
  text-decoration: underline;
  color: var(--text);
}

.pe-editor blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 12px;
  margin: 8px 0;
  color: var(--muted);
  font-style: italic;
}

.pe-editor pre {
  background: var(--panel);
  padding: 12px;
  border-radius: 4px;
  overflow-x: auto;
  font-family: "Courier New", monospace;
  font-size: 13px;
  margin: 8px 0;
}

.pe-editor a {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.pe-editor a:hover {
  opacity: 0.8;
}

.pe-editor .spoiler {
  background: var(--muted);
  color: var(--muted);
  padding: 2px 4px;
  border-radius: 2px;
  cursor: pointer;
}

.pe-editor .spoiler:hover {
  background: var(--accent);
  color: white;
}
