/* PremierHome admin panel */

@media (max-width: 640px) {
  body[data-page="admin"] .site-header .container {
    flex-wrap: wrap;
    height: auto;
    padding-top: 14px;
    padding-bottom: 14px;
    row-gap: 10px;
  }
  body[data-page="admin"] .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

.form-section-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  margin: 26px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.form-section-title:first-child { margin-top: 0; }
.form-note-inline { font-weight: 400; color: var(--ink-soft); font-size: 0.8rem; }

.option-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  min-width: 0;
}
@media (max-width: 640px) {
  .option-group { grid-template-columns: repeat(2, 1fr); }
}
.option-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.83rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.option-chip span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option-chip:has(input:checked) {
  border-color: var(--green);
  background: var(--cream);
  color: var(--green);
  font-weight: 600;
}
.option-chip input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); flex: 0 0 auto; }

.feature-chip-wrap { display: flex; align-items: center; gap: 4px; min-width: 0; }
.feature-chip-wrap .option-chip { flex: 1 1 auto; min-width: 0; }
.feature-chip-wrap .remove-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(24, 36, 48, 0.12);
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}
.feature-chip-wrap .remove-btn:hover { background: #c14b3d; color: #fff; }

.featured-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cream);
}
.featured-toggle input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; flex-shrink: 0; margin: 0; }
.featured-toggle label { font-weight: 600; color: var(--ink); cursor: pointer; }

.image-dropzone { border-radius: 10px; transition: background 0.15s; }
.image-dropzone.drag-over { background: var(--cream); }

.image-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}
.image-picker-thumb {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.image-picker-thumb img { width: 100%; height: 100%; object-fit: cover; }
.image-picker-thumb .cover-badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  background: rgba(24, 36, 48, 0.75);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
}
.image-picker-thumb .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(24, 36, 48, 0.75);
  color: #fff;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-picker-thumb .remove-btn:hover { background: #c14b3d; }
.image-picker-thumb .set-cover-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  background: rgba(24, 36, 48, 0.75);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.4;
}
.image-picker-thumb .set-cover-btn:hover { background: var(--green); }

.image-picker-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  background: var(--cream);
  transition: all 0.15s;
}
.image-picker-add:hover { color: var(--green); border-color: var(--green); }

.single-image-picker { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.single-image-picker img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--cream);
}

.section-head-actions { display: flex; align-items: center; gap: 10px; }

.admin-compact-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  max-width: 720px;
}
@media (max-width: 640px) {
  .admin-compact-card { padding: 18px 16px; }
}

.profile-image-row { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 4px; }
.single-image-picker.compact img { width: 72px; height: 72px; }
.single-image-picker.compact .image-picker-add { padding: 7px 12px; font-size: 0.78rem; }

.payment-methods-editor { margin-bottom: 4px; }
.payment-methods-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.payment-methods-empty-note { font-size: 0.83rem; color: var(--ink-soft); font-style: italic; }
.payment-method-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--cream);
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--ink);
}
.payment-method-chip .remove-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(24, 36, 48, 0.12);
  color: var(--ink-soft);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}
.payment-method-chip .remove-btn:hover { background: #c14b3d; color: #fff; }
.payment-method-add-row { display: flex; gap: 8px; max-width: 320px; }
.payment-method-add-row input { flex: 1 1 auto; min-width: 0; }

.admin-options-wrap { position: relative; }
.admin-icon-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.admin-icon-btn:hover { color: var(--green); border-color: var(--green); }

.admin-options-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  min-width: 170px;
  padding: 6px;
  z-index: 50;
}
.admin-options-menu.open { display: block; }
.admin-options-menu button {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.admin-options-menu button:hover { background: var(--cream); }

.select-col { display: none; width: 40px; min-width: 40px; }
.admin-table.select-mode .select-col { display: table-cell; }
.select-col input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

.bulk-bar {
  display: none;
  align-items: center;
  gap: 10px;
  background: #eef5f0;
  border: 1px solid var(--green);
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 20px;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--ink);
  flex-wrap: wrap;
}
.bulk-bar.open { display: flex; }
.bulk-bar .bulk-spacer { flex: 1; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.stat-card strong { display: block; font-size: 1.6rem; color: var(--green); line-height: 1.2; }
.stat-card span { font-size: 0.78rem; color: var(--ink-soft); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }

.stat-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.stat-tag-chip {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.stat-tag-chip strong { color: var(--ink); }

.import-url-bar {
  background: var(--cream);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 14px 16px 4px;
  margin-bottom: 18px;
}
.import-url-row { display: flex; gap: 8px; }
.import-url-row input { flex: 1; min-width: 0; }
@media (max-width: 480px) {
  .import-url-row .btn {
    padding: 8px 12px;
    font-size: 0.75rem;
    flex-shrink: 0;
  }
}

.admin-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab {
  border: none;
  background: none;
  padding: 12px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.admin-tab:hover { color: var(--ink); }
.admin-tab.active { color: var(--green); border-color: var(--green); }

.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th, .admin-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.admin-table th { color: var(--ink-soft); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table td.wrap { white-space: normal; }

.admin-table th:first-child, .admin-table td:first-child {
  width: 64px;
  min-width: 64px;
}
.admin-table-thumb {
  width: 56px;
  min-width: 56px;
  height: 44px;
  min-height: 44px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  background: var(--cream);
}
.admin-table-thumb-empty { border: 1px dashed var(--line); }

.admin-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
}
.admin-badge.yes { background: #e3f3e8; color: var(--gold); }
.admin-badge.no { background: var(--cream); color: var(--ink-soft); }

.admin-row-actions { display: flex; gap: 8px; }

.admin-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}

/* Modal */
.admin-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(24, 36, 48, 0.55);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.admin-modal-overlay.open { display: flex; }
.admin-modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 680px;
  width: 100%;
  padding: 28px;
}
.admin-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.admin-modal-head h3 { font-size: 1.2rem; }
.admin-modal-close {
  border: none;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}

/* ---------- Application form canvas ---------- */
.af-step-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 18px;
  overflow: hidden;
}
.af-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.af-step-head h4 { font-size: 1rem; flex: 1 1 auto; }
.af-step-drag-handle { cursor: grab; color: var(--ink-soft); font-size: 1.1rem; user-select: none; }
.af-step-icon { width: 18px; height: 18px; color: var(--green); flex: 0 0 auto; }
.af-step-remove-btn {
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 2px 6px;
}
.af-step-remove-btn:hover { color: #c14b3d; }

.af-field-list { padding: 8px 10px; }
.af-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  min-width: 0;
}
.af-field-row:hover { background: var(--cream); }
.af-field-row.is-idle { opacity: 0.55; }
.af-drag-handle { cursor: grab; color: var(--ink-soft); font-size: 1rem; user-select: none; flex-shrink: 0; }
.af-field-label { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.af-field-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  text-transform: capitalize;
}
.af-field-badge.is-required { background: #fff3c4; color: #7a5b00; border-color: transparent; }
.af-field-badge.is-idle-tag { background: #f0f0f0; color: #888; border-color: transparent; }
.af-field-badge.is-protected { background: var(--cream-dark, #eef4fa); color: var(--green); border-color: transparent; }

.af-toggle {
  position: relative;
  flex-shrink: 0;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.af-toggle input { opacity: 0; width: 0; height: 0; }
.af-toggle-track {
  position: absolute;
  inset: 0;
  background: #ccc;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}
.af-toggle-track::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.af-toggle input:checked + .af-toggle-track { background: var(--green); }
.af-toggle input:checked + .af-toggle-track::before { transform: translateX(16px); }

.af-field-delete-btn {
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
}
.af-field-delete-btn:hover { color: #c14b3d; }

.af-add-field-btn {
  margin: 6px 8px 10px;
}
.admin-modal-close:hover { color: var(--ink); }
