/* Platenko Admin CMS Stylesheet */

/* ==========================================================================
   Phase 3: Admin CMS (/admin) & 4-Point Perspective Homography Modal
   ========================================================================== */
.admin-cms-container {
  max-width: 1360px;
  margin: 28px auto 80px;
  padding: 0 24px;
}

.admin-cms-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 28px;
  align-items: start;
}

.admin-cms-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  min-width: 0;
  max-width: 100%;
}

.admin-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.adm-upload-zone {
  background: var(--bg-subtle);
  border: 1.5px dashed var(--border-color);
  border-radius: 12px;
  padding: 16px;
  transition: border-color 0.2s, background 0.2s;
}

.adm-upload-zone.drag-over {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.08);
}

.adm-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.adm-upload-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 10px 0 0;
}

.adm-preview-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.adm-cover-thumb {
  width: 82px;
  height: 82px;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.adm-dims-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
}

.adm-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.preset-chip:hover {
  border-color: var(--border-focus);
}

.adm-inventory-scroll {
  overflow-x: auto;
  max-height: 75vh;
  overflow-y: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.adm-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}

.adm-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 2;
}

.adm-table td {
  padding: 10px 8px;
  vertical-align: middle;
}

.adm-table tbody tr.adm-clickable-row {
  cursor: pointer;
}

.adm-table tbody tr.adm-clickable-row td {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.adm-table tbody tr.adm-clickable-row td:first-child {
  border-left: 1px solid var(--border-color);
  border-radius: 10px 0 0 10px;
}

.adm-table tbody tr.adm-clickable-row td:last-child {
  border-right: 1px solid var(--border-color);
  border-radius: 0 10px 10px 0;
}

.adm-table tbody tr.adm-clickable-row:hover td {
  background: var(--bg-subtle);
  border-top-color: rgba(99, 102, 241, 0.4);
  border-bottom-color: rgba(99, 102, 241, 0.4);
}

.adm-table tbody tr.adm-clickable-row:hover td:first-child {
  border-left-color: rgba(99, 102, 241, 0.4);
}

.adm-table tbody tr.adm-clickable-row:hover td:last-child {
  border-right-color: rgba(99, 102, 241, 0.4);
}

.adm-row-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  display: block;
}

.adm-icon-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
}

.adm-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Admin Catalog Drag-and-Drop (⋮⋮) & Inline Position Jump (#N) */
.adm-order-cell {
  white-space: nowrap;
  padding-left: 6px !important;
  padding-right: 4px !important;
}

.adm-order-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.adm-drag-handle {
  cursor: grab;
  touch-action: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 6px 4px;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.adm-drag-handle:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.adm-drag-handle:active {
  cursor: grabbing;
}

.adm-drag-handle:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  pointer-events: none;
}

.adm-pos-btn {
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.adm-pos-btn:hover {
  border-color: #6366f1;
  color: var(--text-main);
  background: var(--bg-surface);
}

.adm-pos-input {
  width: 46px;
  height: 26px;
  padding: 0 4px;
  border-radius: 6px;
  border: 2px solid #6366f1;
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
  -moz-appearance: textfield;
}

.adm-pos-input::-webkit-outer-spin-button,
.adm-pos-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

body.adm-is-dragging {
  user-select: none !important;
  cursor: grabbing !important;
}

.adm-table tr.adm-row-dragging {
  opacity: 0.35;
  background: var(--bg-subtle);
}

.adm-table tr.adm-drop-before td {
  box-shadow: inset 0 3px 0 #6366f1;
}

.adm-table tr.adm-drop-after td {
  box-shadow: inset 0 -3px 0 #6366f1;
}

.adm-table tr.adm-row-just-moved {
  animation: admRowFlash 1.2s ease;
}

@keyframes admRowFlash {
  0% { background: rgba(99, 102, 241, 0.24); }
  100% { background: transparent; }
}

.adm-drag-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 260px;
  padding: 7px 11px;
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1.5px solid #6366f1;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
  font-size: 0.82rem;
  font-weight: 600;
}

.adm-drag-ghost img {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
}

.adm-drag-ghost-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.adm-drag-ghost-pos {
  background: #6366f1;
  color: #fff;
  border-radius: 9999px;
  padding: 2px 8px;
  font-size: 0.74rem;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.adm-auto-scroll {
  overflow-y: auto;
  padding-right: 2px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}


/* Per-Portal Pricing Grid, Social Photo Picker & Integrations Cards */
.adm-prices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.adm-photo-item.is-social {
  border-color: #6366f1;
}

.adm-photo-tool.is-active {
  background: #6366f1;
  color: #fff;
}

/* Super-Admin Lock Box for Integrations Tab */
/* ==========================================================================
   Unified Admin Navigation Bar (.admin-subnav)
   ========================================================================== */
.admin-subnav-wrap {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  width: 100%;
}

.admin-subnav-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.admin-nav-item:hover {
  border-color: var(--border-focus);
  background: var(--bg-surface);
}

.admin-nav-item.active {
  background: var(--text-main);
  color: var(--bg-primary);
  border-color: var(--text-main);
}

@media (max-width: 640px) {
  .admin-subnav-inner {
    padding: 8px 12px;
    gap: 6px;
  }
  .admin-nav-item {
    padding: 6px 11px;
    font-size: 0.78rem;
  }
}

.adm-editor-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  background: var(--bg-subtle);
  padding: 5px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  margin-bottom: 14px;
  width: 100%;
  max-width: 100%;
}

.adm-editor-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  white-space: normal;
  word-break: break-word;
}

.adm-tab-title {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.adm-tab-sub {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.78;
  line-height: 1.15;
}

@media (max-width: 480px) {
  .adm-editor-tab {
    padding: 7px 4px;
  }
  .adm-tab-title {
    font-size: 0.73rem;
  }
  .adm-tab-sub {
    font-size: 0.62rem;
  }
}

.adm-editor-tab:hover {
  color: var(--text-main);
}

.adm-editor-tab.active {
  background: var(--bg-surface);
  color: var(--text-main);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.adm-editor-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  max-width: 100%;
}

.adm-editor-panel > *,
.adm-dims-box {
  min-width: 0;
  max-width: 100%;
}

.adm-editor-panel.active {
  display: flex;
}

.adm-sticky-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  margin: 4px -4px -4px;
  padding: 12px 4px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adm-dirty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.adm-dirty-badge {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  color: #b45309;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 3px 10px;
  border-radius: 9999px;
}

.adm-dirty-badge.visible {
  display: inline-flex;
}

.btn-primary.is-dirty {
  background: #6366f1;
  border-color: #6366f1;
  color: #ffffff;
}

.adm-cat-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.adm-cat-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.adm-cat-chip.active {
  background: var(--text-main);
  color: var(--bg-primary);
  border-color: var(--text-main);
}

.adm-micro-badges {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.adm-micro-badge {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.adm-micro-badge.ok {
  background: #DCFCE7;
  color: #166534;
  border-color: rgba(22, 101, 52, 0.22);
}

.adm-nav-badge {
  background: #ef4444;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.adm-readiness-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  min-width: 0;
}

.adm-readiness-item {
  font-size: 0.76rem;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  word-break: break-word;
}

.adm-readiness-item.ok {
  border-color: rgba(22, 163, 74, 0.3);
}

.adm-inq-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adm-inq-card.is-new {
  border-color: #6366f1;
}

.adm-inq-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.adm-inq-msg {
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: pre-wrap;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
}

.adm-site-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.adm-site-section {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.adm-site-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin: 0 0 2px;
}

.adm-logo-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
}

.adm-logo-preview-wrap {
  min-width: 120px;
  min-height: 48px;
  max-width: 180px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border-color);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.adm-logo-preview-img {
  max-height: 42px;
  max-width: 160px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.adm-logo-preview-empty {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

.adm-accent-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.adm-accent-picker {
  width: 44px;
  height: 36px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  cursor: pointer;
}

.adm-accent-hex {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* FAQ Editor inside Site Settings Modal */
.adm-faq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.adm-faq-hint {
  margin: 2px 0 0;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.adm-faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.adm-faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.adm-faq-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.adm-faq-num {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.adm-faq-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.adm-faq-empty {
  margin: 0;
  padding: 14px 12px;
  border-radius: 8px;
  border: 1px dashed var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

@media (max-width: 980px) {
  .admin-cms-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }
  .adm-inventory-scroll {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .admin-cms-container {
    margin: 16px auto 48px;
    padding: 0 12px;
  }
  .admin-cms-card {
    padding: 16px;
    border-radius: 12px;
  }
  #admSearchInput {
    max-width: 100% !important;
    width: 100%;
  }
  .adm-site-grid {
    grid-template-columns: 1fr;
  }
}
