/* Dropdown menus inside modal */
#add-post-modal .dropdown-menu,
#edit-post-modal .dropdown-menu {
  position: absolute;
  top: 60px;
  background: var(--bg-surface);
  border: none;
  list-style: none;
  padding: 5px 5px;
  margin: 4px 0 0;
  width: max-content;
  min-width: 120px;
  z-index: 10000;
  overflow-x: hidden;
  overflow-y: scroll;
  scrollbar-width: thin;
  box-shadow: 0 0 11px 0px #a4a4a442;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}
#add-post-modal .dropdown-menu li,
#edit-post-modal .dropdown-menu li {
  padding: 7px 12px;
  cursor: pointer;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
#add-post-modal .dropdown-menu li:hover,
#edit-post-modal .dropdown-menu li:hover {
  background: #f5f5f5;
}

/* Buttons */
#add-post-modal .btn,
#edit-post-modal .btn {
  padding: 0px 12px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  cursor: pointer;
  border-radius: 99px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  height: 38px;
  width: max-content;
}
#add-post-modal .btn.btn-primary,
#edit-post-modal .btn.btn-primary {
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 8px;
  padding: 9px 16px 8px;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  transform: none !important;
}

/* Media preview thumbnails */
#add-post-modal .media-preview img,
#add-post-modal .media-preview video,
#edit-post-modal .edit-media-preview img,
#edit-post-modal .edit-media-preview video {
  width: 100%;
  height: max-content;
  max-height: calc(100vh - 80px);
  object-fit: cover;
  max-width: -webkit-fill-available;
}

/* Textarea */
#add-post-desc,
#edit-post-desc {
  width: 100%;
  height: 80px;
  margin-bottom: 8px;
  resize: vertical;
  padding: 8px;
  font-size: 14px;
  border: none;
  border-radius: 4px;
}

/* Header & footer layout */
#add-post-modal .add-post-header,
#add-post-modal .add-post-footer,
#edit-post-modal .edit-post-header,
#edit-post-modal .edit-post-footer {
  display: flex;
  align-items: center;
  padding: 12px;
  gap: 5px;
}
#add-post-modal .add-post-footer,
#edit-post-modal .edit-post-footer {
  justify-content: space-between;
}

/* Close button */
#add-post-modal .close-add-post,
#edit-post-modal .close-edit-post {
  margin-left: auto;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0px;
  height: max-content;
  font-family: fangsong;
}

/* backdrop */
#add-post-backdrop,
#edit-post-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  z-index: 9998;
}

/* modal */
#add-post-modal,
#edit-post-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 90%;
  max-width: 500px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  display: none;
  z-index: 9999;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
}
#add-post-modal.show,
#edit-post-modal.show {
  display: block;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  padding: 7px;
  max-height: calc(100vh - 40px);
  overflow: hidden;
  overflow-y: visible;
  scrollbar-width: thin;
}

/* header */
.add-post-header,
.edit-post-header {
  padding: 12px;
  display: flex;
  align-items: center;
}

/* profile avatar in header */
.add-post-modal-avatar,
.edit-post-modal-avatar {
  width: 38px;
  height: 38px;
  border-radius: 99px;
  display: none;
  object-fit: cover;
}

/* small Ã¢â‚¬Å“Ãƒâ€”Ã¢â‚¬Â close */
.add-post-close,
.edit-post-close {
  margin-left: auto;
  font-size: 20px;
  cursor: pointer;
}

/* page-dropdown button */
.add-post-page-select-btn,
.edit-page-select-btn {
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
/* down-arrow icon */
.add-post-page-select-btn svg,
.edit-page-select-btn svg {
  margin-left: 4px;
  vertical-align: middle;
  width: 12px;
  height: auto;
}

/* dropdown menus (type + page) */
.add-post-type-menu,
.edit-post-type-menu,
.add-post-page-select-menu,
.edit-post-page-select-menu {
  position: absolute;
  background: #fff;
  border: 1px solid #ccc;
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: none;
  z-index: 10000;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.add-post-type-menu,
.edit-post-type-menu {
  top: 100%;
  left: 0;
}
.add-post-page-select-menu,
.edit-post-page-select-menu {
  top: 100%;
  left: 0;
}

/* dropdown items */
.add-post-type-menu li,
.edit-post-type-menu li,
.add-post-page-select-menu li,
.edit-post-page-select-menu li {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.add-post-type-menu li:hover,
.edit-post-type-menu li:hover,
.add-post-page-select-menu li:hover,
.edit-post-page-select-menu li:hover {
  background: #f5f5f5;
}

/* page item icon + text */
.add-post-page-icon,
.edit-post-page-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-right: 8px;
}
.add-post-page-name,
.edit-post-page-name {
  flex: 1;
}

/* body */
.add-post-body,
.edit-post-body {
  padding: 2px 14px 12px;
}

/* hide file inputs */
#add-post-media-input,
#edit-post-media-input {
  display: none;
}

/* add-post media preview vs edit */
.add-post-media-preview,
.edit-media-preview {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
}

/* footer */
.add-post-footer,
.edit-post-footer {
  padding: 12px;
}

/* post-type dropdown tweaks */
ul.post-type-menu.dropdown-menu {
  left: 52px;
  overflow-y: hidden !important;
}

/* icon inside any .btn in the modal */
#add-post-modal .btn svg,
#edit-post-modal .btn svg {
  width: 19px;
  margin-bottom: -1px;
  margin-right: -7px;
  fill: var(--text-secondary);
}

/* upload-media button icon */
button#add-post-upload-media svg,
button#edit-post-upload-media svg {
  margin: 0px -2px 0px 1px !important;
}

/* spinner in both add & edit */
.media-preview .media-spinner,
.edit-media-preview .media-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 1em 0;
}
.media-spinner i {
  font-size: 20px;
}

/* media-item wrapper */
.media-preview .media-item,
.edit-media-preview .media-item {
  position: relative;
  display: inline-block;
  width: 100%;
  height: max-content;
}
.media-preview .media-item .remove-media,
.edit-media-preview .media-item .remove-media {
  position: absolute;
  top: 11px;
  right: 5px;
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  background: #ff2e2e;
  width: 24px;
  height: 24px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 1px;
}
.media-preview .media-item img,
.edit-media-preview .media-item img,
.media-preview .media-item video,
.edit-media-preview .media-item video {
  display: block;
  border-radius: 4px;
}

/* Textarea initial sizing, padding, border-radius */
#add-post-desc,
#edit-post-desc {
  width: 100%;
  height: 80px;
  margin-bottom: 8px;
  resize: vertical;
  padding: 8px;
  font-size: 14px;
  border: none;
  border-radius: 4px;
}

/* Textarea system font, outline removal, final sizing */
#add-post-desc,
#edit-post-desc {
  width: 100%;
  height: 80px;
  margin-bottom: 8px;
  resize: vertical;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  outline: none;
  padding: 0px;
  font-size: 17px;
}

.media-preview,
.edit-media-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

ul.page-select-menu.dropdown-menu li img,
ul.edit-page-select-menu.dropdown-menu li img {
  width: 32px;
  height: 32px;
  border-radius: 99px;
  margin-right: 5px;
  object-fit: cover;
}

ul.page-select-menu.dropdown-menu,
ul.edit-page-select-menu.dropdown-menu {
  max-height: calc(100% - 90px);
  left: 173px;
}

button.btn.page-select-btn .page-icon,
button.btn.edit-page-select-btn .page-icon {
  width: 25px;
  height: 25px;
  object-fit: cover;
  border-radius: 99px;
  margin-right: 4px;
  margin-left: -5px;
}

button.btn.page-select-btn,
button.btn.edit-page-select-btn {
  padding: 0px 9px;
}

span.edit-post-title {
    padding: 0px 12px;
    background: var(--bg-surface);
    cursor: pointer;
    border-radius: 99px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    height: 38px;
    width: max-content;
}

.tags-group {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 20px;
    padding: 0px;
    align-items: center;
}

.tags-groups {
    width: 100%;
    padding: 10px 0px 2px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tags-header {
    width: 100%;
    color: var(--bg-surface);
    background-color: var(--text-primary);
    padding: 10px 0px;
    box-shadow: 0 -5px 0 5px var(--text-primary);
}

span.tags-title {
    display: block;
    width: 100%;
    text-align: center;
    font-size: 16px;
}

.tags-body {
    background: var(--bg-surface);
    padding: 0px 20px;
}

.tags-actions {
    display: flex;
    width: 100%;
    background: var(--bg-surface);
    padding: 10px 20px;
    gap: 5px;
}

.tags-actions button {
    width: 100%;
    padding: 8px 0px 7px;
    border: 1px solid var(--text-muted);
    border-radius: 3px;
    background: var(--bg-surface);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}

.tags-input, .tags-select {
    font-size: 12px;
    margin: 2px;
    padding: 5px 10px 4px;
    border-radius: 5px;
    border: 1px solid var(--text-muted);
    color: var(--text-primary);
    outline: none;
    font-weight: 100;
}

.tags-input::-webkit-input-placeholder {
    color: var(--text-muted);
}

label.tags-group-title {
    color: var(--text-primary);
    font-size: 14px;
}

button.tags-apply-btn {
    background: var(--text-primary);
    color: var(--bg-surface);
    border: 1px solid var(--text-primary);
}

.tags-select {
    padding: 5px 10px 4px;
}

.ap-section.ap-banner,.ap-section.ap-profile {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: max-content;
    flex-direction: column;
    gap: 6px;
}

.ap-section.ap-profile {
    margin: 10px 0px;
}

.ap-banner-preview {
    display: flex;
    width: 100%;
    max-height: 100px;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.ap-banner-preview img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.ap-profile-preview img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 10px;
}

.ap-profile-preview {
    width: max-content;
    height: max-content;
}

.add-page-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
}

#add-page-submit {
    width: 100% !important;
    color: var(--bg-surface) !important;
    background: var(--text-primary) !important;
}

.add-page-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0px 10px;
}

/* =========================
   ADD PAGE — BASIC INFO ONLY
   Targets: the first ".ap-section" AFTER .ap-profile
   (Owner, Page Name, Description, Publish Posts, Location, Website)
   ========================= */

/* section wrapper */
.add-page-body .ap-profile + .ap-section {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
}

/* row layout */
.add-page-body .ap-profile + .ap-section .ap-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.add-page-body .ap-profile + .ap-section .ap-row:last-child {
  margin-bottom: 0;
}

/* labels */
.add-page-body .ap-profile + .ap-section .ap-row > label {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.85;
}

/* inputs + textarea */
.add-page-body .ap-profile + .ap-section .ap-row > input[type='text'],
.add-page-body .ap-profile + .ap-section .ap-row > input[type='url'],
.add-page-body .ap-profile + .ap-section .ap-row > textarea {
  width: 100%;
  padding: 12px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: var(--bg-surface);
  color: inherit;
  outline: 1px solid var(--text-muted);
}

/* description textarea sizing */
.add-page-body .ap-profile + .ap-section #add-page-desc {
  min-height: 90px;
  resize: vertical;
}

/* focus state */
.add-page-body .ap-profile + .ap-section .ap-row > input:focus,
.add-page-body .ap-profile + .ap-section .ap-row > textarea:focus {outline: 1px solid var(--text-primary);}

/* checkbox row: "Publish Posts" */
.add-page-body .ap-profile + .ap-section .ap-row:has(#add-page-publish-posts) {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.add-page-body .ap-profile + .ap-section #add-page-publish-posts {
  width: 18px;
  height: 18px;
  accent-color: #ffffff;
}

/* =========================
   ADD PAGE — BELOW BASIC INFO ONLY
   Targets: everything after the BASIC INFO section
   (Category, Tags, Details, Pricing/Flags, Bio)
   Keeps the same theme you posted.
   ========================= */

/* --- CATEGORY / TAGS / DETAILS / PRICING / BIO sections --- */
/* This selects every .ap-section AFTER the basic info section */
.add-page-body .ap-profile + .ap-section ~ .ap-section {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  margin-top: 12px;
}

/* row layout */
.add-page-body .ap-profile + .ap-section ~ .ap-section .ap-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.add-page-body .ap-profile + .ap-section ~ .ap-section .ap-row:last-child {
  margin-bottom: 0;
}

/* labels (rows + standalone Bio label) */
.add-page-body .ap-profile + .ap-section ~ .ap-section .ap-row > label,
.add-page-body .ap-profile + .ap-section ~ .ap-section > label {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.85;
}

/* inputs + textarea for these sections only */
.add-page-body .ap-profile + .ap-section ~ .ap-section input[type='text'],
.add-page-body .ap-profile + .ap-section ~ .ap-section input[type='url'],
.add-page-body .ap-profile + .ap-section ~ .ap-section input[type='number'],
.add-page-body .ap-profile + .ap-section ~ .ap-section input[type='date'],
.add-page-body .ap-profile + .ap-section ~ .ap-section textarea {
  width: 100%;
  padding: 12px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: var(--bg-surface);
  color: inherit;
  outline: 1px solid var(--text-muted);
  box-sizing: border-box;
}

/* focus state */
.add-page-body .ap-profile + .ap-section ~ .ap-section input:focus,
.add-page-body .ap-profile + .ap-section ~ .ap-section textarea:focus {
  outline: 1px solid var(--text-primary);
}

/* textarea sizing (tags textarea doesn't exist; this is for Bio etc) */
.add-page-body .ap-profile + .ap-section ~ .ap-section textarea {
  min-height: 90px;
  resize: vertical;
}

/* checkbox rows anywhere below basic info */
.add-page-body .ap-profile + .ap-section ~ .ap-section .ap-row:has(input[type='checkbox']) {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.add-page-body .ap-profile + .ap-section ~ .ap-section input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: #ffffff;
}

/* =========================
   TAGS section specifics
   ========================= */

/* give each Tag block a little separation */
.add-page-body .ap-tags .ap-tag {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* tag label line */
.add-page-body .ap-tags .ap-tag > label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.85;
  margin-bottom: 8px;
}

/* space between choice inputs */
.add-page-body .ap-tags .ap-tag input[type='text'] {
  margin-bottom: 8px;
}
.add-page-body .ap-tags .ap-tag input[type='text']:last-child {
  margin-bottom: 0;
}

/* Default Tag Pattern row spacing */
.add-page-body .ap-tags #add-page-default-tag-pattern {
  margin-top: 2px;
}

/* =========================
   BIO section specifics
   ========================= */
.add-page-body #add-page-bio {
  min-height: 120px;
}

/* =========================
   ADD PAGE — SELECT FIELDS
   Matches your input styles
   ========================= */

/* base select styling (below BASIC INFO sections) */
.add-page-body .ap-profile + .ap-section ~ .ap-section select {
  width: 100%;
  padding: 12px 40px 12px 12px; /* extra right space for arrow */
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: var(--bg-surface);
  color: inherit;
  outline: 1px solid var(--text-muted);
  box-sizing: border-box;

  /* consistent native look */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  /* simple down arrow */
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%,
    100% 0;
  background-size:
    6px 6px,
    6px 6px,
    2.5em 2.5em;
  background-repeat: no-repeat;
}

/* focus state (same as your inputs) */
.add-page-body .ap-profile + .ap-section ~ .ap-section select:focus {
  outline: 1px solid var(--text-primary);
}

/* disabled state */
.add-page-body .ap-profile + .ap-section ~ .ap-section select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(20%);
}

/* optional: hover cue */
.add-page-body .ap-profile + .ap-section ~ .ap-section select:not(:disabled):hover {
  border-color: rgba(255,255,255,0.16);
}

/* optional: make option list readable on some browsers */
.add-page-body .ap-profile + .ap-section ~ .ap-section select option {
  background: var(--bg-surface);
  color: inherit;
}

/* If you ever add selects in BASIC INFO too, include this: */
.add-page-body .ap-profile + .ap-section select {
  width: 100%;
  padding: 12px 40px 12px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.10);
  background: var(--bg-surface);
  color: inherit;
  outline: 1px solid var(--text-muted);
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 13px) 50%,
    100% 0;
  background-size:
    6px 6px,
    6px 6px,
    2.5em 2.5em;
  background-repeat: no-repeat;
}
.add-page-body .ap-profile + .ap-section select:focus { outline: 1px solid var(--text-primary); }
.add-page-body .ap-profile + .ap-section select:disabled { opacity: 0.55; cursor: not-allowed; }