/* DGS Team Block Editor Styles */

/* Editor-specific overrides */
.block-editor-block-list__layout .dgs-team-block {
    margin: var(--space-m) 0;
}

/* Ensure proper spacing in editor */
.block-editor-block-list__layout .dgs-team-block__grid {
    gap: var(--space-m);
}

/* Force grid columns to display properly in editor */
.block-editor-block-list__layout .dgs-team-block.desktop-cols-1 .dgs-team-block__members {
    grid-template-columns: 1fr !important;
}

.block-editor-block-list__layout .dgs-team-block.desktop-cols-2 .dgs-team-block__members {
    grid-template-columns: repeat(2, 1fr) !important;
}

.block-editor-block-list__layout .dgs-team-block.desktop-cols-3 .dgs-team-block__members {
    grid-template-columns: repeat(3, 1fr) !important;
}

.block-editor-block-list__layout .dgs-team-block.desktop-cols-4 .dgs-team-block__members {
    grid-template-columns: repeat(4, 1fr) !important;
}

.block-editor-block-list__layout .dgs-team-block.desktop-cols-5 .dgs-team-block__members {
    grid-template-columns: repeat(5, 1fr) !important;
}

.block-editor-block-list__layout .dgs-team-block.desktop-cols-6 .dgs-team-block__members {
    grid-template-columns: repeat(6, 1fr) !important;
}

.block-editor-block-list__layout .dgs-team-block__carousel .splide__list {
    gap: var(--space-m);
}

/* Editor interaction states */
.block-editor-block-list__layout .dgs-team-block__member-card {
    cursor: pointer;
    position: relative;
}

.block-editor-block-list__layout .dgs-team-block__member-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-radius: var(--radius-m);
    transition: border-color 0.2s ease;
    pointer-events: none;
}

.block-editor-block-list__layout .dgs-team-block__member-card:hover::before {
    border-color: var(--wp-admin-theme-color);
}

/* Disable social link interactions in editor */
.block-editor-block-list__layout .dgs-team-block__social-link {
    cursor: default;
    pointer-events: none;
}

/* Editor placeholder states */
.block-editor-block-list__layout .dgs-team-block__tagline:empty::before {
    content: attr(placeholder);
    color: var(--neutral-light);
    font-style: italic;
}

.block-editor-block-list__layout .dgs-team-block__heading:empty::before {
    content: attr(placeholder);
    color: var(--neutral-light);
    font-style: italic;
}

.block-editor-block-list__layout .dgs-team-block__subheading:empty::before {
    content: attr(placeholder);
    color: var(--neutral-light);
    font-style: italic;
}

.block-editor-block-list__layout .dgs-team-block__member-name:empty::before {
    content: attr(placeholder);
    color: var(--neutral-light);
    font-style: italic;
}

.block-editor-block-list__layout .dgs-team-block__member-title:empty::before {
    content: attr(placeholder);
    color: var(--neutral-light);
    font-style: italic;
}

.block-editor-block-list__layout .dgs-team-block__member-description:empty::before {
    content: attr(placeholder);
    color: var(--neutral-light);
    font-style: italic;
}

/* Ensure proper focus styles for accessibility */
.block-editor-block-list__layout .dgs-team-block [contenteditable="true"]:focus {
    outline: 2px solid var(--wp-admin-theme-color);
    outline-offset: 2px;
}

/* Grid column preview in editor */
.block-editor-block-list__layout .dgs-team-block__grid {
    position: relative;
}

.block-editor-block-list__layout .dgs-team-block__grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, transparent 0%, var(--wp-admin-theme-color-darker-20) 1%, transparent 1%);
    background-size: calc(100% / var(--grid-columns, 4)) 100%;
    opacity: 0.1;
    pointer-events: none;
}

/* Hide grid overlay when not needed */
.block-editor-block-list__layout .dgs-team-block.display-carousel .dgs-team-block__grid::before {
    display: none;
}

/* Carousel preview adjustments */
.block-editor-block-list__layout .dgs-team-block__carousel {
    position: relative;
}

.block-editor-block-list__layout .dgs-team-block__carousel::after {
    content: 'Carousel Mode - Preview shows grid layout';
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--wp-admin-theme-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 100;
}

/* Responsive preview indicators */
@media (max-width: 1024px) {
    .block-editor-block-list__layout .dgs-team-block__grid::before {
        background-size: calc(100% / var(--tablet-columns, 2)) 100%;
    }
}

@media (max-width: 768px) {
    .block-editor-block-list__layout .dgs-team-block__grid::before {
        background-size: calc(100% / var(--mobile-columns, 1)) 100%;
    }
}

/* Selected block indicators */
.block-editor-block-list__layout .dgs-team-block.is-selected .dgs-team-block__member-card::before {
    border-color: var(--wp-admin-theme-color);
    border-style: dashed;
}

/* Improve visibility of social icons in editor */
.block-editor-block-list__layout .dgs-team-block__social-link {
    opacity: 0.8;
}

.block-editor-block-list__layout .dgs-team-block__social-link:hover {
    opacity: 1;
    transform: none;
}

/* Ensure proper text selection in editor */
.block-editor-block-list__layout .dgs-team-block [contenteditable="true"] {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Block appender spacing */
.block-editor-block-list__layout .dgs-team-block + .block-list-appender {
    margin-top: var(--space-l);
}

/* Prevent layout shifts during editing */
.block-editor-block-list__layout .dgs-team-block__member-card {
    min-height: 300px;
}

.block-editor-block-list__layout .dgs-team-block__member-info {
    min-height: 120px;
}

/* Loading states for images */
.block-editor-block-list__layout .dgs-team-block__avatar {
    background: var(--neutral-ultra-light);
}

.block-editor-block-list__layout .dgs-team-block__avatar[src=""] {
    background: linear-gradient(45deg, var(--neutral-ultra-light) 25%, transparent 25%, transparent 75%, var(--neutral-ultra-light) 75%, var(--neutral-ultra-light)),
                linear-gradient(45deg, var(--neutral-ultra-light) 25%, transparent 25%, transparent 75%, var(--neutral-ultra-light) 75%, var(--neutral-ultra-light));
    background-size: 10px 10px;
    background-position: 0 0, 5px 5px;
}