/**
 * CMS edit / structure mode + live site safety for card-only placeholders.
 * Hides stray Text plugins that were added to stats/department grids by mistake.
 */

/* Live + CMS: card slots must use hospital card plugins only */
.page-home .home-stats .auto-grid > .cms-plugin:not(:has(.stat-card)),
.page-home .home-stats .reveal-stagger > .cms-plugin:not(:has(.stat-card)),
.page-home .departments-grid > .cms-plugin:not(:has(.department-card)),
.page-home .doctors-showcase-grid > .cms-plugin:not(:has(.doctor-card--showcase)),
.page-home .testimonials-grid > .cms-plugin:not(:has(.testimonial-card)),
.page-home .news-grid > .cms-plugin:not(:has(.news-card)) {
    display: none !important;
}

/* CMS: show a clear warning where wrong plugins were hidden */
body.cms-editing .page-home .home-stats .auto-grid > .cms-plugin:not(:has(.stat-card)),
body.cms-editing .page-home .home-stats .reveal-stagger > .cms-plugin:not(:has(.stat-card)),
body.cms-editing .page-home .departments-grid > .cms-plugin:not(:has(.department-card)),
body.cms-editing .page-home .doctors-showcase-grid > .cms-plugin:not(:has(.doctor-card--showcase)),
body.cms-editing .page-home .testimonials-grid > .cms-plugin:not(:has(.testimonial-card)),
body.cms-editing .page-home .news-grid > .cms-plugin:not(:has(.news-card)) {
    display: block !important;
    max-height: none;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    border: 2px dashed #d97706;
    border-radius: 10px;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.45;
}

body.cms-editing .page-home .home-stats .auto-grid > .cms-plugin:not(:has(.stat-card)) > *,
body.cms-editing .page-home .departments-grid > .cms-plugin:not(:has(.department-card)) > * {
    display: none !important;
}

body.cms-editing .page-home .home-stats .auto-grid > .cms-plugin:not(:has(.stat-card))::before,
body.cms-editing .page-home .departments-grid > .cms-plugin:not(:has(.department-card))::before {
    content: "Remove this Text block. Use Hospital Stat Card / Department Card plugin instead (Structure → delete → Add plugin).";
    display: block;
}

body.cms-editing .page-home .departments-grid > .cms-plugin:not(:has(.department-card))::before {
    content: "Remove this Text block. Use Hospital Department Card plugin instead.";
}

/* Structure mode: keep grids readable */
body.cms-editing .page-home .reveal-stagger,
body.cms-editing .page-home .auto-grid {
    min-height: 0;
}

body.cms-editing .page-home .motion-on-scroll,
body.cms-editing .page-home .reveal,
body.cms-editing .page-home .reveal-from-top {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
}

/* Doctors page: CMS 5 uses <template class="cms-plugin"> markers — do not match :has(.doctor-card).
   Only hide/warn on obvious stray Text blocks, never on doctor cards. */
body[data-page-slug="doctors"] .inner-cards-wrap .text-plugin,
body[data-page-slug="doctors"] .doctors-page-grid .text-plugin {
    display: none !important;
}

body.cms-editing[data-page-slug="doctors"] .inner-cards-wrap .text-plugin,
body.cms-editing[data-page-slug="doctors"] .doctors-page-grid .text-plugin {
    display: block !important;
    flex: 1 1 100% !important;
    max-width: 100% !important;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    border: 2px dashed #d97706;
    border-radius: 10px;
    background: #fffbeb;
    color: #92400e;
    font-size: 0.88rem;
    font-weight: 600;
}

body.cms-editing[data-page-slug="doctors"] .inner-cards-wrap .text-plugin::before,
body.cms-editing[data-page-slug="doctors"] .doctors-page-grid .text-plugin::before {
    content: "Remove this Text block. Inner_Cards should use Hospital Doctor Card plugins only.";
    display: block;
}

/* CMS Structure: full-card hit layers block plugin drag on the page preview */
body.cms-toolbar-enabled .doctor-card-hit,
body.cms-toolbar-enabled .h-card-hit,
body.cms-structure-mode .doctor-card-hit,
body.cms-structure-mode .h-card-hit,
body.cms-toolbar-edit-mode .doctor-card-hit,
body.cms-toolbar-edit-mode .h-card-hit,
body.cms-editing .doctor-card-hit,
body.cms-editing .h-card-hit {
    pointer-events: none !important;
}

body.cms-toolbar-enabled .doctor-card-qr-badge,
body.cms-structure-mode .doctor-card-qr-badge,
body.cms-toolbar-edit-mode .doctor-card-qr-badge,
body.cms-editing .doctor-card-qr-badge {
    pointer-events: none !important;
}

/* Keep card hover/QR overlays from covering CMS drag handles */
body.cms-structure-mode .doctor-card-hover-panel,
body.cms-toolbar-edit-mode .doctor-card-hover-panel,
body.cms-editing .doctor-card--showcase .doctor-card-hover-panel {
    opacity: 0 !important;
    pointer-events: none !important;
}

body.cms-structure-mode .doctor-card--showcase,
body.cms-toolbar-edit-mode .doctor-card--showcase,
body.cms-editing .doctor-card--showcase {
    transform: none !important;
}

body.cms-editing .motion-on-scroll,
body.cms-editing .reveal,
body.cms-editing .reveal-from-top,
body.cms-editing .reveal-stagger > * {
    opacity: 1 !important;
    transform: none !important;
    visibility: visible !important;
}

body.cms-editing .doctors-showcase-grid > .cms-plugin,
body.cms-editing .departments-grid > .cms-plugin,
body.cms-editing .testimonials-grid > .cms-plugin,
body.cms-editing .news-grid > .cms-plugin,
body.cms-editing .auto-grid > .cms-plugin,
body.cms-editing .inner-cards-wrap > .cms-plugin,
body.cms-editing .inner-cards-wrap > .doctor-card--showcase {
    position: relative;
}
