/* ==========================================================================
   Abide Fellowship - On-Page Visual Admin & CMS Styles
   Robust in-browser CMS for editing every page element and uploading assets
   ========================================================================== */

/* Floating Admin Toggle Button */
.admin-toggle-pill {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2500;
  background: #1e1e1e;
  color: #ffffff;
  border: 1px solid #333333;
  padding: 10px 18px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  display: none; /* Discreet: hidden from public visitors */
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body.admin-visible .admin-toggle-pill,
body.edit-mode-active .admin-toggle-pill {
  display: flex !important;
}

.admin-toggle-pill:hover {
  background: var(--plum, #835874);
  border-color: var(--plum-300, #b893ab);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 28px rgba(131, 88, 116, 0.45);
}

.admin-toggle-pill .badge {
  background: #38a169;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Edit Mode Active - Visual highlights on editable page elements */
body.edit-mode-active [data-editable] {
  position: relative;
  transition: outline-color 0.2s ease, background-color 0.2s ease;
}

/* Highlight All Editable Areas Mode */
body.show-editable-highlights [data-editable] {
  outline: 2px dashed rgba(168, 85, 247, 0.8) !important;
  outline-offset: 3px;
  background-color: rgba(168, 85, 247, 0.08) !important;
  cursor: text;
}

body.show-editable-highlights [data-editable]:hover {
  outline-color: #a855f7 !important;
  background-color: rgba(168, 85, 247, 0.16) !important;
}

body.show-editable-highlights [data-editable-img] {
  outline: 2px dashed rgba(245, 158, 11, 0.9) !important;
  outline-offset: 3px;
  cursor: pointer !important;
  position: relative;
}

body.show-editable-highlights [data-editable-img]:hover {
  outline-color: #f59e0b !important;
}

body.show-editable-highlights [data-editable-btn] {
  outline: 2px dashed rgba(59, 130, 246, 0.9) !important;
  outline-offset: 3px;
  cursor: pointer !important;
}

/* On-Hover Quick Tooltips */
body.edit-mode-active [data-editable]:hover::after {
  content: "✏️ Click to edit";
  position: absolute;
  top: -24px;
  left: 0;
  background: #18181b;
  color: #fafafa;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid #71717a;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
}

body.edit-mode-active [data-editable-img]:hover::after {
  content: "🖼️ Click to replace image";
  position: absolute;
  top: 10px;
  left: 10px;
  background: #18181b;
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #f59e0b;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
}

body.edit-mode-active [data-editable-btn]:hover::after {
  content: "🔗 Click to edit link";
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: #18181b;
  color: #60a5fa;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #3b82f6;
  z-index: 1000;
  pointer-events: none;
  white-space: nowrap;
}

/* Top Edit Banner when active */
.edit-mode-banner {
  display: none;
  background: #1e131d;
  color: #ffffff;
  padding: 8px 16px;
  font-size: 0.85rem;
  border-bottom: 2px solid var(--plum, #835874);
  position: sticky;
  top: 0;
  z-index: 1001;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

body.edit-mode-active .edit-mode-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.banner-left strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #fce7f3;
}

.banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-banner {
  padding: 6px 13px;
  font-size: 0.8rem;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}

.btn-banner-highlight {
  background: #3f3f46;
  color: #f4f4f5;
  border: 1px solid #52525b;
}
.btn-banner-highlight:hover { background: #52525b; }
body.show-editable-highlights .btn-banner-highlight {
  background: #a855f7;
  color: #ffffff;
  border-color: #c084fc;
}

.btn-banner-assets {
  background: #4f46e5;
  color: #ffffff;
}
.btn-banner-assets:hover { background: #4338ca; }

.btn-banner-save {
  background: #15803d;
  color: #ffffff;
}
.btn-banner-save:hover { background: #16a34a; }

.btn-banner-drawer {
  background: var(--plum, #835874);
  color: #ffffff;
}
.btn-banner-drawer:hover { background: #6d465f; }

/* Admin Drawer Sidebar (Wide & Comfortable) */
.admin-drawer {
  position: fixed;
  top: 0;
  right: -660px;
  width: 620px;
  max-width: 96vw;
  height: 100vh;
  background: #18181b;
  color: #f4f4f5;
  z-index: 2600;
  box-shadow: -12px 0 45px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-sans, system-ui, sans-serif);
}

.admin-drawer.open {
  right: 0;
}

.admin-drawer-header {
  padding: 1.1rem 1.4rem;
  background: #202023;
  border-bottom: 1px solid #3f3f46;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.admin-drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fafafa;
}

.admin-drawer-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-drawer-close {
  background: #3f3f46;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  font-size: 1.2rem;
}
.admin-drawer-close:hover { background: #52525b; }

/* Quick Category Dropdown Selector */
.admin-nav-dropdown-wrap {
  padding: 10px 1.4rem 4px 1.4rem;
  background: #1f1f23;
  border-bottom: 1px solid #2e2e33;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.admin-nav-dropdown-wrap label {
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #a1a1aa;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.admin-category-select {
  flex: 1;
  background: #27272a;
  color: #ffffff;
  border: 1px solid #3f3f46;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.admin-category-select:focus {
  outline: none;
  border-color: var(--plum, #835874);
}

/* Category Navigation Pills (Wrapped - NEVER clipped by horizontal scrollbars) */
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #202023;
  border-bottom: 1px solid #3f3f46;
  padding: 10px 1.4rem;
  flex-shrink: 0;
}

.admin-tab-btn {
  padding: 6px 11px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #d4d4d8;
  background: #2a2a2e;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.admin-tab-btn:hover {
  background: #38383e;
  color: #ffffff;
  border-color: #52525b;
}

.admin-tab-btn.active {
  background: var(--plum, #835874);
  color: #ffffff;
  border-color: #b893ab;
  box-shadow: 0 2px 6px rgba(131, 88, 116, 0.4);
}

/* Admin Drawer Content Body */
.admin-drawer-body {
  flex-grow: 1;
  padding: 1.4rem;
  overflow-y: auto;
}

.admin-tab-pane {
  display: none;
}
.admin-tab-pane.active {
  display: block;
}

.admin-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1.1rem;
  color: #ffffff;
  border-bottom: 1px solid #3f3f46;
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-help-text {
  font-size: 0.85rem;
  color: #a1a1aa;
  line-height: 1.5;
  margin-bottom: 1.2rem;
}

.admin-form-group {
  margin-bottom: 1.1rem;
}

.admin-form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #a1a1aa;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-form-group small {
  display: block;
  font-size: 0.74rem;
  color: #71717a;
  margin-top: 4px;
}

.admin-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.admin-input,
.admin-textarea {
  width: 100%;
  padding: 9px 12px;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.admin-input:focus,
.admin-textarea:focus {
  outline: none;
  border-color: var(--plum-300, #b893ab);
  box-shadow: 0 0 0 2px rgba(184, 147, 171, 0.3);
}

.admin-textarea {
  resize: vertical;
  min-height: 75px;
}

/* Image Field with Preview Thumbnail and Upload Button */
.admin-image-field {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #202024;
  border: 1px solid #38383e;
  border-radius: 8px;
  padding: 10px;
  margin-top: 4px;
}

.admin-image-preview {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  background: #2d2d32;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #44444c;
}

.admin-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-image-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-image-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-admin-upload {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #4f46e5;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease;
}
.btn-admin-upload:hover { background: #4338ca; }

.btn-admin-reset-img {
  background: #3f3f46;
  color: #d4d4d8;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}
.btn-admin-reset-img:hover { background: #52525b; color: #fff; }

/* Dedicated Asset Library Cards */
.admin-asset-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #222226;
  border: 1px solid #38383e;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.admin-asset-thumb {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  background: #2a2a30;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid #4a4a52;
}

.admin-asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-asset-info {
  flex: 1;
}

.admin-asset-info strong {
  display: block;
  font-size: 0.92rem;
  color: #fafafa;
  margin-bottom: 2px;
}

.admin-asset-info small {
  display: block;
  font-size: 0.76rem;
  color: #a1a1aa;
  margin-bottom: 8px;
}

.admin-asset-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Universal Drag and Drop Upload Zone */
.admin-dropzone {
  border: 2px dashed #52525b;
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  background: #1f1f23;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
}

.admin-dropzone:hover,
.admin-dropzone.drag-over {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.08);
}

.admin-dropzone .dropzone-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 6px;
}

.admin-dropzone strong {
  display: block;
  font-size: 0.95rem;
  color: #f4f4f5;
}

.admin-dropzone small {
  display: block;
  font-size: 0.78rem;
  color: #a1a1aa;
  margin-top: 4px;
}

.admin-dropzone-result {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #222226;
  border: 1px solid #38383e;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 16px;
}

.admin-dropzone-result img {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
}

.admin-dropzone-result .result-details {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Card Block / List Item in Admin */
.admin-item-block {
  background: #222226;
  border: 1px solid #38383e;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}

.admin-item-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #333339;
}

.admin-item-block-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fafafa;
}

.btn-admin-del {
  background: #7f1d1d;
  color: #fecaca;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-admin-del:hover { background: #991b1b; }

.btn-admin-add {
  background: #27272a;
  color: #fafafa;
  border: 1px dashed #52525b;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s ease;
}
.btn-admin-add:hover {
  background: #3f3f46;
  border-color: #a1a1aa;
}

/* On-Page Add Cards (Devotionals & Series) */
.card-add-interactive {
  border: 2px dashed rgba(168, 85, 247, 0.6) !important;
  background: rgba(168, 85, 247, 0.05) !important;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 1.5rem;
  cursor: pointer;
  border-radius: 16px;
  min-height: 280px;
  transition: all 0.25s ease;
}

body.edit-mode-active .card-add-interactive {
  display: flex;
}

.card-add-interactive:hover {
  border-color: #a855f7 !important;
  background: rgba(168, 85, 247, 0.12) !important;
  transform: translateY(-3px);
}

.card-add-interactive .add-icon {
  font-size: 2.4rem;
  margin-bottom: 10px;
}

.card-add-interactive strong {
  font-size: 1.1rem;
  color: #fafafa;
  margin-bottom: 4px;
}

.card-add-interactive span {
  font-size: 0.82rem;
  color: #d8b4fe;
}

/* Card Hover Action Bar for Quick Edits */
.card-quick-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
  gap: 6px;
  z-index: 50;
}

body.edit-mode-active .devotional-card:hover .card-quick-actions,
body.edit-mode-active .series-card:hover .card-quick-actions {
  display: flex;
}

.btn-card-quick {
  background: rgba(24, 24, 27, 0.92);
  color: #ffffff;
  border: 1px solid #52525b;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
}
.btn-card-quick:hover {
  background: var(--plum, #835874);
  border-color: #b893ab;
}
.btn-card-quick.btn-quick-del:hover {
  background: #991b1b;
  border-color: #f87171;
}

/* Floating Quick Inspector Modal (For clicking images / links) */
.quick-inspector-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.quick-inspector-modal.active {
  display: flex;
}

.quick-inspector-box {
  background: #1c1c20;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  width: 480px;
  max-width: 95vw;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: modalScaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.quick-inspector-header {
  padding: 1rem 1.4rem;
  background: #25252a;
  border-bottom: 1px solid #38383e;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.quick-inspector-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fafafa;
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-inspector-close {
  background: transparent;
  border: none;
  color: #a1a1aa;
  font-size: 1.4rem;
  cursor: pointer;
}
.quick-inspector-close:hover { color: #ffffff; }

.quick-inspector-body {
  padding: 1.4rem;
}

.quick-inspector-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #38383e;
  margin-bottom: 1.2rem;
  background: #141416;
}

.quick-inspector-footer {
  padding: 1rem 1.4rem;
  background: #202024;
  border-top: 1px solid #38383e;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Admin Footer Action Buttons */
.admin-drawer-footer {
  padding: 1.1rem 1.4rem;
  background: #202023;
  border-top: 1px solid #3f3f46;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.btn-admin-primary {
  flex: 1;
  background: #15803d;
  color: #ffffff;
  padding: 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.2s ease;
}
.btn-admin-primary:hover { background: #16a34a; }

.btn-admin-secondary {
  background: #3f3f46;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s ease;
}
.btn-admin-secondary:hover { background: #52525b; }

.btn-admin-danger {
  background: #7f1d1d;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: background-color 0.2s ease;
}
.btn-admin-danger:hover { background: #991b1b; }

.export-box {
  background: #222226;
  border: 1px dashed #52525b;
  border-radius: 8px;
  padding: 14px;
  margin-top: 1rem;
}
.export-box p {
  font-size: 0.85rem;
  color: #d4d4d8;
  margin-bottom: 10px;
}
