/* Media library picker modal styles.
 * Designed to be light-touch: doesn't override the Slate admin theme,
 * only adds new classes prefixed .mlp- (Media Library Picker).
 */

.mlp-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;
    z-index: 1000;
}
.mlp-overlay.is-open { display: block; }

.mlp-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 95vw; max-width: 980px;
    height: 80vh; max-height: 720px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
    overflow: hidden;
}
.mlp-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e9f0;
}
.mlp-title { font-weight: 600; font-size: 16px; }
.mlp-close {
    background: transparent; border: 0; cursor: pointer;
    font-size: 24px; line-height: 1; padding: 4px 8px; color: #666;
}
.mlp-close:hover { color: #000; }

.mlp-toolbar {
    padding: 8px 16px;
    border-bottom: 1px solid #e5e9f0;
    display: flex; gap: 8px; align-items: center;
    background: #fafafa;
}
.mlp-search {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

.mlp-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    background: #f7f7f9;
}
.mlp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}
.mlp-item {
    border: 2px solid transparent;
    border-radius: 6px;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.1s;
}
.mlp-item:hover { border-color: #888; }
.mlp-item.is-selected { border-color: #2a7; }
.mlp-thumb {
    aspect-ratio: 1;
    background: #eee;
    display: flex; align-items: center; justify-content: center;
}
.mlp-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.mlp-item-meta {
    padding: 6px 8px;
    font-size: 11px;
    line-height: 1.3;
    color: #555;
}
.mlp-item-name {
    font-weight: 600;
    color: #222;
    word-break: break-all;
    margin-bottom: 2px;
}

.mlp-loading, .mlp-empty {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

.mlp-footer {
    padding: 10px 16px;
    border-top: 1px solid #e5e9f0;
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px;
    background: #fafafa;
}
.mlp-status {
    font-size: 12px; color: #666;
}
.mlp-actions {
    display: flex; gap: 8px;
}
.mlp-btn {
    padding: 6px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
}
.mlp-btn-primary {
    background: #222; color: #fff; border-color: #222;
}
.mlp-btn-primary:disabled {
    background: #999; border-color: #999; cursor: not-allowed;
}

.mlp-trigger-btn {
    /* The trigger button placed next to image inputs. */
    margin-top: 6px;
    padding: 4px 10px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}
.mlp-trigger-btn:hover { background: #f0f0f0; }
