/**
 * Trilobita DocVault - Block Editor Styles
 *
 * @package TrilobitaDocVault
 */

/* Block placeholder */
.wp-block-trdv-document .components-placeholder {
    min-height: 100px;
}

/* Block preview wrapper */
.wp-block-trdv-document {
    padding: 5px;
}

/* Document link popover */
.trdv-link-popover {
    padding: 16px;
    min-width: 280px;
}

.trdv-link-popover .trdv-doc-selector {
    margin-bottom: 12px;
}

/* Inline document link in editor */
.block-editor-rich-text__editable a.trdv-inline-link {
    color: #0073aa;
    text-decoration: underline;
    text-decoration-style: dotted;
}

/* Async document search selector */
.trdv-doc-selector {
    margin-bottom: 16px;
}

.trdv-doc-selector .components-base-control__label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    color: #1e1e1e;
}

.trdv-doc-selector__wrap {
    position: relative;
}

.trdv-doc-selector__wrap .components-text-control__input {
    width: 100%;
}

.trdv-doc-selector__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    /* In the sidebar, borrow the panel's 16px right padding to gain a little extra width. */
    right: -16px;
    min-width: 260px;
    z-index: 99999;
    background: #fff;
    border: 1px solid #949494;
    border-top: none;
    border-radius: 0 0 2px 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    max-height: 200px;
    overflow-y: auto;
}

/* In the block canvas Placeholder the sidebar constraint does not apply,
   so let the dropdown expand freely to a comfortable reading width. */
.components-placeholder .trdv-doc-selector__dropdown {
    right: auto;
    min-width: 380px;
}

.trdv-doc-selector__loading-bar {
    height: 2px;
    background: var(--wp-admin-theme-color, #2271b1);
    animation: trdv-loading-slide 1s ease-in-out infinite;
    transform-origin: left center;
}

@keyframes trdv-loading-slide {
    0%   { transform: scaleX(0.05); opacity: 0.6; }
    50%  { transform: scaleX(0.7);  opacity: 1; }
    100% { transform: scaleX(1);    opacity: 0; }
}

.trdv-doc-selector__option {
    display: block;
    width: 100%;
    padding: 6px 8px;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    color: #1e1e1e;
}

.trdv-doc-selector__option:last-child {
    border-bottom: none;
}

.trdv-doc-selector__option:hover,
.trdv-doc-selector__option:focus {
    background: #f0f0f0;
    outline: none;
}

.trdv-doc-selector__option.is-selected {
    color: var(--wp-admin-theme-color, #2271b1);
    font-weight: 600;
}

.trdv-doc-selector__message {
    padding: 6px 8px;
    font-size: 13px;
    color: #757575;
    font-style: italic;
}
