/* ============================================
   INDEX PAGE ADMIN EDITING SYSTEM
   ============================================ */

body.admin-mode .editable-block,
body.admin-mode .editable-block-inner {
  position: relative !important;
  outline: 2px dashed rgba(0, 151, 167, 0);
  outline-offset: -8px;
  transition: outline-color 0.24s ease, background-color 0.24s ease;
}

body.admin-mode .editable-block:hover,
body.admin-mode .editable-block-inner:hover {
  outline-color: rgba(0, 151, 167, 0.55);
}

body.admin-mode .hero-overlay {
  pointer-events: none;
}

.index-admin-section-label {
  display: none;
  position: absolute;
  top: 14px;
  left: 18px;
  z-index: 2200;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(9, 25, 43, 0.88);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.index-admin-section-label.dark {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

body.admin-mode .editable-block:hover .index-admin-section-label {
  display: inline-flex;
}

.admin-section-controls {
  display: none;
  position: absolute;
  right: 26px;
  bottom: 26px;
  z-index: 2500;
  gap: 10px;
  align-items: center;
}

.admin-section-controls.inner {
  right: 18px;
  bottom: 18px;
}

body.admin-mode .editable-block:hover > .admin-section-controls,
body.admin-mode .editable-block:hover > .container > .admin-section-controls,
body.admin-mode .editable-block-inner:hover > .admin-section-controls {
  display: flex;
}

.admin-control-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ffffff;
  background: rgba(0, 151, 167, 0.96);
  box-shadow: 0 14px 32px rgba(0, 151, 167, 0.34);
  backdrop-filter: blur(10px);
  transition: transform 0.24s ease, background 0.24s ease, box-shadow 0.24s ease;
}

.admin-control-btn:hover {
  transform: translateY(-3px) scale(1.05);
  background: #007d8a;
  box-shadow: 0 18px 40px rgba(0, 151, 167, 0.46);
}

.admin-control-btn svg {
  width: 18px;
  height: 18px;
}

.admin-control-btn.admin-add {
  background: rgba(16, 185, 129, 0.96);
}

.admin-control-btn.admin-add:hover {
  background: #059669;
}

.admin-control-btn.admin-remove {
  background: rgba(239, 68, 68, 0.96);
}

.admin-control-btn.admin-remove:hover {
  background: #dc2626;
}

.index-admin-item {
  position: relative !important;
}

body.admin-mode .index-admin-item {
  outline: 1.5px dashed rgba(0, 151, 167, 0);
  outline-offset: -5px;
}

body.admin-mode .index-admin-item:hover {
  outline-color: rgba(0, 151, 167, 0.5);
}

.admin-item-controls {
  display: none;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2600;
  gap: 7px;
  align-items: center;
}

body.admin-mode .index-admin-item:hover > .admin-item-controls {
  display: flex;
}

.admin-mini-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ffffff;
  background: rgba(0, 151, 167, 0.96);
  box-shadow: 0 8px 18px rgba(0, 151, 167, 0.28);
  backdrop-filter: blur(8px);
  transition: transform 0.2s ease, background 0.2s ease;
}

.admin-mini-btn:hover {
  transform: translateY(-2px) scale(1.05);
  background: #007d8a;
}

.admin-mini-btn.admin-remove {
  background: rgba(239, 68, 68, 0.96);
}

.admin-mini-btn.admin-remove:hover {
  background: #dc2626;
}

.admin-mini-btn svg {
  width: 14px;
  height: 14px;
}

.index-admin-list-wrap {
  position: relative;
}

body.admin-mode #homeAboutFeatures::after {
  content: "+";
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #10b981;
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.28);
}

body.admin-mode #homeAboutFeatures:hover::after {
  display: flex;
}

body.admin-mode #homeAboutFeatures:hover {
  cursor: pointer;
}

body.admin-mode #homeAboutFeatures:hover::before {
  content: "Click section + button through About controls for adding features";
  position: absolute;
  right: 36px;
  bottom: 0;
  z-index: 2600;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(9, 25, 43, 0.92);
  color: #ffffff;
  font-size: 0.72rem;
  white-space: nowrap;
}

/* Admin toolbar fallback, in case admin.css is older */
.admin-toolbar {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 3000;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(9, 25, 43, 0.94);
  color: #ffffff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(10px);
  font-family: inherit;
}

body.admin-mode .admin-toolbar {
  display: flex;
}

.admin-toolbar span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.admin-toolbar button,
.admin-toolbar a {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.admin-toolbar button:hover,
.admin-toolbar a:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

/* Admin modal fallback */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(9, 25, 43, 0.72);
  backdrop-filter: blur(8px);
}

.admin-modal.show {
  display: flex;
}

.admin-modal-card {
  width: min(680px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(0, 151, 167, 0.18);
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.admin-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #111827;
}

.admin-modal-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: #f3f4f6;
  color: #111827;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
}

.admin-modal-close:hover {
  background: #e5e7eb;
}

.admin-form {
  padding: 24px;
}

.admin-form-group {
  margin-bottom: 18px;
}

.admin-form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  color: #374151;
  margin-bottom: 8px;
}

.admin-form-group input,
.admin-form-group textarea,
.admin-form-group select {
  width: 100%;
  border: 1.5px solid #d1d5db;
  border-radius: 12px;
  padding: 11px 13px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #111827;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #ffffff;
}

.admin-form-group textarea {
  min-height: 110px;
  resize: vertical;
}

.admin-form-group input:focus,
.admin-form-group textarea:focus,
.admin-form-group select:focus {
  border-color: #0097a7;
  box-shadow: 0 0 0 4px rgba(0, 151, 167, 0.11);
}

.admin-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 8px;
}

.admin-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-btn:hover {
  transform: translateY(-1px);
}

.admin-btn-primary {
  background: #0097a7;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(0, 151, 167, 0.22);
}

.admin-btn-secondary {
  background: #f3f4f6;
  color: #111827;
}

.admin-status {
  margin-top: 12px;
  min-height: 20px;
  font-size: 0.82rem;
  font-weight: 700;
}

.admin-status.success {
  color: #047857;
}

.admin-status.error {
  color: #b91c1c;
}

.admin-login-needed {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 4500;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(9, 25, 43, 0.95);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.25);
}

.admin-login-needed a {
  color: #67e8f9;
  text-decoration: underline;
}

@media (max-width: 768px) {
  .admin-section-controls {
    right: 16px;
    bottom: 16px;
  }

  .admin-control-btn {
    width: 40px;
    height: 40px;
  }

  .admin-item-controls {
    top: 8px;
    right: 8px;
  }

  .admin-mini-btn {
    width: 30px;
    height: 30px;
  }

  .index-admin-section-label {
    top: 10px;
    left: 12px;
  }
}


/* ============================================
   LAB IMAGE FALLBACK FIX
   Keeps Lab Highlights visible even if Firestore
   has blank/broken image paths.
   ============================================ */
.lab-col {
  position: relative;
  min-height: 320px;
  background: linear-gradient(135deg, rgba(0,151,167,0.14), rgba(9,25,43,0.92));
}

.lab-image-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ffffff;
  background:
    radial-gradient(circle at 20% 20%, rgba(0,151,167,0.38), transparent 30%),
    radial-gradient(circle at 80% 25%, rgba(255,107,53,0.20), transparent 28%),
    linear-gradient(135deg, #09192b 0%, #10364a 100%);
  z-index: 0;
}

.lab-image-fallback span {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.24);
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.lab-image-fallback small {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.lab-col img {
  position: relative;
  z-index: 1;
}

.lab-col:not(.lab-image-missing) .lab-image-fallback {
  display: none;
}

.lab-col .layer {
  z-index: 2;
}
/* ============================================
   HOMEPAGE LATEST PUBLICATIONS VISIBILITY FIX
   ============================================ */

#homePubsList {
  min-height: 120px;
}

#homePubsList .pub-preview-item {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none;
}

#homePubsList .pub-info,
#homePubsList .pub-info h4,
#homePubsList .pub-authors,
#homePubsList .pub-venue {
  opacity: 1 !important;
  visibility: visible !important;
}
/* ============================================
   HOMEPAGE STATS BAR SAFE VISIBILITY FIX
   ============================================ */

.stats-bar,
.stats-bar .stats-grid,
.stats-bar .stat-item,
.stats-bar .stat-number,
.stats-bar .stat-label {
  opacity: 1 !important;
  visibility: visible !important;
}

.stats-bar {
  display: block !important;
  position: relative;
  z-index: 2;
}

.stats-bar .stat-item {
  transform: none !important;
}

.stats-bar .stat-number {
  color: var(--color-teal) !important;
}

.stats-bar .stat-label {
  color: var(--color-gray-500) !important;
}
